Error Reading Kinematics ACC1Time

Error Reading Kinematics ACC1Time

jouky_d
Not applicable
37 Views
2 Replies
Message 1 of 3

Error Reading Kinematics ACC1Time

jouky_d
Not applicable

[ FlexSim 23.2.1 ]

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

0 Likes
Accepted solutions (1)
38 Views
2 Replies
Replies (2)
Message 2 of 3

moehlmann_fe
Participant
Participant
Accepted solution

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)

0 Likes
Message 3 of 3

jouky_d
Not applicable
Thank you @Felix Möhlmann ! It works :D
0 Likes