placo::dynamics#

class placo.AvoidSelfCollisionsDynamicsConstraint#
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.Contact#
active: bool#

true if the contact is active (ignored by the solver else, this allow to enable/disable a contact without removing it from the solver)

mu: float#

Coefficient of friction (if relevant)

weight_forces: float#

Weight of forces for the optimization (if relevant)

weight_moments: float#

Weight of moments for optimization (if relevant)

weight_tangentials: float#

Extra cost for tangential forces.

wrench: ndarray#

Wrench populated after the DynamicsSolver::solve call.

class placo.Contact6D(frame_task: DynamicsFrameTask, unilateral: bool)#

see DynamicsSolver::add_fixed_planar_contact and DynamicsSolver::add_unilateral_planar_contact

active: bool#

true if the contact is active (ignored by the solver else, this allow to enable/disable a contact without removing it from the solver)

length: float#

Rectangular contact length along local x-axis.

mu: float#

Coefficient of friction (if relevant)

orientation_task() DynamicsOrientationTask#
position_task() DynamicsPositionTask#
unilateral: bool#

true for unilateral contact with the ground

weight_forces: float#

Weight of forces for the optimization (if relevant)

weight_moments: float#

Weight of moments for optimization (if relevant)

weight_tangentials: float#

Extra cost for tangential forces.

width: float#

Rectangular contact width along local y-axis.

wrench: ndarray#

Wrench populated after the DynamicsSolver::solve call.

zmp() ndarray#

Returns the contact ZMP in the local frame.

class placo.DynamicsCoMTask(arg2: ndarray)#
A: ndarray#

A matrix in Ax = b, where x is the accelerations.

b: ndarray#

b vector in Ax = b, where x is the accelerations

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

ddtarget_world: ndarray#

Target acceleration in the world.

derror: ndarray#

Current velocity error vector.

dtarget_world: ndarray#

Target velocity to reach in robot frame.

error: ndarray#

Current error vector.

kd: float#

D gain for position control (if negative, will be critically damped)

kp: float#

K gain for position control.

mask: AxisesMask#

Axises mask.

name: str#

Object name.

priority: str#

Priority [str]

target_world: ndarray#

Target to reach in world frame.

class placo.DynamicsConstraint#
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.DynamicsFrameTask#
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() DynamicsOrientationTask#
position() DynamicsPositionTask#
class placo.DynamicsGearTask#
A: ndarray#

A matrix in Ax = b, where x is the accelerations.

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#

b vector in Ax = b, where x is the accelerations

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

derror: ndarray#

Current velocity error vector.

error: ndarray#

Current error vector.

kd: float#

D gain for position control (if negative, will be critically damped)

kp: float#

K gain for position control.

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

class placo.DynamicsJointsTask#
A: ndarray#

A matrix in Ax = b, where x is the accelerations.

b: ndarray#

b vector in Ax = b, where x is the accelerations

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

derror: ndarray#

Current velocity error vector.

error: ndarray#

Current error vector.

get_joint(joint: str) float#

Returns the current target position of a joint.

Parameters:

joint (str) – joint name

kd: float#

D gain for position control (if negative, will be critically damped)

kp: float#

K gain for position control.

name: str#

Object name.

priority: str#

Priority [str]

set_joint(joint: str, target: float, velocity: float = 0.0, acceleration: float = 0.0) None#

Sets the target for a given joint.

Parameters:
  • joint (str) – joint name

  • target (float) – target position

  • velocity (float) – target velocity

  • acceleration (float) – target acceleration

set_joints(arg2: dict) None#
set_joints_velocities(arg2: dict) None#
class placo.DynamicsOrientationTask(arg2: int, arg3: ndarray)#
A: ndarray#

A matrix in Ax = b, where x is the accelerations.

R_world_frame: ndarray#

Target orientation.

b: ndarray#

b vector in Ax = b, where x is the accelerations

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

derror: ndarray#

Current velocity error vector.

domega_world: ndarray#

Target angular acceleration.

error: ndarray#

Current error vector.

kd: float#

D gain for position control (if negative, will be critically damped)

kp: float#

K gain for position control.

mask: AxisesMask#

Mask.

name: str#

Object name.

omega_world: ndarray#

Target angular velocity.

priority: str#

Priority [str]

class placo.DynamicsPositionTask(arg2: int, arg3: ndarray)#
A: ndarray#

