question

Emily K avatar image
0 Likes"
Emily K asked Felix Möhlmann commented

Get moving direction of AGV

Hi @Felix Möhlmann,

I would like to identify the moving direction of AGVs when they enter the broad phase.

If they are moving in the same direction, turns green and do nothing.

If they are moving in different direction, turns to red, and compare their distancetotravel() to decide they priority

I reference to your post, I guess this could help to achieve what I want to do. As I don't have a strong coding fundamental, I am not sure if I am writing in a correct way, hopefully to get some advices from you.

Thanks!

1667377971221.png

AgentSystemTrial_221102.fsm

FlexSim 21.2.4
proximity agent systemagent systemagv travel direction
· 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.

Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered Felix Möhlmann commented

If both task executers are travelling on the same path when the proximity triggers (which seems to be the case with the way you intend to use this), then you should be able to use the "fromDist" and "toDist" values from the current travelPath node.

1667413494861.pngIf you calculate the difference of those values, the sign (+/-) of the result will correspond to the travel direction.

You should be able to reuse most of the code from the post you linked to. Note though that that code uses "current" to refer to the task executer. Looking at your model, you are using "obj" instead, so you have to adjust the code accordingly. You also don't get a reference to the navigator node ("avgNavNode") at all and instead use "agent.object" a lot. That is just a pointer to the task executer object and not the node you need.

1667413982643.png


1667413494861.png (44.8 KiB)
1667413982643.png (9.6 KiB)
· 8
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
0 Likes"
Joerg Vogel answered
I would use a vantage point far outside my layout and compute distances of all AGVs from their current location and a location a few time units before from their kinematic node to get a heading to or from this vantage point. Then I can identify if two AGVs are going to collide or not.
5 |100000

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