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 getSpeed(SpeedUnits units) Returns the current speed of this pedestrian, in specified speed units.

units — a constant defining the speed units
double getComfortableSpeed() Returns the comfortable speed for the movement of this pedestrian, in meters per second.
double getComfortableSpeed(SpeedUnits units) Returns the comfortable speed for the movement of this pedestrian, in specified speed units.

units — a constant defining the speed units
void setComfortableSpeed(double comfortableSpeed) Sets the new comfortable speed for the movement of this pedestrian, in meters per second.

comfortableSpeed — the new value of the pedestrian’s comfortable speed in meters per second
void setComfortableSpeed(double comfortableSpeed, SpeedUnits units) Sets the new comfortable speed for the movement of this pedestrian, in specified speed units.

comfortableSpeed — the new value of the pedestrian’s comfortable speed
units — a constant defining the speed units
Size
Function Description
double getDiameter() Returns diameter of the pedestrian, in meters.
double getDiameter(LengthUnits units) Returns diameter of the pedestrian, in specified length units.

units — a constant defining the length units
double getRadius() Returns radius of the pedestrian, in meters.
double getRadius(LengthUnits units) Returns radius of the pedestrian, in specified length units.

units — a constant defining the length units
void setDiameter(double diameter) Sets new diameter of the pedestrian, in meters.

diameter — new diameter value
void setDiameter(double diameter, LengthUnits units) Sets new diameter of the pedestrian, in specified length units.

diameter — new diameter value
units — a constant defining the length units
void setRadius(double radius) Sets new radius of the pedestrian, in meters.

radius — new radius value
void setRadius(double radius, LengthUnits units) Sets new radius of the pedestrian, in specified length units.

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