A matrix in Ax = b, where x is the accelerations.

b: ndarray#

b vector in Ax = b, where x is the accelerations

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

ddtarget_world: ndarray#

Target acceleration in the world.

derror: ndarray#

Current velocity error vector.

dtarget_world: ndarray#

Target velocity in the world.

error: ndarray#

Current error vector.

frame_index: any#

Frame.

kd: float#

D gain for position control (if negative, will be critically damped)

kp: float#

K gain for position control.

mask: AxisesMask#

Mask.

name: str#

Object name.

priority: str#

Priority [str]

target_world: ndarray#

Target position in the world.

class placo.DynamicsRelativeFrameTask#
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() DynamicsRelativeOrientationTask#
position() DynamicsRelativePositionTask#
class placo.DynamicsRelativeOrientationTask(arg2: int, arg3: int, arg4: ndarray)#
A: ndarray#

A matrix in Ax = b, where x is the accelerations.

R_a_b: ndarray#

Target relative orientation.

b: ndarray#

b vector in Ax = b, where x is the accelerations

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

derror: ndarray#

Current velocity error vector.

domega_a_b: ndarray#

Target relative angular velocity.

error: ndarray#

Current error vector.

kd: float#

D gain for position control (if negative, will be critically damped)

kp: float#

K gain for position control.

mask: AxisesMask#

Mask.

name: str#

Object name.

omega_a_b: ndarray#

Target relative angular velocity.

priority: str#

Priority [str]

class placo.DynamicsRelativePositionTask(arg2: int, arg3: int, arg4: ndarray)#
A: ndarray#

A matrix in Ax = b, where x is the accelerations.

b: ndarray#

b vector in Ax = b, where x is the accelerations

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

ddtarget: ndarray#

Target relative acceleration.

derror: ndarray#

Current velocity error vector.

dtarget: ndarray#

Target relative velocity.

error: ndarray#

Current error vector.

kd: float#

D gain for position control (if negative, will be critically damped)

kp: float#

K gain for position control.

mask: AxisesMask#

Mask.

name: str#

Object name.

priority: str#

Priority [str]

target: ndarray#

Target relative position.

class placo.DynamicsSolver(robot: RobotWrapper)#
add_avoid_self_collisions_constraint() AvoidSelfCollisionsDynamicsConstraint#

Adds a constraint to the solver.

add_com_task(target_world: ndarray) DynamicsCoMTask#

Adds a center of mass (in the world) task.

Parameters:

target_world (numpy.ndarray) – target (in the world)

add_constraint(constraint: DynamicsConstraint) None#

Adds a custom constraint to the solver.

Parameters:

constraint (DynamicsConstraint) – constraint

add_external_wrench_contact(frame_index: any, reference: any = None) ExternalWrenchContact#

Adds an external wrench.

add_fixed_contact(frame_task: DynamicsFrameTask) Contact6D#

Adds a fixed contact.

Parameters:

frame_task (DynamicsFrameTask) – the associated frame task

add_frame_task(frame_name: str, T_world_frame: ndarray) DynamicsFrameTask#

Adds a frame task, which is a pseudo-task packaging position and orientation, resulting in a decoupled task.

Parameters:

T_world_frame (numpy.ndarray) – target transformation in the world

add_gear_task() DynamicsGearTask#

Adds a gear task, allowing replication of a joint. This can be used to implement timing belt, if coupled with an internal force.

add_joints_task() DynamicsJointsTask#

Adds a joints task.

add_line_contact(frame_task: DynamicsFrameTask) LineContact#

Adds a fixed line contact.

Parameters:

frame_task (DynamicsFrameTask) – associated frame task

add_orientation_task(frame_name: str, R_world_frame: ndarray) DynamicsOrientationTask#

Adds an orientation (in the world) task.

Parameters:

R_world_frame (numpy.ndarray) – target world orientation

add_planar_contact(frame_task: DynamicsFrameTask) Contact6D#

Adds a planar contact, which is unilateral in the sense of the local body z-axis.

Parameters:

frame_task (DynamicsFrameTask) – associated frame task

add_point_contact(position_task: DynamicsPositionTask) PointContact#

Adds a point contact.

Parameters:

position_task (DynamicsPositionTask) – the associated position task

add_position_task(frame_name: str, target_world: ndarray) DynamicsPositionTask#

