PedGoTo


Causes pedestrians to go to the specified location.

Location can be defined by a target line, area or a point with given coordinates. The pedestrian has to reach a given a given point, or any point of the specified line, or area. Pedestrians find path to the specified destination within current ground. 

There are two path choice modes: Reach target and Follow route. In Reach target mode the path is automatically calculated by the library. Use this mode when you do not want draw a route by yourself. However, if your environment either has numerous walls and borders, or if they make up a maze, it will take plenty of time for the algorithm to calculate the shortest path. In these cases we recommend to define paths manually using the Follow route path choice mode.

Demo model: PedGoTo

Parameters

Mode
Here you can choose the movement mode (Reach target, or Follow route). 
In the first case you specify the destination with a target line, or area, or by specifying the coordinates of the target point.
In the second case pedestrians will follow along the specified pathway up to its end.
Get value: mode Change value: set_mode(new value)
Valid values: MODE_REACH_TARGET - Reach target
                     MODE_FOLLOW_ROUTE -  Follow route
Target
Here you can choose whether the movement destination is defined by line, area, or point (x,y).
Name: locationType   Change value: set_locationType(new value)
Valid values: 
       LOCATION_LINE 
    LOCATION_POINT

   
LOCATION_AREA  
Target line [dynamic]
[ Visible if Target is line ] Target line that defines the movement destination for the pedestrians.
Value type: TargetLine
Local variable: ped - the pedestrian
Area [dynamic]
[ Visible if Target is area ] Area that defines the movement destination for the pedestrians.
Value type: AreaNode
Local variable: ped - the pedestrian
X, Y [dynamic]
[ Visible if Target is point (x,y) ] X (Y) coordinate of the target point. 
Value type: double
Local variable: ped - the pedestrian
Route [dynamic]
[Visible if Mode is Follow route] Pathway that pedestrians should follow. 
Value type: Pathway
Local variable: ped - the pedestrian
Walk in reverse direction [dynamic]
If this option is selected (or value is equal to true), pedestrians pass through this service in reverse direction (and the reverse queues are used in this case). 
Value type: boolean
Local variable: ped - the pedestrian
Advanced
Reach tolerance, m.
Defines range (in meters), at which pedestrian should enclose to its destination for command to complete. In cases of target line distance to any point of this line is assumed.
Syntax: double reachTolerance
Default value: 0.25
Actions
On enter [code]
Code executed when a pedestrian enters the object.
Local variable: ped - the pedestrian
On exit [code]
Code executed when a pedestrian exits the object via out port (in the normal way).
Local variable: ped - the pedestrian
On cancel [code]
Called when a pedestrian exits the block via ccl port.
Local variable: ped - the pedestrian
On remove [code]
Code executed when a pedestrian is intentionally removed from this block by calling the pedestrian's function remove(). This code is automatically executed after the remove() function call.
Local variable:
ped - the pedestrian

Functions

long countPeds() - Returns total number of pedestrians passed through this block.

int size() - Returns number of pedestrians inside the block.

void cancel(Agent ped) - Causes the specified pedestrian to leave the block immediately via ccl port.

void cancelAll() - Causes all pedestrians to leave the block immediately via ccl port. 

boolean contains(Agent ped) - Returns true if the specified pedestrian is currently inside the block, and false otherwise.

Set<T> getPeds() - Returns a non-modifiable collection of pedestrians currently located in this block.

Ports

in
The input port.
out
The output port for pedestrians leaving the object "normally" after the successful completion of the command.
ccl
The output port for pedestrians leaving the object because of "cancel" event (caused by a call of either cancel or cancelAll function).