API

Common

exception mpscenes.common.ComponentIncompleteError[source]
exception mpscenes.common.DimensionNotSuitableForEnv[source]
exception mpscenes.common.MissmatchDimensionError[source]
exception mpscenes.common.TrajectoryComponentMissingError[source]
exception mpscenes.common.TrajectoryNotSupported[source]
class mpscenes.common.AnalyticTrajectory(n: int, **kwargs)[source]
concretize()[source]
evaluate(time_step: float) list[source]
shuffle()[source]
class mpscenes.common.MPComponent(**kwargs)[source]
check_completeness()[source]
dict()[source]
evaluate_components(mask: list, t: float)[source]
name()[source]
class mpscenes.common.ReferenceTrajectory(n: int, **kwargs)[source]
abstract concretize()[source]
abstract evaluate(time_step: float)[source]
n()[source]
trajectory_dictionary() dict[source]
class mpscenes.common.SplineTrajectory(n: int, **kwargs)[source]
concretize()[source]
evaluate(time_step: float) list[source]
getScaledDerivatives(time_step: float) list[source]
initialize_spline()[source]
shuffle()[source]
timeReparameterize(time_step: float) float[source]

Obstacles

class mpscenes.obstacles.BoxGeometryConfig(position: ~typing.List[float] = <factory>, orientation: ~typing.List[float] = <factory>, length: float = 1.0, width: float = 1.0, height: float = 1.0)[source]

Configuration dataclass for geometry.

This configuration class holds information about position and size of the box obstacle.

Attributes:

length: float

Length of the box

width: float

Width of the box

height: float

Height of the box

height: float = 1.0
length: float = 1.0
width: float = 1.0
class mpscenes.obstacles.BoxObstacle(**kwargs)[source]
distance(position: ndarray, **kwargs) float[source]

Get distance between point and the box obstacleself.

The point is transformed into the main axes of the obstacle. Then, the halfplanes are used to compute the distance.

height() float[source]

Get the height of the obstacle.

length() float[source]

Get the length of the obstacle.

limit_high()[source]
limit_low()[source]
shuffle() None[source]

Randomize the obstacle by shuffling the position, length, width and height.

size() List[float][source]

Get size of box obstacle, length, width, height.

width() float[source]

Get the width of the obstacle.

class mpscenes.obstacles.BoxObstacleConfig(type: str, geometry: ~mpscenes.obstacles.box_obstacle.BoxGeometryConfig, movable: bool = False, low: ~mpscenes.obstacles.box_obstacle.BoxGeometryConfig | None = None, high: ~mpscenes.obstacles.box_obstacle.BoxGeometryConfig | None = None, rgba: ~typing.List[float] = <factory>)[source]

Configuration dataclass for box obstacle.

This configuration class holds information about the position, size and randomization of a rectengular obstacle.

Attributes:

geometry : BoxGeometryConfig : Geometry of the box low : BoxGeometryConfig : Lower limit for randomization high : BoxGeometryConfig : Upper limit for randomization

geometry: BoxGeometryConfig
high: BoxGeometryConfig | None = None
low: BoxGeometryConfig | None = None
class mpscenes.obstacles.CollisionObstacle(**kwargs)[source]

Represents a collision obstacle.

Base class for collision obstacles.

_config

Configuration of collision obstacle

Type:

CollisionObstacleConfig

acceleration(**kwargs) ndarray[source]

Get the linear acceleration of the obstacle. It returns zero, unless it is a moving obstacle. Does not capture the acceleration of movable obstacles. That must be handled by the corresponding physics engine.

dimension() int[source]

Get the dimension of the obstacle.

abstract distance(position: ndarray) float[source]

Abstract method to calculate the distance of a point to the obstacle.

evaluate(**kwargs) List[ndarray][source]

Evaluate the obstacle’s position, velocity, and acceleration.

geometry() GeometryConfig[source]

Get the geometry configuration of the collision obstacle.

movable() bool[source]

