question

Meng,Li avatar image
0 Likes"
Meng,Li asked Meng,Li action

How to identify the front traveller during a collision on network node path?

Hi ! As you can see in model 001001.fsm, when i set up collision logic for every TE, error happens.The problem is that when the Task Executors come into contact with each other, both of their "Handle Collision" triggers are fired, causing them both to stop. This is not reasonable.

Logically, when a collision happens, the front traveller should do nothing, while the travellers behind it should execute collision logic. So, we should firgue out the front traveller in a collision.

Under most circumstance, routes are more complicated. It is unknown that which traveller may come into a collision with current traveller. This means the front traveller is always dynamical to one traveller.

So , How to identify the front traveller during a collision happens between two or more travellers on network node path?

FlexSim 19.1.0
collision problem
001.fsm (34.1 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

·
Joseph Gillespie avatar image
0 Likes"
Joseph Gillespie answered Joerg Vogel edited
@meng L

You can determine which Task Executor is in front by checking the positions and rotations of each TE involved in the collision. Here is some custom code I added to the "Handle Collision" function of each TE in your model:

/**Custom Code*/
Object current = ownerobject(c);
Object otherobject = param(1);
treenode thissphere = param(2);
treenode othersphere = param(3);
Object thisobject = current;


int thisrotation = thisobject.attrs.spatialrz.value;
int thisxloc = thisobject.attrs.spatialx.value;
int otherxloc = otherobject.attrs.spatialx.value;
int thisyloc = thisobject.attrs.spatialy.value;
int otheryloc = otherobject.attrs.spatialy.value;


if(thisrotation > -90 && thisrotation < 90){ //Travelling right
	//Stop if left of other AGV
	if(thisxloc < otherxloc){
		thisobject.stop(48);
		senddelayedmessage(thisobject,0.5,thisobject);
	}
} else if (thisrotation > 90 || thisrotation < -90){ //Travelling left
	//Stop if right of other AGV
	if(thisxloc > otherxloc){
		thisobject.stop(48);
		senddelayedmessage(thisobject,0.5,thisobject);
	}
} else if (thisrotation > 0 && thisrotation < 180){ //Travelling up
	//Stop if below other AGV
	if(thisyloc < otheryloc){
		thisobject.stop(48);
		senddelayedmessage(thisobject,0.5,thisobject);
	}
} else { //Travelling down
	//Stop if above other AGV
	if(thisyloc > otheryloc){
		thisobject.stop(48);
		senddelayedmessage(thisobject,0.5,thisobject);
	}
}

This uses the rotation of the current TE to determine in which direction it is moving. Then, by checking its position and the position of the other TE in the collision, it can determine whether it is behind the other TE. If it is behind the other TE, it will stop.

Here is your model with this code added in: 001answer.fsm

Try changing the speeds of the two TEs so that TaskExecuter1 is faster than TaskExecuter2, and you will see that it works no matter which TE is behind.

When applying this to your model, there may still be problems when the TEs go around corners or sharp turns, but I would just adjust the shape of the collision sphere so that they detect other TEs in front of them and not to the sides.


001answer.fsm (33.4 KiB)
· 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.

Meng,Li avatar image Meng,Li commented ·

Thanks a lot Joseph ! I've tried as you suggested here. It is a bit complicated to avoiding collisions , and i will try some other methods to accomplish this.

0 Likes 0 ·
Joseph Gillespie avatar image Joseph Gillespie Meng,Li commented ·

@meng L

As a suggestion if other methods aren't working for you, you could always switch to using Control Points instead of collision spheres to ensure that AGVs don't collide with each other. That is what AGVs are built around and it would be pretty easy to do.

0 Likes 0 ·
Meng,Li avatar image Meng,Li Joseph Gillespie commented ·

@Joseph Gillespie ♦

I have tried using Control Points and Accumulation Path to avoid collision, but it turned out undesirably.Thank you for having a look at the question in the link below.

https://answers.flexsim.com/questions/74510/agv-system-get-stucked-without-any-error-shows-up.html

0 Likes 0 ·

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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