question

michel.torbey avatar image
0 Likes"
michel.torbey asked 立洲 commented

Kinematics and Model Speed

robotleverbrasv01.fsm

Hello,

I have made this model with kinematics of a robot.

When i run the model on a low constant speed, the robot follows the kinematics as it should.

But when i increase the speed (higher than 200 and lower than maximum speed) the robot doesn't follow the kinematics i have fixed.

Any Idea if it is a flexsim bug or anything i did wrong in my model?

You can find the model in attachement.

Thank you and best regards,

FlexSim 17.2.2
kinematics
· 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.

1 Answer

Phil BoBo avatar image
6 Likes"
Phil BoBo answered 立洲 commented

Here is a quick rundown of how you should structure your kinematics code:

Add a label to the object that stores whether it is currently animating using kinematics. We'll call this animLabel.

Add a label to the object for the kinematics. We'll call this kinNode.

OnReset:

  1. animLabel = 0;
  2. deactivatekinematics(kinNode);

Trigger where kinematics start:

  1. initkinematics(kinNode, current);
  2. addkinematic(kinNode, ...);
  3. addkinematic(kinNode, ...);
  4. double endtime = addkinematic(kinNode, ...);
  5. updatekinematics(kinNode, current);
  6. senddelayedmessage(current, endtime - Model.time, current);
  7. animLabel = 1;

OnMessage:

  1. animLabel = 0;
  2. updatekinematics(kinNode, current);

OnDraw:

  1. if (animLabel)
  2. updatekinematics(kinNode, current);

The OnMessage should call updatekinematics() one last time at the end of the kinematic so that the object goes to its final position regardless of when the last time OnDraw was called (or if it ever was).

· 16
5 |100000

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