Check if the obstacle is movable, True if obstacle can be interacted with.

orientation(**kwarg) ndarray[source]

Get the orientation of the obstacle as quaternion with convention wxyz.

position(**kwargs) ndarray[source]

Get the position of the obstacle, xyz.

position_into_obstacle_frame(positions: ndarray, **kwargs) ndarray[source]

Transform positions into the obstacle’s frame. That is needed to compute the distance between points and the obstacle.

rgba() ndarray[source]

Get the color (RGBA) configuration of the obstacle.

abstract size() ndarray[source]

Abstract method to retrieve the size of the obstacle.

type() str[source]

Get the type of the collision obstacle.

velocity(**kwargs) ndarray[source]

Get the linear velocity of the obstacle. It returns zero, unless it is a moving obstacle. Does not capture the velocity of movable obstacles. That must be handled by the corresponding physics engine.

class mpscenes.obstacles.CollisionObstacleConfig(type: str, geometry: ~mpscenes.obstacles.collision_obstacle.GeometryConfig, movable: bool = False, low: ~mpscenes.obstacles.collision_obstacle.GeometryConfig | None = None, high: ~mpscenes.obstacles.collision_obstacle.GeometryConfig | None = None, rgba: ~typing.List[float] = <factory>)[source]

Configuration dataclass for collision obstacle.

This configuration class holds information about the dimension and the type of collision obstacle.

Parameters:

typestr

Type of the obstacle

geometryGeometryConfig

Geometry of the obstacle

movablebool

Flag indicating whether an obstacle can be pushed around

lowGeometryConfig

Lower limit for randomization

highGeometryConfig

Upper limit for randomization

rgba: List[float]

Color in rgba encoding

geometry: GeometryConfig
high: GeometryConfig | None = None
low: GeometryConfig | None = None
movable: bool = False
rgba: List[float]
type: str
class mpscenes.obstacles.CylinderGeometryConfig(position: ~typing.List[float] = <factory>, orientation: ~typing.List[float] = <factory>, radius: float = 1.0, height: float = 1.0)[source]

Configuration dataclass for geometry.

This configuration class holds information about position and size of the cylinder obstacle.

Parameters:

radius: float: Radius of the cylinder height: float: Height of the cylinder

height: float = 1.0
radius: float = 1.0
class mpscenes.obstacles.CylinderObstacle(**kwargs)[source]
acceleration(**kwargs) ndarray[source]

Get the linear acceleration of the obstacle. It returns zero, unless it is a moving obstacle. Does not capture the acceleration of movable obstacles. That must be handled by the corresponding physics engine.

csv(file_name, samples=100)[source]
dimension()[source]

Get the dimension of the obstacle.

distance(position: ndarray, **kwargs) float[source]

Abstract method to calculate the distance of a point to the obstacle.

height()[source]
limit_high()[source]
limit_low()[source]
movable()[source]

Check if the obstacle is movable, True if obstacle can be interacted with.

position(**kwargs) ndarray[source]

Get the position of the obstacle, xyz.

radius()[source]
shuffle()[source]
size()[source]

Abstract method to retrieve the size of the obstacle.

velocity(**kwargs) ndarray[source]

Get the linear velocity of the obstacle. It returns zero, unless it is a moving obstacle. Does not capture the velocity of movable obstacles. That must be handled by the corresponding physics engine.

class mpscenes.obstacles.CylinderObstacleConfig(type: str, geometry: ~mpscenes.obstacles.cylinder_obstacle.CylinderGeometryConfig, movable: bool = False, low: ~mpscenes.obstacles.cylinder_obstacle.CylinderGeometryConfig | None = None, high: ~mpscenes.obstacles.cylinder_obstacle.CylinderGeometryConfig | None = None, rgba: ~typing.List[float] = <factory>)[source]

Configuration dataclass for box obstacle.

This configuration class holds information about the position, size and randomization of a cylinder obstacle.

Parameters:

