AnyLogic
Expand
Font size

Pedestrian API

Pedestrian supports functions that are sufficient for the Pedestrian Library blocks to handle and animate it. You can extend that functionality by creating a custom pedestrian type and defining any functions, parameters, and statecharts defining the pedestrian behavior on the diagram of the pedestrian type. You will be able to simply access these fields by specifying your pedestrian type in the Pedestrian type property of Pedestrian Library blocks.

Functions

Every pedestrian provides the following API for working with it programmatically at the model runtime.

General information
Function Description
int getId() Returns the unique identifier for the pedestrian. Returns -1 if pedestrian hasn’t yet been added to the pedestrian model environment.
PedGroup getGroup() Returns the group this pedestrian belongs to, or null if this pedestrian isn’t a part of a group.
Coordinates
Function Description
double getX() Returns the x-coordinate (in meters) of this pedestrian in the model.
double getY() Returns the y-coordinate (in meters) of this pedestrian in the model.
double getZ() Returns the z-coordinate (in meters) of this pedestrian in the model.
double getTargetX() Returns the x-coordinate (in meters) of the target of this pedestrian.
double getTargetY() Returns the y-coordinate (in meters) of the target of this pedestrian.
double getTargetZ() Returns the z-coordinate (in meters) of the target of this pedestrian.
Speed
Function Description
double getSpeed() Returns the current speed of this pedestrian in meters per second.
double getComfortableSpeed() Returns the comfortable speed for the movement of this pedestrian.
void setComfortableSpeed(double comfortableSpeed) Sets the new comfortable speed for the movement of this pedestrian.

comfortableSpeed — the new value of the pedestrian’s comfortable speed in meters per second
Size
Function Description
double getDiameter() Returns diameter of the pedestrian, in meters.
double getRadius() Returns radius of the pedestrian, in meters.
void setDiameter(double diameter) Sets new diameter of the pedestrian, in meters.

diameter — new diameter value
void setRadius(double radius) Sets new radius of the pedestrian, in meters.

diameter — new radius value
Location
Function Description
Level getLevel() Returns current level where the pedestrian is located.
How can we improve this article?