question

K_yun avatar image
0 Likes"
K_yun asked K_yun edited

Create kinematic for flowitem while loading or unloading

load item smoothly.fsm

1644823212631.png

snipaste-2022-02-14-15-21-30.png

Target: Create kinematic for flowitem while loading/unloading.

Problem: I have created kinematic for flowitem by coding in "On Begin Offset" and "On Update Offset", but it won't move in visual. Can't figure out the error.

And by the way, how to implement this by PF?

FlexSim 21.1.2
kinematicskinematics with process flow
· 2
5 |100000

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

Joerg Vogel avatar image Joerg Vogel commented ·

Have you set an update in a drawtrigger? And do you call on kinematic finish time a final update? Typically you get an event for final update by a delayed message.

0 Likes 0 ·
K_yun avatar image K_yun Joerg Vogel commented ·
You mean a beginoffset trigger and a updateoffset trigger are not enough, additionally, a drawtrigger and a onmessagetrigger are also needed?
0 Likes 0 ·

1 Answer

Jason Lightfoot avatar image
0 Likes"
Jason Lightfoot answered K_yun edited

You have a spelling mistake in the update offset trigger's label name.

You should add an onPreDraw trigger and leave it empty to get the offset update to fire.

Also you'll need to move the item from the conveyor in order to have the update offset code free from competing conveyor drawing logic. This snippet moves the item into the model and then restores its position so it appears to start moving from it's original location:

Vec3 absloc=item.location.project(item.up,model());
moveobject(item,model());
item.location=absloc;

You'll need to add the TE as a member instance of the process flow if you want to use that technique instead.

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

K_yun avatar image K_yun commented ·

Thanks for your reply. It works well and I have modified my model. As shown in the new model i just upload, something wrong with the location when the te load the item from conveyor after execute kinematic, though i did set the location in te's "OnLoad" trigger.snipaste-2022-02-15-14-59-21.pngsnipaste-2022-02-15-15-00-15.pngload item smoothly.fsm

0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann K_yun commented ·

Seems like a bug with the "Finish Kinematics" activity not working properly. If I use "deactivatekinematics()" in a custom code activity it works as expected.

load-item-smoothly(2).fsm

0 Likes 0 ·
K_yun avatar image K_yun Felix Möhlmann commented ·

Yeah, this can work. And the parameter passed in the deactivatekinematics function must be "token.labels["kinematics"]", rather than "token.kinematics".

0 Likes 0 ·