geometry : CylinderGeometryConfig : Geometry of the box low : CylinderGeometryConfig : Lower limit for randomization high : CylinderGeometryConfig : Upper limit for randomization

geometry: CylinderGeometryConfig
high: CylinderGeometryConfig | None = None
low: CylinderGeometryConfig | None = None
class mpscenes.obstacles.DynamicBoxGeometryConfig(trajectory: Any, position: List[float] = <factory>, orientation: List[float] = <factory>, length: float = 1.0, width: float = 1.0, height: float = 1.0)[source]
orientation: List[float]
position: List[float]
class mpscenes.obstacles.DynamicBoxObstacle(**kwargs)[source]
class mpscenes.obstacles.DynamicBoxObstacleConfig(type: str, geometry: ~mpscenes.obstacles.dynamic_box_obstacle.DynamicBoxGeometryConfig, movable: bool = False, low: ~mpscenes.obstacles.dynamic_box_obstacle.DynamicBoxGeometryConfig | None = None, high: ~mpscenes.obstacles.dynamic_box_obstacle.DynamicBoxGeometryConfig | None = None, rgba: ~typing.List[float] = <factory>)[source]

Configuration dataclass for sphere obstacle.

This configuration class holds information about the position, size and randomization of a dynamic spherical obstacle.

Parameters:

geometry : DynamicBoxGeometryConfig : Geometry of the obstacle low: DynamicBoxGeometryConfig : Lower limit for randomization high: DynamicBoxGeometryConfig : Upper limit for randomization

geometry: DynamicBoxGeometryConfig
high: DynamicBoxGeometryConfig | None = None
low: DynamicBoxGeometryConfig | None = None
class mpscenes.obstacles.DynamicCylinderGeometryConfig(trajectory: Any, position: List[float] = <factory>, orientation: List[float] = <factory>, radius: float = 1.0, height: float = 1.0)[source]
orientation: List[float]
position: List[float]
class mpscenes.obstacles.DynamicCylinderObstacle(**kwargs)[source]
class mpscenes.obstacles.DynamicCylinderObstacleConfig(type: str, geometry: ~mpscenes.obstacles.dynamic_cylinder_obstacle.DynamicCylinderGeometryConfig, movable: bool = False, low: ~mpscenes.obstacles.dynamic_cylinder_obstacle.DynamicCylinderGeometryConfig | None = None, high: ~mpscenes.obstacles.dynamic_cylinder_obstacle.DynamicCylinderGeometryConfig | None = None, rgba: ~typing.List[float] = <factory>)[source]

Configuration dataclass for sphere obstacle.

This configuration class holds information about the position, size and randomization of a dynamic spherical obstacle.

Parameters:

geometry : DynamicCylinderGeometryConfig : Geometry of the obstacle low: DynamicCylinderGeometryConfig : Lower limit for randomization high: DynamicCylinderGeometryConfig : Upper limit for randomization

geometry: DynamicCylinderGeometryConfig
high: DynamicCylinderGeometryConfig | None = None
low: DynamicCylinderGeometryConfig | None = None
class mpscenes.obstacles.DynamicGeometryConfig(trajectory: Any)[source]

Configuration dataclass for geometry.

This configuration class holds information about position and radius of a dynamic sphere obstacle.

Parameters:

trajectory: Any

trajectory description of the obstacle. Can be either a spline or a analytic trajectory.

radius: float

radius of the obstacle

trajectory: Any
class mpscenes.obstacles.DynamicObstacle(**kwargs)[source]
acceleration(**kwargs)[source]

Get the linear acceleration of the obstacle. It returns zero, unless it is a moving obstacle. Does not capture the acceleration of movable obstacles. That must be handled by the corresponding physics engine.

check_dimensionality()[source]
dimension() int[source]

Get the dimension of the obstacle.

position(**kwargs)[source]

Get the position of the obstacle, xyz.

traj()[source]
trajectory_type() str[source]
velocity(**kwargs)[source]

Get the linear velocity of the obstacle. It returns zero, unless it is a moving obstacle. Does not capture the velocity of movable obstacles. That must be handled by the corresponding physics engine.

