placo::kinematics#
- class placo.AvoidSelfCollisionsKinematicsConstraint#
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- name: str#
Object name.
- priority: str#
Priority [str]
- self_collisions_margin: float#
Margin for self collisions [m].
- self_collisions_trigger: float#
Distance that triggers the constraint [m].
- class placo.AxisAlignTask(frame_index: any, axis_frame: ndarray, targetAxis_world: ndarray)#
- A: ndarray#
Matrix A in the task Ax = b, where x are the joint delta positions.
- axis_frame: ndarray#
Axis in the frame.
- b: ndarray#
Vector b in the task Ax = b, where x are the joint delta positions.
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- error() ndarray#
Task errors (vector)
- error_norm() float#
The task error norm.
- frame_index: any#
Target frame.
- name: str#
Object name.
- priority: str#
Priority [str]
- targetAxis_world: ndarray#
Target axis in the world.
- update() None#
Update the task A and b matrices from the robot state and targets.
- class placo.CentroidalMomentumTask(L_world: ndarray)#
See KinematicsSolver::add_centroidal_momentum_task.
- A: ndarray#
Matrix A in the task Ax = b, where x are the joint delta positions.
- L_world: ndarray#
Target centroidal angular momentum in the world.
- b: ndarray#
Vector b in the task Ax = b, where x are the joint delta positions.
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- error() ndarray#
Task errors (vector)
- error_norm() float#
The task error norm.
- mask: AxisesMask#
Axises mask.
- name: str#
Object name.
- priority: str#
Priority [str]
- update() None#
Update the task A and b matrices from the robot state and targets.
- class placo.CoMPolygonConstraint(polygon: list[ndarray], margin: float = 0.0)#
Ensures that the CoM (2D) lies inside the given polygon.
- Parameters:
polygon (list[numpy.ndarray]) – Clockwise polygon
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- dcm: bool#
If set to true, the DCM will be used instead of the CoM.
- margin: float#
Margin for the polygon constraint (minimum distance between the CoM and the polygon)
- name: str#
Object name.
- omega: float#
If DCM mode is enabled, the constraint will be applied on the DCM instead of the CoM with the following omega (sqrt(g / h))
- polygon: list[ndarray]#
Clockwise polygon.
- priority: str#
Priority [str]
- class placo.CoMTask(target_world: ndarray)#
See KinematicsSolver::add_com_task.
- A: ndarray#
Matrix A in the task Ax = b, where x are the joint delta positions.
- b: ndarray#
Vector b in the task Ax = b, where x are the joint delta positions.
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- error() ndarray#
Task errors (vector)
- error_norm() float#
The task error norm.
- mask: AxisesMask#
Mask.
- name: str#
Object name.
- priority: str#
Priority [str]
- target_world: ndarray#
Target for the CoM in the world.
- update() None#
Update the task A and b matrices from the robot state and targets.
- class placo.ConeConstraint(frame_a: any, frame_b: any, angle_max: float)#
With a cone constraint, the z-axis of frame a and frame b should remaine within a cone of angle angle_max.
- N: int#
Number of slices used to discretize the cone.
- angle_max: float#
Maximum angle allowable by the cone constraint (between z-axis of frame_a and frame_b)
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- name: str#
Object name.
- priority: str#
Priority [str]
- range: float#
Range of the cone discretization (in radians). The cone is discretized in [-range, range] around the current orientation.
- class placo.DistanceConstraint(frame_a: any, frame_b: any, distance_max: float)#
Constraints the distance betweek two points in the robot.
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- distance_max: float#
Maximum distance allowed between frame A and frame B.
- name: str#
Object name.
- priority: str#
Priority [str]
- class placo.DistanceTask(frame_a: any, frame_b: any, distance: float)#
see KinematicsSolver::add_distance_task
- A: ndarray#
Matrix A in the task Ax = b, where x are the joint delta positions.
- b: ndarray#
Vector b in the task Ax = b, where x are the joint delta positions.
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- distance: float#
Target distance between A and B.
- error() ndarray#
Task errors (vector)
- error_norm() float#
The task error norm.
- frame_a: any#
Frame A.
- frame_b: any#
Frame B.
- name: str#
Object name.
- priority: str#
Priority [str]
- update() None#
Update the task A and b matrices from the robot state and targets.
- class placo.FrameTask#
see KinematicsSolver::add_frame_task
- T_world_frame: any#
- configure(name: str, priority: str = 'soft', position_weight: float = 1.0, orientation_weight: float = 1.0) None#
Configures the frame task.
- Parameters:
name (str) – task name
priority (str) – task priority
position_weight (float) – weight for the position task
orientation_weight (float) – weight for the orientation task
- orientation() OrientationTask#
- position() PositionTask#
- class placo.GearTask#
see KinematicsSolver::add_gear_task
- A: ndarray#
Matrix A in the task Ax = b, where x are the joint delta positions.
- add_gear(target: str, source: str, ratio: float) None#
Adds a gear constraint, you can add multiple source for the same target, they will be summed.
- Parameters:
target (str) – target joint
source (str) – source joint
ratio (float) – ratio
- b: ndarray#
Vector b in the task Ax = b, where x are the joint delta positions.
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- error() ndarray#
Task errors (vector)
- error_norm() float#
The task error norm.
- name: str#
Object name.
- priority: str#
Priority [str]
- set_gear(target: str, source: str, ratio: float) None#
Sets a gear constraint.
- Parameters:
target (str) – target joint
source (str) – source joint
ratio (float) – ratio
- update() None#
Update the task A and b matrices from the robot state and targets.
- class placo.JointSpaceHalfSpacesConstraint(A: ndarray, b: ndarray)#
Ensures that, in joint-space we have Aq <= b Note that the floating base terms will be ignored in A. However, A should still be of dimension n_constraints x n_q.
- A: ndarray#
Matrix A in Aq <= b.
- b: ndarray#
Vector b in Aq <= b.
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- name: str#
Object name.
- priority: str#
Priority [str]
- class placo.JointsTask#
see KinematicsSolver::add_joints_task
- A: ndarray#
Matrix A in the task Ax = b, where x are the joint delta positions.
- b: ndarray#
Vector b in the task Ax = b, where x are the joint delta positions.
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- error() ndarray#
Task errors (vector)
- error_norm() float#
The task error norm.
- get_joint(joint: str) float#
Returns the target value of a joint.
- Parameters:
joint (str) – joint
- name: str#
Object name.
- priority: str#
Priority [str]
- set_joint(joint: str, target: float) None#
Sets a joint target.
- Parameters:
joint (str) – joint
target (float) – target value
- set_joints(arg2: dict) None#
- update() None#
Update the task A and b matrices from the robot state and targets.
- class placo.KinematicsConstraint#
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- name: str#
Object name.
- priority: str#
Priority [str]
- class placo.KinematicsSolver(robot_: RobotWrapper)#
- N: int#
Size of the problem (number of variables)
- add_avoid_self_collisions_constraint() AvoidSelfCollisionsKinematicsConstraint#
Adds a self collision avoidance constraint.
- add_axisalign_task(frame: any, axis_frame: ndarray, targetAxis_world: ndarray) AxisAlignTask#
Adds an axis alignment task. The goal here is to keep the given axis (expressed in the given frame) aligned with another one (given in the world)
- Parameters:
frame (any) – the robot frame we want to control
axis_frame (numpy.ndarray) – the axis to align, expressed in the robot frame
targetAxis_world (numpy.ndarray) – the target axis (in the world) we want to be aligned with
- add_centroidal_momentum_task(L_world: ndarray) CentroidalMomentumTask#
Adding a centroidal momentum task.
- Parameters:
L_world (numpy.ndarray) – desired centroidal angular momentum in the world
- add_com_polygon_constraint(polygon: list[ndarray], margin: float = 0.0) CoMPolygonConstraint#
Adds a CoM polygon constraint.
- Parameters:
polygon (list[numpy.ndarray]) – clockwise polygon
margin (float) – margin
- add_com_task(targetCom_world: ndarray) CoMTask#
Adds a com position task.
- Parameters:
targetCom_world (numpy.ndarray) – the target position, expressed in the world (as T_world_frame)
- add_cone_constraint(frame_a: str, frame_b: str, alpha_max: float) ConeConstraint#
Adds a Cone constraint.
- Parameters:
frame_a (str) – frame A
frame_b (str) – frame B
alpha_max (float) – alpha max (in radians) between the frame z-axis and the cone frame zt-axis
- add_constraint(constraint: KinematicsConstraint) None#
Adds a custom constraint to the solver.
- add_distance_constraint(frame_a: str, frame_b: str, distance_max: float) DistanceConstraint#
Adds a distance constraint.
- Parameters:
frame_a (str) – frame A
frame_b (str) – frame B
distance_max (float) – maximum distance between the two frames
- add_distance_task(frame_a: str, frame_b: str, distance: float) DistanceTask#
Adds a distance task to be maintained between two frames.
- Parameters:
frame_a (str) – frame a
frame_b (str) – frame b
distance (float) – distance to maintain
- add_frame_task(frame: str, T_world_frame: ndarray = None) FrameTask#
Adds a frame task, this is equivalent to a position + orientation task, resulting in decoupled tasks for a given frame.
- Parameters:
frame (str) – the robot frame we want to control
T_world_frame (numpy.ndarray) – the target for the frame we want to control, expressed in the world (as T_world_frame)
- add_joint_space_half_spaces_constraint(A: ndarray, b: ndarray) JointSpaceHalfSpacesConstraint#
Adds a joint-space half-spaces constraint, such that Aq <= b.
- Parameters:
A (numpy.ndarray) – matrix A in Aq <= b
b (numpy.ndarray) – vector b in Aq <= b
- add_joints_task() JointsTask#
Adds joints task.
- add_kinetic_energy_regularization_task(magnitude: float = 1e-06) KineticEnergyRegularizationTask#
Adds a kinetic energy regularization task for a given magnitude.
- Parameters:
magnitude (float) – regularization magnitude
- add_manipulability_task(frame: any, type: any, lambda_: float = 1.0) ManipulabilityTask#
Adds a manipulability regularization task for a given magnitude.
- add_orientation_task(frame: str, R_world_frame: ndarray) OrientationTask#
Adds an orientation task.
- Parameters:
frame (str) – the robot frame we want to control
R_world_frame (numpy.ndarray) – the target orientation we want to achieve, expressed in the world (as T_world_frame)
- add_position_task(frame: str, target_world: ndarray) PositionTask#
Adds a position task.
- Parameters:
frame (str) – the robot frame we want to control
target_world (numpy.ndarray) – the target position, expressed in the world (as T_world_frame)
- add_regularization_task(magnitude: float = 1e-06) RegularizationTask#
Adds a regularization task for a given magnitude.
- Parameters:
magnitude (float) – regularization magnitude
- add_relative_frame_task(frame_a: str, frame_b: str, T_a_b: ndarray) RelativeFrameTask#
Adds a relative frame task.
- Parameters:
frame_a (str) – frame a
frame_b (str) – frame b
T_a_b (numpy.ndarray) – desired transformation
- add_relative_orientation_task(frame_a: str, frame_b: str, R_a_b: ndarray) RelativeOrientationTask#
Adds a relative orientation task.
- Parameters:
frame_a (str) – frame a
frame_b (str) – frame b
R_a_b (numpy.ndarray) – the desired orientation
- add_relative_position_task(frame_a: str, frame_b: str, target: ndarray) RelativePositionTask#
Adds a relative position task.
- Parameters:
frame_a (str) – frame a
frame_b (str) – frame b
target (numpy.ndarray) – the target vector between frame a and b (expressed in world)
- add_wheel_task(joint: str, radius: float, omniwheel: bool = False) WheelTask#
Adds a wheel task.
- Parameters:
joint (str) – joint name
radius (float) – wheel radius
omniwheel (bool) – true if it’s an omniwheel (can slide laterally)
- add_yaw_constraint(frame_a: str, frame_b: str, alpha_max: float) YawConstraint#
Adds a yaw constraint.
- Parameters:
frame_a (str) – frame A
frame_b (str) – frame B
alpha_max (float) – angle max for yaw of x-axis in frame b in a
- clear() None#
Clears the internal tasks.
- dt: float#
solver dt (for speeds limiting)
- dump_status() None#
Shows the tasks status.
- enable_joint_limits(enable: bool) None#
Enables/disables joint limits inequalities.
- enable_velocity_limits(enable: bool) None#
Enables/disables joint velocity inequalities.
- mask_dof(dof: str) None#
Masks (disables a DoF) from being used by the QP solver (it can’t provide speed)
- Parameters:
dof (str) – the dof name
- mask_fbase(masked: bool) None#
Decides if the floating base should be masked.
- remove_constraint(constraint: KinematicsConstraint) None#
Removes aconstraint from the solver.
- Parameters:
constraint (KinematicsConstraint) – constraint
- robot: RobotWrapper#
The robot controlled by this solver.
- scale: float#
scale obtained when using tasks scaling
- solve(apply: bool = False) ndarray#
Constructs the QP problem and solves it.
- Parameters:
apply (bool) – apply the solution to the robot model
- tasks_count() int#
Number of tasks.
- unmask_dof(dof: str) None#
Unmsks (enables a DoF) from being used by the QP solver (it can provide speed)
- Parameters:
dof (str) – the dof name
- class placo.KineticEnergyRegularizationTask#
- A: ndarray#
Matrix A in the task Ax = b, where x are the joint delta positions.
- b: ndarray#
Vector b in the task Ax = b, where x are the joint delta positions.
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- error() ndarray#
Task errors (vector)
- error_norm() float#
The task error norm.
- name: str#
Object name.
- priority: str#
Priority [str]
- set_joint_weight(arg2: str, arg3: float) None#
- set_weight(arg2: float) None#
- update() None#
Update the task A and b matrices from the robot state and targets.
- class placo.ManipulabilityTask(frame_index: any, type: any, lambda_: float = 1.0)#
- A: ndarray#
Matrix A in the task Ax = b, where x are the joint delta positions.
- b: ndarray#
Vector b in the task Ax = b, where x are the joint delta positions.
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- error() ndarray#
Task errors (vector)
- error_norm() float#
The task error norm.
- lambda_: any#
- manipulability: float#
The last computed manipulability value.
- minimize: bool#
Should the manipulability be minimized (can be useful to find singularities)
- name: str#
Object name.
- priority: str#
Priority [str]
- update() None#
Update the task A and b matrices from the robot state and targets.
- class placo.OrientationTask(frame_index: any, R_world_frame: ndarray)#
See KinematicsSolver::add_orientation_task.
- A: ndarray#
Matrix A in the task Ax = b, where x are the joint delta positions.
- R_world_frame: ndarray#
Target frame orientation in the world.
- b: ndarray#
Vector b in the task Ax = b, where x are the joint delta positions.
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- error() ndarray#
Task errors (vector)
- error_norm() float#
The task error norm.
- frame_index: any#
Frame.
- mask: AxisesMask#
Mask.
- name: str#
Object name.
- priority: str#
Priority [str]
- update() None#
Update the task A and b matrices from the robot state and targets.
- class placo.PositionTask(frame_index: any, target_world: ndarray)#
See KinematicsSolver::add_position_task.
- A: ndarray#
Matrix A in the task Ax = b, where x are the joint delta positions.
- b: ndarray#
Vector b in the task Ax = b, where x are the joint delta positions.
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- error() ndarray#
Task errors (vector)
- error_norm() float#
The task error norm.
- frame_index: any#
Frame.
- mask: AxisesMask#
Mask.
- name: str#
Object name.
- priority: str#
Priority [str]
- target_world: ndarray#
Target position in the world.
- update() None#
Update the task A and b matrices from the robot state and targets.
- class placo.RegularizationTask#
- A: ndarray#
Matrix A in the task Ax = b, where x are the joint delta positions.
- b: ndarray#
Vector b in the task Ax = b, where x are the joint delta positions.
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- error() ndarray#
Task errors (vector)
- error_norm() float#
The task error norm.
- name: str#
Object name.
- priority: str#
Priority [str]
- set_joint_weight(joint: str, weight: float) None#
Set a joint-specific weight.
- set_weight(weight: float) None#
Set the weight for all joints.
- update() None#
Update the task A and b matrices from the robot state and targets.
- class placo.RelativeFrameTask(position: RelativePositionTask, orientation: RelativeOrientationTask)#
see KinematicsSolver::add_relative_frame_task
- T_a_b: any#
- configure(name: str, priority: str = 'soft', position_weight: float = 1.0, orientation_weight: float = 1.0) None#
Configures the relative frame task.
- Parameters:
name (str) – task name
priority (str) – task priority
position_weight (float) – weight for the position task
orientation_weight (float) – weight for the orientation task
- orientation() RelativeOrientationTask#
- position() RelativePositionTask#
- class placo.RelativeOrientationTask(frame_a: any, frame_b: any, R_a_b: ndarray)#
See KinematicsSolver::add_relative_orientation_task.
- A: ndarray#
Matrix A in the task Ax = b, where x are the joint delta positions.
- R_a_b: ndarray#
Target relative orientation of b in a.
- b: ndarray#
Vector b in the task Ax = b, where x are the joint delta positions.
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- error() ndarray#
Task errors (vector)
- error_norm() float#
The task error norm.
- frame_a: any#
Frame A.
- frame_b: any#
Frame B.
- mask: AxisesMask#
Mask.
- name: str#
Object name.
- priority: str#
Priority [str]
- update() None#
Update the task A and b matrices from the robot state and targets.
- class placo.RelativePositionTask(frame_a: any, frame_b: any, target: ndarray)#
See KinematicsSolver::add_relative_position_task.
- A: ndarray#
Matrix A in the task Ax = b, where x are the joint delta positions.
- b: ndarray#
Vector b in the task Ax = b, where x are the joint delta positions.
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- error() ndarray#
Task errors (vector)
- error_norm() float#
The task error norm.
- frame_a: any#
Frame A.
- frame_b: any#
Frame B.
- mask: AxisesMask#
Mask.
- name: str#
Object name.
- priority: str#
Priority [str]
- target: ndarray#
Target position of B in A.
- update() None#
Update the task A and b matrices from the robot state and targets.
- class placo.Task#
- A: ndarray#
Matrix A in the task Ax = b, where x are the joint delta positions.
- b: ndarray#
Vector b in the task Ax = b, where x are the joint delta positions.
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- error() ndarray#
Task errors (vector)
- error_norm() float#
The task error norm.
- name: str#
Object name.
- priority: str#
Priority [str]
- update() None#
Update the task A and b matrices from the robot state and targets.
- class placo.WheelTask(joint: str, radius: float, omniwheel: bool = False)#
See KinematicsSolver::add_wheel_task.
- A: ndarray#
Matrix A in the task Ax = b, where x are the joint delta positions.
- T_world_surface: ndarray#
Target position in the world.
- b: ndarray#
Vector b in the task Ax = b, where x are the joint delta positions.
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- error() ndarray#
Task errors (vector)
- error_norm() float#
The task error norm.
- joint: str#
Frame.
- name: str#
Object name.
- omniwheel: bool#
Omniwheel (can slide laterally)
- priority: str#
Priority [str]
- radius: float#
Wheel radius.
- update() None#
Update the task A and b matrices from the robot state and targets.
- class placo.YawConstraint(frame_a: any, frame_b: any, angle_max: float)#
Constrains the yaw of frame b in frame a, such that the x-axis of frame b should remain with +- angle_max.
- angle_max: float#
Maximum angle allowable by the yaw constraint (yaw is taken for x-axis of b around z-axis in a)
- configure(name: str, priority: str = 'soft', weight: float = 1.0) None#
Configures the object.
- Parameters:
name (str) – task name
priority (str) – task priority (hard, soft or scaled)
weight (float) – task weight
- name: str#
Object name.
- priority: str#
Priority [str]