question

ChongCS avatar image
0 Likes"
ChongCS asked Felix Möhlmann answered

The distance between two locations in A*Star Navigator

Hi,

I am using A*Star Navigator for navigation of task executer through an area, with some pre-defined locations (with exact x and y coordinates) to travel to. There are barriers, dividers along the way.

I need to know the exact distance between any two locations. I have tried the following methods to get the distance between two locations:

1. computation, based on 'Distance Formula for Two Points'

2. using flexscript command 'distancetotravel'

But both methods do not give the correct distance as compared to the the A*Star Navigator actual travel distance.

How do I get the correct distance by script (without running simulation) for A*Star Navigator?


Thanks

Chong




FlexSim 24.0.2
task executerlocationdistance
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

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

Can you attach an example model. "distancetotravel()" returns the correct distance in my test.

For travel to coordinates you can use the "getCost()" method of the navigator class.

travel-distance.fsm


travel-distance.fsm (37.9 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.