class mpscenes.obstacles.DynamicSphereGeometryConfig(trajectory: Any, position: List[float] = <factory>, orientation: List[float] = <factory>, radius: float = 1.0)[source]
class mpscenes.obstacles.DynamicSphereObstacle(**kwargs)[source]
class mpscenes.obstacles.DynamicSphereObstacleConfig(type: str, geometry: ~mpscenes.obstacles.dynamic_sphere_obstacle.DynamicSphereGeometryConfig, movable: bool = False, low: ~mpscenes.obstacles.dynamic_sphere_obstacle.DynamicSphereGeometryConfig | None = None, high: ~mpscenes.obstacles.dynamic_sphere_obstacle.DynamicSphereGeometryConfig | None = None, rgba: ~typing.List[float] = <factory>)[source]

Configuration dataclass for sphere obstacle.

This configuration class holds information about the position, size and randomization of a dynamic spherical obstacle.

Parameters:

geometry : DynamicSphereGeometryConfig : Geometry of the obstacle low: DynamicSphereGeometryConfig : Lower limit for randomization high: DynamicSphereGeometryConfig : Upper limit for randomization

geometry: DynamicSphereGeometryConfig
high: DynamicSphereGeometryConfig | None = None
low: DynamicSphereGeometryConfig | None = None
class mpscenes.obstacles.DynamicUrdfGeometryConfig(trajectory: Any, position: List[float] = <factory>, orientation: List[float] = <factory>)[source]
orientation: List[float]
position: List[float]
class mpscenes.obstacles.DynamicUrdfObstacle(**kwargs)[source]
class mpscenes.obstacles.DynamicUrdfObstacleConfig(urdf: str, type: str, geometry: DynamicUrdfGeometryConfig, scaling: float = 1, movable: bool = False, low: DynamicUrdfGeometryConfig | None = None, high: DynamicUrdfGeometryConfig | None = None)[source]

Configuration dataclass for sphere obstacle.

This configuration class holds information about the position, size and randomization of a dynamic spherical obstacle.

Parameters:

geometry : DynamicUrdfGeometryConfig : Geometry of the obstacle low: DynamicUrdfGeometryConfig : Lower limit for randomization high: DynamicUrdfGeometryConfig : Upper limit for randomization

geometry: DynamicUrdfGeometryConfig
high: DynamicUrdfGeometryConfig | None = None
low: DynamicUrdfGeometryConfig | None = None
class mpscenes.obstacles.GeometryConfig(position: ~typing.List[float] = <factory>, orientation: ~typing.List[float] = <factory>)[source]

Configuration dataclass for geometry.

This configuration class holds information about position and orientation of an obstacle. This class is further specified for the other obstacles.

Attributes:

position: List[float], default=[0.0, 0.0, 0.0]

Position of the obstacle

orientation: List[float], default=[1.0, 0.0, 0.0, 0.0]

Orientation of the obstacle as quaternion wxyz

orientation: List[float]
position: List[float]
class mpscenes.obstacles.SphereGeometryConfig(position: ~typing.List[float] = <factory>, orientation: ~typing.List[float] = <factory>, radius: float = 1.0)[source]

Configuration dataclass for geometry.

This configuration class holds information about position and radius of a sphere obstacle.

Parameters:

radius: float: Radius of the obstacle

radius: float = 1.0
class mpscenes.obstacles.SphereObstacle(**kwargs)[source]
csv(file_name, samples=100)[source]
distance(position: ndarray, **kwargs) float[source]

Abstract method to calculate the distance of a point to the obstacle.

limit_high()[source]
limit_low()[source]
radius()[source]
shuffle()[source]
size()[source]

Abstract method to retrieve the size of the obstacle.

