API
Common
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.
- 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:
- 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.
- 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.
- orientation(**kwarg) ndarray [source]
Get the orientation of the obstacle as quaternion with convention wxyz.
- 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.
- 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.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.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]
- class mpscenes.obstacles.DynamicSphereGeometryConfig(trajectory: Any, position: List[float] = <factory>, orientation: List[float] = <factory>, radius: float = 1.0)[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.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]
- 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.
- 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
- 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
- child_link: str
- high: List[float] | None = None
- low: List[float] | None = None
- parent_link: str
- trajectory: Any
- class mpscenes.goals.GoalComposition(**kwargs)[source]
-
- evaluate(**kwargs) List[List[ndarray]] [source]
Evaluates all subgoals and returns them as a list.
Evaluations containts position, velocity and acceleration.
- 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.
- 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.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
- child_link: Any
- desired_position: List[float]
- high: List[float] | None = None
- low: List[float] | None = None
- parent_link: Any
- 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