question

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

Error Reading Kinematics ACC1Time

Hello everyone,

I am trying to read Acc1Time, PeakTime and Acc2Time.

I use a create tokens after the Create Kinematics and I put a Breahte to charge the kinematics into the token. Inside the destination of the Create Kinematics I want to read some parameters about the kinematics.
1709893205554.pngI saved the value of the token parent (tokenKin) where the kinematics are, and then I use:
getkinematics(token.tokenKin.labels["kinematics"], KINEMATIC_ACC1)
getkinematics(token.tokenKin.labels["kinematics"], KINEMATIC_PEAKTIME)
getkinematics(token.tokenKin.labels["kinematics"], KINEMATIC_ACC2TIME)

Inside the tokenKin, the kinematics are the following:

Kinematic data - Last Updated Location: [13238.11,18282.78,5973.72] Rotation: [0.00, 0.00, 0.00]

Start Time: 74.33 End Time: 83.28 Last Update Time: 74.83

Initial Location: [13238.11,18157.78,5973.72] Initial Rotation: [0.00, 0.00, 0.00]


1 Kinematics Added

Travel [0.00, 11413.71, 0.00] totaldist: 11413.71 starttime: 74.33 endtime: 83.28 startspeed: 0.00 endspeed: 0.00l acc1: 1000.00 acc2: -1250.00 peakspeed: 1500.00 acc1time: 1.50 peaktime: 6.26 acc2time: 1.20


However, all the three getkinematics returns 0 and not the correct value.

I thought it could be an error of reading the wrong token, but it's not because when I put the following code, it returns correctly the endTime:

getkinematics(token.tokenKin.labels["kinematics"], KINEMATIC_ENDTIME)

Any suggestions?
Thank you for your time:D

PD: I cannot attach the model, sorry...

FlexSim 23.2.1
tokenkinematicskinematics with process flow
1709893205554.png (32.2 KiB)
5 |100000

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

1 Answer

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

Those three parameters require you to pass in the index of the kinematic for which you want to retrieve them, since the node might contain data for multiple sequential or even overlapping kinematics.

See the table in the getkinematics documentation. If you do not pass in the kinematic index, the return value will be what is described in the "All Kinematics" column. Otherwise the command returns what is described in "Single Kinematic". As you can see in the documentation, some queries are only valid for one or the other.

So in short, assuming that you only added a single kinematic, you need to use:

getkinematics(token.tokenKin.labels["kinematics"], KINEMATIC_ACC1, 1)
getkinematics(token.tokenKin.labels["kinematics"], KINEMATIC_PEAKTIME, 1)
getkinematics(token.tokenKin.labels["kinematics"], KINEMATIC_ACC2TIME, 1)

· 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.

Jouky D avatar image Jouky D commented ·
Thank you @Felix Möhlmann ! It works :D
0 Likes 0 ·