class mpscenes.obstacles.SphereObstacleConfig(type: str, geometry: ~mpscenes.obstacles.sphere_obstacle.SphereGeometryConfig, movable: bool = False, low: ~mpscenes.obstacles.sphere_obstacle.SphereGeometryConfig | None = None, high: ~mpscenes.obstacles.sphere_obstacle.SphereGeometryConfig | None = None, rgba: ~typing.List[float] = <factory>)[source]

Configuration dataclass for sphere obstacle.

This configuration class holds information about the position, size and randomization of a spherical obstacle.

Parameters:

geometry : GeometryConfig : Geometry of the obstacle low : GeometryConfig : Lower limit for randomization high : GeometryConfig : Upper limit for randomization

geometry: SphereGeometryConfig
high: SphereGeometryConfig | None = None
low: SphereGeometryConfig | None = None
class mpscenes.obstacles.UrdfGeometryConfig(position: List[float] = <factory>, orientation: List[float] = <factory>)[source]
orientation: List[float]
position: List[float]
class mpscenes.obstacles.UrdfObstacle(**kwargs)[source]
acceleration()[source]

Get the linear acceleration of the obstacle. It returns zero, unless it is a moving obstacle. Does not capture the acceleration of movable obstacles. That must be handled by the corresponding physics engine.

dimension()[source]

Get the dimension of the obstacle.

distance(position: ndarray) None[source]

Abstract method to calculate the distance of a point to the obstacle.

position()[source]

Get the position of the obstacle, xyz.

size()[source]

Abstract method to retrieve the size of the obstacle.

urdf()[source]
velocity()[source]

Get the linear velocity of the obstacle. It returns zero, unless it is a moving obstacle. Does not capture the velocity of movable obstacles. That must be handled by the corresponding physics engine.

class mpscenes.obstacles.UrdfObstacleConfig(urdf: str, type: str, geometry: UrdfGeometryConfig, scaling: float = 1, movable: bool = False, low: UrdfGeometryConfig | None = None, high: UrdfGeometryConfig | None = None)[source]

Configuration dataclass for sphere obstacle.

This configuration class holds information about the position, size and randomization of a spherical obstacle.

Parameters:

urdf : str : Filename of the urdf geometry : GeometryConfig : Geometry of the obstacle low: GeometryConfig : Lower limit for randomization high: GeometryConfig : Upper limit for randomization

geometry: UrdfGeometryConfig
high: UrdfGeometryConfig | None = None
low: UrdfGeometryConfig | None = None
movable: bool = False
scaling: float = 1
type: str
urdf: str

Goals

exception mpscenes.goals.JointSpaceGoalsNotSupportedError[source]
exception mpscenes.goals.MultiplePrimeGoalsError[source]
exception mpscenes.goals.UnknownSubGoalType[source]
class mpscenes.goals.DynamicSubGoal(**kwargs)[source]
acceleration(**kwargs) ndarray[source]
angle()[source]
dict()[source]
evaluate_trajectory(**kwargs)[source]
position(**kwargs) ndarray[source]
shuffle()[source]
traj()[source]
trajectory_type() str[source]
velocity(**kwargs) ndarray[source]
class mpscenes.goals.DynamicSubGoalConfig(weight: float, type: str, indices: List[int], epsilon: float, is_primary_goal: bool, parent_link: str, child_link: str, trajectory: Any, angle: Any | None = None, low: List[float] | None = None, high: List[float] | None = None)[source]

Configuration dataclass for static sub goal.

This configuration class holds information about the the weight, accuracy required, type and position in the kinematic chain.

Parameters:

parent_link: str

Name of the link that specifies the frame in which the goal is defined

child_link: str

Name of the link that should match the desired position

trajectory: Any

Trajectory of the goal, either defined by spline or analytic equation.

angle list

Additional rotation from the parent_link frame given by a quaternion

lowlist

Lower limit for randomization

highlist

Upper limit for randomization

angle: Any | None = None
high: List[float] | None = None
low: List[float] | None = None
trajectory: Any
class mpscenes.goals.GoalComposition(**kwargs)[source]
dict() Dict[str, dict][source]
evaluate(**kwargs) List[List[ndarray]][source]