Adds a position (in the world) task.

Parameters:

target_world (numpy.ndarray) – target position in the world

add_puppet_contact() PuppetContact#

Adds a puppet contact, this will add some free contact forces for the whole system, allowing it to be controlled freely.

add_relative_frame_task(frame_a_name: str, frame_b_name: str, T_a_b: ndarray) DynamicsRelativeFrameTask#

Adds a relative frame task, which is a pseudo-task packaging relative position and orientation tasks.

Parameters:

T_a_b (numpy.ndarray) – target transformation value for b frame in a

add_relative_orientation_task(frame_a_name: str, frame_b_name: str, R_a_b: ndarray) DynamicsRelativeOrientationTask#

Adds a relative orientation task.

Parameters:

R_a_b (numpy.ndarray) – target value for the orientation of b frame in a

add_relative_position_task(frame_a_name: str, frame_b_name: str, target_world: ndarray) DynamicsRelativePositionTask#

Adds a relative position task.

add_task(task: DynamicsTask) None#

Adds a custom task to the solver.

Parameters:

task (DynamicsTask) – task

add_task_contact(task: DynamicsTask) TaskContact#

Adds contact forces associated with any given task.

Parameters:

task (DynamicsTask) – task

add_torque_task() DynamicsTorqueTask#

Adds a torque task.

add_unilateral_line_contact(frame_task: DynamicsFrameTask) LineContact#

Adds a unilateral line contact, which is unilateral in the sense of the local body z-axis.

Parameters:

frame_task (DynamicsFrameTask) – associated frame task

add_unilateral_point_contact(position_task: DynamicsPositionTask) PointContact#

Adds an unilateral point contact, in the sense of the world z-axis.

Parameters:

position_task (DynamicsPositionTask) – the associated position task

clear() None#

Clears the internal tasks.

count_contacts() int#
damping: float#

Global damping that is added to all the joints.

dt: float#

Solver dt (seconds)

dump_status() None#

Shows the tasks status.

enable_joint_limits(enable: bool) None#

Enables/disables joint limits inequalities.

enable_torque_limits(enable: bool) None#

Enables/disables torque limits inequalities.

enable_velocity_limits(enable: bool) None#

Enables/disables joint velocity inequalities.

enable_velocity_vs_torque_limits(enable: bool) None#

Enables the velocity vs torque inequalities.

extra_force: ndarray#

Extra force to be added to the system (similar to non-linear terms)

get_contact(arg2: int) Contact#
gravity_only: bool#

Use gravity only (no coriolis, no centrifugal)

mask_fbase(masked: bool) None#

Decides if the floating base should be masked.

problem: Problem#

Instance of the problem.

remove_constraint(constraint: DynamicsConstraint) None#

Removes a constraint from the solver.

Parameters:

constraint (DynamicsConstraint) – constraint

remove_contact(contact: Contact) None#

Removes a contact from the solver.

remove_task(task: DynamicsTask) None#

Removes a task from the solver.

Parameters:

task (DynamicsTask) – task

robot: RobotWrapper#
set_kd(kd: float) None#

Set the kp for all tasks.

set_kp(kp: float) None#

Set the kp for all tasks.

set_qdd_safe(joint: str, qdd: float) None#

Sets the “safe” Qdd acceptable for a given joint (used by joint limits)

set_torque_limit(joint: str, limit: float) None#

Sets the allowed torque limit by the solver for a given joint. This will not affect the robot’s model effort limit. When computing the velocity vs torque limit, the robot’s model effort will still be used. You can see this limit as a continuous limit allowable for the robot, while the robot’s model limit is the maximum possible torque.

solve(integrate: bool = False) DynamicsSolverResult#
torque_cost: float#

Cost for torque regularization (1e-3 by default)

class placo.DynamicsSolverResult#
qdd: ndarray#
success: bool#
tau: ndarray#
tau_contacts: ndarray#
tau_dict(arg2: RobotWrapper) dict#
class placo.DynamicsTask#
A: ndarray#

A matrix in Ax = b, where x is the accelerations.

b: ndarray#

b vector in Ax = b, where x is the accelerations

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

derror: ndarray#

Current velocity error vector.

error: ndarray#

Current error vector.

kd: float#

D gain for position control (if negative, will be critically damped)

kp: float#

K gain for position control.

name: str#

Object name.

priority: str#

Priority [str]

