question

Jouky D avatar image
0 Likes"
Jouky D asked Jouky D commented

Trigger when kinematics is added in Object kinematics and obtain its info?

Hello everyone,

After @Felix Möhlmann answered me this question (AGV: How to trigger when kinematics is added): https://answers.flexsim.com/questions/148025/agv-how-to-trigger-when-kinematics-is-added.html.

I was searching a similar thing for an object kinematics. However, I can't obtain or see the kinematics information as in the AGV: acc1, acc2, peakSpeed, peakTime, time, etc.

Is there a way to obtain it if the kinematics needed is not from AGV?

Thank you.

FlexSim 23.1.2
kinematicstreenodekinematics with process flow
· 3
5 |100000

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

Jouky D avatar image Jouky D commented ·

On the previous question (AGV), the trigger is activated when a message with a parameter is received by the AGV when a kinematics is added (AGVNetwork > customizationDelegate > addKinematics > edit the code to send a message to the AGV). And when it activates, we use commands as:

double totalDistMove = getkinematics(kinematics, KINEMATIC_TOTALDIST, 1);

double startTimeMove = getkinematics(kinematics, KINEMATIC_STARTTIME, 1);

double endTimeMove = getkinematics(kinematics, KINEMATIC_ENDTIME, 1);

double peakSpeedMove = getkinematics(kinematics, KINEMATIC_PEAKSPEED, 1);

double peakTimeMove = getkinematics(kinematics, KINEMATIC_PEAKTIME, 1) + startTimeMove;

double acc = getkinematics(kinematics, KINEMATIC_ACC1, 1);

double dec = getkinematics(kinematics, KINEMATIC_ACC2, 1);

However, if we use the Create kinematics, Travel with kinematics and finish kinematics with a normal 3D Object, I cannot see where are all of these options on the treenode and how do I call them.

0 Likes 0 ·
Joerg Vogel avatar image Joerg Vogel Jouky D commented ·

@Jouky D, "kinematics" is a node reference. There you find the data!

0 Likes 0 ·
Jouky D avatar image Jouky D Joerg Vogel commented ·
I stopped the simulation when the Apply Kinematics is running, however, there are not information about it on the node Object. Do you have an example image to see it and how do you call it on flexscript?
0 Likes 0 ·

1 Answer

Felix Möhlmann avatar image
0 Likes"
Felix Möhlmann answered Jouky D commented

You can react to tokens entering the "Apply Kinematics" activity, since that is when the kinematic is added. (Place a "Breathe" after the source so the kinematics are added before you try to do anything else)

capture2.png

You specify where the kinematic data is stored in the activities (by default in a label "kinematics" on the token), so that is where you can read the information from using getkinematics().

capture1.png


capture1.png (10.1 KiB)
capture2.png (14.5 KiB)
· 5
5 |100000

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

Jouky D avatar image Jouky D commented ·

Thank you for your response! However, if I have to apply it onto 50 Apply Kinematics (because of different instances), it means a problem building that because I cannot put all the Apply kinematics into a new group and apply the trigger Source to that "Apply Kinematic's group".


Maybe FlexSim internally knows the same kinematics information as AGV's case but we cannot call it?

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Jouky D commented ·

You can do exactly that, though?

capture1.png

0 Likes 0 ·
capture1.png (38.1 KiB)
Jouky D avatar image Jouky D Felix Möhlmann commented ·
Yep, I didn't know that! Thank you Felix!
0 Likes 0 ·
Show more comments