question

PiotrPe avatar image
0 Likes"
PiotrPe asked PiotrPe commented

problem with agv network building in in flexscript

Hello Flexsim Users,


This problem was here presented already. I used all advices but model does still not work - Taskexecutor can not find control points


I used the function_s in different places , but it did not solve the problem - sometimes it changed my topology


Thank you for advice

Piotr

treenode path1 = createinstance(node("/AGV/StraightPath",library()),model());
treenode path2 = createinstance(node("/AGV/StraightPath",library()),model());
treenode cpA = createinstance(node("/AGV/ControlPoint",library()),model());
treenode cpB = createinstance(node("/AGV/ControlPoint",library()),model());
treenode cpC = createinstance(node("/AGV/ControlPoint",library()),model());


Object o1=path1; //casting to get rotation method
Object o2=path2;
Object ocpA=cpA;
Object ocpB=cpB;
Object ocpC=cpC;
// sciezki:
ocpA.location=Vec3(0,0,0);
ocpA.location=Vec3(0,0,0); ///CP
o1.location=Vec3(0,0,0);
o1.size=5;
function_s(path1, "finalizeSpatialChanges");


ocpB.location=Vec3(5,0,0);
o2.location=Vec3(5,0,0);
o2.size=3;
o2.rotation=90;
ocpC.location=Vec3(5,3,0);
//function_s(path2, "finalizeSpatialChanges");


//*********************************************************
// Vehicle code: Object current = ownerobject(c); /**Custom Code*/ current.location = Vec3(-6,-6,1); TaskSequence ts = TaskSequence.create(current); treenode destC=Model.find("cpC"); treenode destB=Model.find("cpB"); print("dest=",destB); ts.addTask(TASKTYPE_TRAVEL, destB); ts.addTask(TASKTYPE_TRAVEL, destC); //ts.dispatch(); print(c);
FlexSim 23.0.3
agv network bulding in flexscripfuction_s problem
· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

PiotrPe avatar image PiotrPe commented ·

Apologies , I forgot to send:

// end of code for topology

ocpA.name="cpA";

ocpB.name="cpB";

ocpC.name="cpC";

0 Likes 0 ·

1 Answer

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered PiotrPe commented

You're not renaming your control points.

So here's the updated code:

Object path1 = Object.create("AGV::StraightPath");
Object path2 = Object.create("AGV::StraightPath");
Object cpA = Object.create("AGV::ControlPoint");
Object cpB = Object.create("AGV::ControlPoint");
Object cpC = Object.create("AGV::ControlPoint");

cpA.name="cpA";
cpB.name="cpB";
cpC.name="cpC";

cpA.setProperty("Location",Vec3(0,0,0));
path1.setProperty("StartLocation",Vec3(0,0,0));
path1.setProperty("EndLocation",Vec3(5,0,0));
cpB.setProperty("Location",Vec3(5,0,0));
path2.setProperty("StartLocation",Vec3(5,0,0));
path2.setProperty("EndLocation",Vec3(5,3,0));
cpC.setProperty("Location",Vec3(5,3,0));

And the model attached.

SciptedAGVNetwork.fsm


· 1
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

PiotrPe avatar image PiotrPe commented ·

Thank you Jason,

very short and simply script that works!

best regards

Piotr

0 Likes 0 ·