class placo.DynamicsTorqueTask#
A: ndarray#

A matrix in Ax = b, where x is the accelerations.

b: ndarray#

b vector in Ax = b, where x is the accelerations

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

derror: ndarray#

Current velocity error vector.

error: ndarray#

Current error vector.

kd: float#

D gain for position control (if negative, will be critically damped)

kp: float#

K gain for position control.

name: str#

Object name.

priority: str#

Priority [str]

reset_torque(joint: str) None#

Removes a joint from this task.

Parameters:

joint (str) – joint namle

set_torque(joint: str, torque: float, kp: float = 0.0, kd: float = 0.0) None#

Sets the target for a given joint.

Parameters:
  • joint (str) – joint name

  • torque (float) – target torque

  • kp (float) – proportional gain (optional)

  • kd (float) – derivative gain (optional)

class placo.ExternalWrenchContact(frame_index: any, reference: any = None)#

see DynamicsSolver::add_external_wrench_contact

active: bool#

true if the contact is active (ignored by the solver else, this allow to enable/disable a contact without removing it from the solver)

frame_index: any#
mu: float#

Coefficient of friction (if relevant)

w_ext: ndarray#
weight_forces: float#

Weight of forces for the optimization (if relevant)

weight_moments: float#

Weight of moments for optimization (if relevant)

weight_tangentials: float#

Extra cost for tangential forces.

wrench: ndarray#

Wrench populated after the DynamicsSolver::solve call.

class placo.LineContact(frame_task: DynamicsFrameTask, unilateral: bool)#

see DynamicsSolver::add_fixed_planar_contact and DynamicsSolver::add_unilateral_planar_contact

R_world_surface: ndarray#

rotation matrix expressing the surface frame in the world frame (for unilateral contact)

active: bool#

true if the contact is active (ignored by the solver else, this allow to enable/disable a contact without removing it from the solver)

length: float#

Rectangular contact length along local x-axis.

mu: float#

Coefficient of friction (if relevant)

orientation_task() DynamicsOrientationTask#
position_task() DynamicsPositionTask#
unilateral: bool#

true for unilateral contact with the ground

weight_forces: float#

Weight of forces for the optimization (if relevant)

weight_moments: float#

Weight of moments for optimization (if relevant)

weight_tangentials: float#

Extra cost for tangential forces.

wrench: ndarray#

Wrench populated after the DynamicsSolver::solve call.

zmp() ndarray#

Returns the contact ZMP in the local frame.

class placo.PointContact(position_task: DynamicsPositionTask, unilateral: bool)#

see DynamicsSolver::add_point_contact and DynamicsSolver::add_unilateral_point_contact

R_world_surface: ndarray#

rotation matrix expressing the surface frame in the world frame (for unilateral contact)

active: bool#

true if the contact is active (ignored by the solver else, this allow to enable/disable a contact without removing it from the solver)

mu: float#

Coefficient of friction (if relevant)

position_task() DynamicsPositionTask#
unilateral: bool#

true for unilateral contact with the ground

weight_forces: float#

Weight of forces for the optimization (if relevant)

weight_moments: float#

Weight of moments for optimization (if relevant)

weight_tangentials: float#

Extra cost for tangential forces.

wrench: ndarray#

Wrench populated after the DynamicsSolver::solve call.

class placo.PuppetContact#

see DynamicsSolver::add_puppet_contact

active: bool#

true if the contact is active (ignored by the solver else, this allow to enable/disable a contact without removing it from the solver)

mu: float#

Coefficient of friction (if relevant)

weight_forces: float#

Weight of forces for the optimization (if relevant)

weight_moments: float#

Weight of moments for optimization (if relevant)

weight_tangentials: float#

Extra cost for tangential forces.

wrench: ndarray#

Wrench populated after the DynamicsSolver::solve call.

class placo.TaskContact(task: DynamicsTask)#

see DynamicsSolver::add_task_contact

active: bool#

true if the contact is active (ignored by the solver else, this allow to enable/disable a contact without removing it from the solver)

mu: float#

Coefficient of friction (if relevant)

weight_forces: float#

Weight of forces for the optimization (if relevant)

weight_moments: float#

Weight of moments for optimization (if relevant)

weight_tangentials: float#

Extra cost for tangential forces.

wrench: ndarray#

Wrench populated after the DynamicsSolver::solve call.