Environment

class Environment
safety_margin: float

Additional global safety margin used for collision checking.

__init__(robot: Robot, safety_margin=0.0)

Constructs a new environment with the given robot, and a global safety margin for collision checking.

get_robot(name: str = '') Robot

Get the robot with the given name from the environment. In case there is only a single robot in the environment, the default empty name argument will return this robot. Otherwise throws an error if no robot with the name exists.

get_waypoint(name: str) Point

Get the waypoint with the given name from the environment. Returns either a Waypoint, a CartesianWaypoint, a Region, or a CartesianRegion. Throws an error if no waypoint with the name exists.

get_waypoint_by_tag(tag: str) Point

Get a waypoint within the environment given a tag. If multiple waypoints have the same tag, the first one to be found is returned. Tags are case-insensitive.

get_obstacle(name: str) Obstacle

Get the obstacle with the given name from the environment. Throws an error if no obstacle with the name exists.

get_obstacles_by_tag(tag: str) list[Obstacle]

Get all obstacles within the environment that carry the given tag. Tags are case-insensitive.

add_obstacle(obstacle: Obstacle) Obstacle

Adds an obstacle to the environment. Returns a pointer to the added obstacle for future changes.

add_obstacle(object: Object, origin=Frame.Identity()) Obstacle

Adds a collision object to the environment at the given origin frame. Returns a pointer to the added obstacle for future changes.

add_obstacle(name: str, object: Object, origin=Frame.Identity(), color='000000') Obstacle

Adds a collision object to the environment at the given origin frame. Returns a pointer to the added obstacle for future changes.

remove_obstacle(obstacle: Obstacle)

Removes the given obstacles from the environment and from all collision checking.

update_fixed_obstacles()

Updates all fixed obstacles for the internal collision checking. This should be called after changing e.g. the position or size of an obstacle.

update_height_field(obstacle: Obstacle)

Updates the heights matrix of a given height field obstacle for the internal collision checking.

update_joint_position(robot: Robot, joint_position: Config)

Updates the joint position of the given robot for the internal collision checking.

check_collision(joint_position: Config) bool

Returns whether the given joint position is in collision with the environment (considering the security margin).

check_collision(robot: Robot, joint_position: Config) bool

Returns whether the given joint position for the specific robot is in collision with the environment (considering the security margin).

get_collision_free_joint_position_nearby(joint_position: Config, robot: Robot = None) Config | None

Calculate a collision free joint position close to the reference position.