Evaluates all subgoals and returns them as a list.

Evaluations containts position, velocity and acceleration.

get_goal_by_index(index: int) SubGoal[source]

Get subgoal by index.

get_goal_by_name(name: str) SubGoal[source]

Get subgoal by name.

parse_sub_goals() None[source]

Parse and create sub-goals based on the configuration.

Iterates through the sub-goal configurations in the internal configuration dictionary and creates sub-goals using the specified types and parameters. The created sub-goals are stored in the _sub_goals list. If a sub-goal is marked as a primary goal, it sets the _primary_goal_index accordingly.

Raises:

MultiplePrimeGoalsError – If more than one sub-goal is marked as a primary goal.

primary_goal() SubGoal[source]

Get primary goal of goal composition.

shuffle() None[source]
sub_goals() List[SubGoal][source]

Get list of all subgoals.

class mpscenes.goals.StaticJointSpaceSubGoal(**kwargs)[source]
acceleration(**kwargs)[source]
evaluate(**kwargs)[source]
limit_high()[source]
limit_low()[source]
position(**kwargs)[source]
shuffle()[source]
velocity(**kwargs)[source]
class mpscenes.goals.StaticJointSpaceSubGoalConfig(weight: float, type: str, indices: List[int], epsilon: float, is_primary_goal: bool, desired_position: List[float], low: List[float] | None = None, high: List[float] | None = None)[source]

Configuration dataclass for static joint space sub goal.

This configuration class holds information about the the desired joint configuration and the limits for randomization.

Parameters:

desired_position : list : Goal configuration of the robot low : list : Lower limit for randomization high : list : Upper limit for randomization

desired_position: List[float]
high: List[float] | None = None
low: List[float] | None = None
class mpscenes.goals.StaticSubGoal(**kwargs)[source]
acceleration(**kwargs)[source]
angle()[source]
limit_high()[source]
limit_low()[source]
position(**kwargs) ndarray[source]
shuffle()[source]
velocity(**kwargs) ndarray[source]
class mpscenes.goals.StaticSubGoalConfig(weight: float, type: str, indices: List[int], epsilon: float, is_primary_goal: bool, parent_link: Any, child_link: Any, desired_position: List[float], angle: Any | None = None, low: List[float] | None = None, high: List[float] | None = None)[source]

Configuration dataclass for static sub goal.

This configuration class holds information about the the weight, accuracy required, type and position in the kinematic chain.

Parameters:

parent_link: str

Name of the link that specifies the frame in which the goal is defined

child_link: str

Name of the link that should match the desired position

desired_positionlist

Goal state of the concerned link

angle: list

Additional rotation from the parent_link frame given by a quaternion

low: list

Lower limit for randomization

high: list

Upper limit for randomization

angle: Any | None = None
desired_position: List[float]
high: List[float] | None = None
low: List[float] | None = None
class mpscenes.goals.SubGoal(**kwargs)[source]
abstract acceleration(**kwargs)[source]
check_dimensionality()[source]
dimension()[source]
epsilon()[source]
evaluate(**kwargs) list[source]
indices()[source]
is_primary_goal()[source]
abstract position(**kwargs)[source]
abstract shuffle()[source]
type()[source]
abstract velocity(**kwargs)[source]
weight()[source]
class mpscenes.goals.SubGoalConfig(weight: float, type: str, indices: List[int], epsilon: float, is_primary_goal: bool)[source]

Configuration dataclass for sub goal.

This configuration class holds information about the the weight, accuracy required, type and position in the kinematic chain.

Parameters:

m: int: Dimension of the sub goal w: float: Weight of the sub goal type: str: Type of the sub goal indices: list: Indices of a forward map to be considered epsilon: float: Required accuracy of the sub goal prime: bool: Flag for primary goal

epsilon: float
indices: List[int]
is_primary_goal: bool
type: str
weight: float
class mpscenes.goals.SubGoalCreator[source]
create_sub_goal(sub_goal_type, name, content_dict)[source]