isaaclab_newton.controllers#
Newton controllers.
Model-free differential inverse kinematics, joint impedance, and operational-space controllers wrap
newton.controllers for batched torch inputs, so they work with any physics backend. The ik
sub-package solves full inverse kinematics against a Newton model.
Differential inverse kinematics through Newton's model-free solver. |
|
Configuration for |
|
Joint impedance control through Newton's model-free controller. |
|
Configuration for |
|
Operational-space control through Newton's model-free controller. |
|
Configuration for |
These controllers are separate from the isaaclab.controllers implementations. Their configurations map
one-to-one onto the model-free controllers in newton.controllers, including features the Isaac Lab
controllers do not have: null-space posture control for differential IK, Coriolis compensation and acceleration
feedforward for joint impedance, and separate linear and angular selection frames and a desired-twist target for
operational-space control. The caller supplies the Jacobian and dynamics, so they work with any physics backend.
They compute in float32 and bind contiguous float32 inputs without copies. Use
NewtonDifferentialInverseKinematicsActionCfg and
NewtonOperationalSpaceControllerActionCfg to drive them from an environment.
Differential Inverse Kinematics#
- class isaaclab_newton.controllers.NewtonDifferentialIKController[source]#
Bases:
objectDifferential inverse kinematics through Newton’s model-free solver.
Wraps
newton.controllers.ControllerDifferentialIKModelFreefor batched torch inputs. The caller provides the end-effector pose and Jacobian, so the controller works with any physics backend. Poses, targets, and the Jacobian must share one frame, for example the robot root frame.Inputs are bound to Newton without copies when they are contiguous float32 tensors. The returned joint targets are a view of Newton’s output buffer and are overwritten by the next
compute().Methods:
__init__(cfg, num_envs, num_joints, device)Initialize the controller.
set_joint_pos_limits(lower, upper)Set the joint position limits used by joint-limit avoidance.
compute(ee_pose, ee_pose_des, jacobian, ...)Compute the one-step-ahead joint position targets.
Attributes:
The wrapped Newton controller.
- __init__(cfg: NewtonDifferentialIKControllerCfg, num_envs: int, num_joints: int, device: str)[source]#
Initialize the controller.
- property newton_controller: newton.controllers.ControllerDifferentialIKModelFree#
The wrapped Newton controller.
- set_joint_pos_limits(lower: torch.Tensor, upper: torch.Tensor) None[source]#
Set the joint position limits used by joint-limit avoidance.
- compute(ee_pose: torch.Tensor, ee_pose_des: torch.Tensor, jacobian: torch.Tensor, joint_pos: torch.Tensor, dt: float, *, bandwidth: torch.Tensor | None = None, damping: torch.Tensor | None = None, null_space_joint_pos_target: torch.Tensor | None = None, null_space_stiffness: torch.Tensor | None = None, null_space_damping: torch.Tensor | None = None) torch.Tensor[source]#
Compute the one-step-ahead joint position targets.
Keyword inputs are only accepted when the configuration leaves the matching gain live or enables the matching feature.
Nonekeeps the previously bound tensor, or zeros if none was bound.- Parameters:
ee_pose¶ – Current end-effector pose
(x, y, z, qx, qy, qz, qw)[m, unitless], shape (num_envs, 7).ee_pose_des¶ – Desired end-effector pose [m, unitless], shape (num_envs, 7).
jacobian¶ – End-effector Jacobian, shape (num_envs, 6, num_joints).
joint_pos¶ – Current joint positions [m or rad, depending on joint type], shape (num_envs, num_joints).
dt¶ – Step duration [s].
bandwidth¶ – Output velocity gain [1/s], shape (num_envs, num_joints).
damping¶ – Damped-least-squares regularization, shape (num_envs,).
null_space_joint_pos_target¶ – Posture target [m or rad, depending on joint type], shape (num_envs, num_joints).
null_space_stiffness¶ – Posture-control gain, shape (num_envs, num_joints).
null_space_damping¶ – Null-space projector regularization, shape (num_envs,).
- Returns:
The joint position targets [m or rad, depending on joint type], shape (num_envs, num_joints).
- class isaaclab_newton.controllers.NewtonDifferentialIKControllerCfg[source]#
Bases:
objectConfiguration for
NewtonDifferentialIKController.The fields map one-to-one onto
newton.controllers.ControllerDifferentialIKModelFree, whose defaults they mirror. Newton validates the combination at construction, for example rejecting adampingfor anyik_methodother than"damped_least_squares". A gain left atNonewhere Newton requires one is read live from the correspondingcompute()argument.Attributes:
Inverse-Jacobian solve method.
Output velocity gain [1/s].
Damped-least-squares regularization for
"damped_least_squares"; must beNonefor other methods.Per-axis task weight
(x, y, z, roll, pitch, yaw).Damping used away from singularities.
Damping reached at a singularity.
Smallest-singular-value threshold below which damping ramps up.
Singular values below this are dropped.
Whether to push joints away from their limits in the task null space.
Joint-limit avoidance gain.
Distance from a joint limit [m or rad, depending on joint type] at which avoidance activates.
Whether to track a joint posture target in the task null space.
Posture-control gain.
Null-space projector regularization, used by joint-limit avoidance and posture control.
Task axes the null-space objectives must not disturb.
- ik_method: Literal['damped_least_squares', 'pseudo_inverse', 'transpose', 'adaptive_damping', 'truncated_svd']#
Inverse-Jacobian solve method. See
newton.controllers.DifferentialIKMethod.
- bandwidth: float | None#
Output velocity gain [1/s].
Nonereads it per joint fromcompute().The joint target is
joint_pos + dt * bandwidth * dq, sobandwidth = 1 / dtapplies the full correction each step.
- damping: float | None#
Damped-least-squares regularization for
"damped_least_squares"; must beNonefor other methods.With
"damped_least_squares",Nonereads it per environment fromcompute().
- axis_weight: tuple[float, float, float, float, float, float] | None#
Per-axis task weight
(x, y, z, roll, pitch, yaw). Defaults to all ones.Zero-weighted axes are removed from the solve, so
(1, 1, 1, 0, 0, 0)gives position-only IK.
- adaptive_damping_min: float | None#
Damping used away from singularities. Required by
"adaptive_damping".
- adaptive_damping_max: float | None#
Damping reached at a singularity. Required by
"adaptive_damping".
- adaptive_damping_threshold: float | None#
Smallest-singular-value threshold below which damping ramps up. Required by
"adaptive_damping".
- truncated_svd_threshold: float | None#
Singular values below this are dropped. Required by
"truncated_svd".
- use_joint_limit_avoidance: bool#
Whether to push joints away from their limits in the task null space.
Requires
set_joint_pos_limits().
- joint_limit_avoidance_gain: float#
Joint-limit avoidance gain. Must be positive when
use_joint_limit_avoidanceis enabled.
- joint_limit_avoidance_margin: float#
Distance from a joint limit [m or rad, depending on joint type] at which avoidance activates.
- use_null_space_posture_control: bool#
Whether to track a joint posture target in the task null space.
Joint Impedance#
- class isaaclab_newton.controllers.NewtonJointImpedanceController[source]#
Bases:
objectJoint impedance control through Newton’s model-free controller.
Wraps
newton.controllers.ControllerJointImpedanceModelFreefor batched torch inputs. The caller provides the joint state and dynamics terms, so the controller works with any physics backend.Inputs are bound to Newton without copies when they are contiguous float32 tensors. The returned efforts are a view of Newton’s output buffer and are overwritten by the next
compute().Methods:
__init__(cfg, num_envs, num_joints, device)Initialize the controller.
compute(joint_pos_des, joint_pos, joint_vel, *)Compute the joint efforts.
Attributes:
The wrapped Newton controller.
- __init__(cfg: NewtonJointImpedanceControllerCfg, num_envs: int, num_joints: int, device: str)[source]#
Initialize the controller.
- property newton_controller: newton.controllers.ControllerJointImpedanceModelFree#
The wrapped Newton controller.
- compute(joint_pos_des: torch.Tensor, joint_pos: torch.Tensor, joint_vel: torch.Tensor, *, joint_vel_des: torch.Tensor | None = None, joint_acc_des: torch.Tensor | None = None, mass_matrix: torch.Tensor | None = None, gravity: torch.Tensor | None = None, coriolis: torch.Tensor | None = None, stiffness: torch.Tensor | None = None, damping: torch.Tensor | None = None) torch.Tensor[source]#
Compute the joint efforts.
Keyword inputs are only accepted when the configuration enables the matching feature or leaves the matching gain live.
Nonekeeps the previously bound tensor, or zeros if none was bound.- Parameters:
joint_pos_des¶ – Desired joint positions [m or rad, depending on joint type], shape (num_envs, num_joints).
joint_pos¶ – Current joint positions [m or rad, depending on joint type], shape (num_envs, num_joints).
joint_vel¶ – Current joint velocities [m/s or rad/s, depending on joint type], shape (num_envs, num_joints).
joint_vel_des¶ – Desired joint velocities [m/s or rad/s, depending on joint type], shape (num_envs, num_joints).
joint_acc_des¶ – Desired joint accelerations [m/s² or rad/s², depending on joint type], shape (num_envs, num_joints).
mass_matrix¶ – Joint-space mass matrix, shape (num_envs, num_joints, num_joints).
gravity¶ – Gravity generalized forces [N or N·m, depending on joint type], shape (num_envs, num_joints).
coriolis¶ – Coriolis generalized forces [N or N·m, depending on joint type], shape (num_envs, num_joints).
stiffness¶ – Position-error gain, shape (num_envs, num_joints).
damping¶ – Velocity-error gain, shape (num_envs, num_joints).
- Returns:
The joint efforts [N or N·m, depending on joint type], shape (num_envs, num_joints).
- class isaaclab_newton.controllers.NewtonJointImpedanceControllerCfg[source]#
Bases:
objectConfiguration for
NewtonJointImpedanceController.The fields map one-to-one onto
newton.controllers.ControllerJointImpedanceModelFree, whose defaults they mirror. Gains are a scalar, a per-joint sequence, orNoneto read them live fromcompute()(variable impedance). Their units are [1/s²] and [1/s] withuse_inertia_decoupling, otherwise [N/m or N·m/rad] and [N·s/m or N·m·s/rad].Attributes:
Position-error gain Kp.
Velocity-error gain Kd.
Whether to add the gravity generalized forces to the output.
Whether to add the Coriolis generalized forces to the output.
Whether to premultiply the PD acceleration by the joint-space mass matrix.
Whether to add a desired joint acceleration as feedforward.
Operational Space#
- class isaaclab_newton.controllers.NewtonOperationalSpaceController[source]#
Bases:
objectOperational-space control through Newton’s model-free controller.
Wraps
newton.controllers.ControllerOperationalSpaceModelFreefor batched torch inputs. The caller provides the end-effector state, Jacobian, and dynamics terms, so the controller works with any physics backend. Poses, twists, wrenches, and the Jacobian must share one frame, for example the robot root frame; desired poses, twists, and gains are expressed in the operational frame.Inputs are bound to Newton without copies when they are contiguous float32 tensors. The returned efforts are a view of Newton’s output buffer and are overwritten by the next
compute().Methods:
__init__(cfg, num_envs, num_joints, device)Initialize the controller.
compute(jacobian, ee_pose, ee_vel, ...[, ...])Compute the joint efforts.
Attributes:
The wrapped Newton controller.
- __init__(cfg: NewtonOperationalSpaceControllerCfg, num_envs: int, num_joints: int, device: str)[source]#
Initialize the controller.
- property newton_controller: newton.controllers.ControllerOperationalSpaceModelFree#
The wrapped Newton controller.
- compute(jacobian: torch.Tensor, ee_pose: torch.Tensor, ee_vel: torch.Tensor, ee_pose_des: torch.Tensor, *, ee_vel_des: torch.Tensor | None = None, mass_matrix: torch.Tensor | None = None, gravity: torch.Tensor | None = None, operational_frame_pose: torch.Tensor | None = None, ee_wrench_des: torch.Tensor | None = None, ee_wrench: torch.Tensor | None = None, joint_pos: torch.Tensor | None = None, joint_vel: torch.Tensor | None = None, null_space_joint_pos_target: torch.Tensor | None = None, null_space_joint_vel_target: torch.Tensor | None = None, motion_stiffness: torch.Tensor | None = None, motion_damping: torch.Tensor | None = None, wrench_stiffness: torch.Tensor | None = None, linear_selection_frame: torch.Tensor | None = None, angular_selection_frame: torch.Tensor | None = None, null_space_stiffness: torch.Tensor | None = None, null_space_damping: torch.Tensor | None = None) torch.Tensor[source]#
Compute the joint efforts.
Keyword inputs are only accepted when the configuration enables the matching feature or leaves the matching gain or frame live.
Nonekeeps the previously bound tensor, or zeros if none was bound.- Parameters:
jacobian¶ – End-effector Jacobian, shape (num_envs, 6, num_joints).
ee_pose¶ – Current end-effector pose
(x, y, z, qx, qy, qz, qw)[m, unitless], shape (num_envs, 7).ee_vel¶ – Current end-effector twist
(linear, angular)[m/s, rad/s], shape (num_envs, 6).ee_pose_des¶ – Desired end-effector pose in the operational frame [m, unitless], shape (num_envs, 7).
ee_vel_des¶ – Desired end-effector twist in the operational frame [m/s, rad/s], shape (num_envs, 6).
mass_matrix¶ – Joint-space mass matrix, shape (num_envs, num_joints, num_joints).
gravity¶ – Gravity generalized forces [N or N·m, depending on joint type], shape (num_envs, num_joints).
operational_frame_pose¶ – Operational frame pose [m, unitless], shape (num_envs, 7).
ee_wrench_des¶ – Desired end-effector wrench
(force, moment)[N, N·m], shape (num_envs, 6).ee_wrench¶ – Measured end-effector wrench
(force, moment)[N, N·m], shape (num_envs, 6).joint_pos¶ – Current joint positions [m or rad, depending on joint type], shape (num_envs, num_joints).
joint_vel¶ – Current joint velocities [m/s or rad/s, depending on joint type], shape (num_envs, num_joints).
null_space_joint_pos_target¶ – Posture target [m or rad, depending on joint type], shape (num_envs, num_joints).
null_space_joint_vel_target¶ – Posture velocity target [m/s or rad/s, depending on joint type], shape (num_envs, num_joints).
motion_stiffness¶ – Task-space pose-error gain, shape (num_envs, 6).
motion_damping¶ – Task-space velocity-error gain, shape (num_envs, 6).
wrench_stiffness¶ – Wrench-error gain, shape (num_envs, 6).
linear_selection_frame¶ – Linear selection frame orientation
(qx, qy, qz, qw), shape (num_envs, 4).angular_selection_frame¶ – Angular selection frame orientation
(qx, qy, qz, qw), shape (num_envs, 4).null_space_stiffness¶ – Posture position-error gain, shape (num_envs, num_joints).
null_space_damping¶ – Posture velocity-error gain, shape (num_envs, num_joints).
- Returns:
The joint efforts [N or N·m, depending on joint type], shape (num_envs, num_joints).
- class isaaclab_newton.controllers.NewtonOperationalSpaceControllerCfg[source]#
Bases:
objectConfiguration for
NewtonOperationalSpaceController.The fields map one-to-one onto
newton.controllers.ControllerOperationalSpaceModelFree, whose defaults they mirror, and Newton validates the combination at construction. Per-axis values are a scalar or a(x, y, z, roll, pitch, yaw)tuple expressed in the operational frame. A gain or frame left atNoneis read live fromcompute().Motion and null-space gains are in [1/s²] and [1/s] with
use_inertia_decoupling, otherwise in force per unit error.Attributes:
Task-space pose-error gain Kp.
Task-space velocity-error gain Kd.
Pose
(x, y, z, qx, qy, qz, qw)[m, unitless] of the frame that gains and targets are expressed in.Whether to decouple the task dynamics with the task-space inertia.
Whether to ignore coupling between translational and rotational inertia when decoupling.
Whether to add the gravity generalized forces to the output.
Whether to command the desired wrench directly on the wrench-selected axes.
Whether to correct the wrench command with the measured-wrench error.
Motion-controlled axes.
Wrench-controlled axes.
Dimensionless wrench-error gain.
Orientation
(qx, qy, qz, qw)of the frame for the linear selection axes, in the operational frame.Orientation
(qx, qy, qz, qw)of the frame for the angular selection axes, in the operational frame.Whether to track a joint posture target in the task null space.
Posture position-error gain, scalar or per joint.
Posture velocity-error gain, scalar or per joint.
- motion_stiffness: float | tuple[float, float, float, float, float, float] | None#
Task-space pose-error gain Kp.
- motion_damping: float | tuple[float, float, float, float, float, float] | None#
Task-space velocity-error gain Kd.
- operational_frame_pose: tuple[float, ...] | None#
Pose
(x, y, z, qx, qy, qz, qw)[m, unitless] of the frame that gains and targets are expressed in.Defaults to the frame of the other inputs.
- use_inertia_decoupling: bool#
Whether to decouple the task dynamics with the task-space inertia. Requires at least six joints.
- use_partial_inertia_decoupling: bool#
Whether to ignore coupling between translational and rotational inertia when decoupling.
- use_wrench_feedforward: bool#
Whether to command the desired wrench directly on the wrench-selected axes.
- motion_selection_axes: tuple[float, float, float, float, float, float] | None#
Motion-controlled axes. Only used with wrench control; defaults to all axes.
- wrench_selection_axes: tuple[float, float, float, float, float, float] | None#
Wrench-controlled axes. Required with wrench control.
- wrench_stiffness: float | tuple[float, float, float, float, float, float] | None#
Dimensionless wrench-error gain. Only used with
use_wrench_feedback.
- linear_selection_frame: tuple[float, float, float, float] | None#
Orientation
(qx, qy, qz, qw)of the frame for the linear selection axes, in the operational frame.
- angular_selection_frame: tuple[float, float, float, float] | None#
Orientation
(qx, qy, qz, qw)of the frame for the angular selection axes, in the operational frame.
- use_null_space_control: bool#
Whether to track a joint posture target in the task null space. Requires more than six joints.
- null_space_stiffness: float | Sequence[float] | None#
Posture position-error gain, scalar or per joint. Only used with
use_null_space_control.
- null_space_damping: float | Sequence[float] | None#
Posture velocity-error gain, scalar or per joint. Only used with
use_null_space_control.
Inverse Kinematics#
Newton inverse-kinematics utilities.
Soft joint-limit constraint reading the model's coordinate limits. |
|
Soft joint-limit constraint penalizing coordinates outside the model limits. |
|
Base built IK objective. |
|
Base configuration for a Newton IK objective. |
|
Command-driven position + rotation objective tracking one end-effector body. |
|
A pose objective tracking one end-effector body. |
|
Batched wrapper around Newton's inverse-kinematics solver. |
|
Configuration for the Newton inverse-kinematics solver. |
- class isaaclab_newton.controllers.ik.NewtonIKJointLimitObjective[source]#
Bases:
NewtonIKObjectiveSoft joint-limit constraint reading the model’s coordinate limits.
Methods:
- classmethod __new__(*args, **kwargs)#
- __init__(cfg: NewtonIKJointLimitObjectiveCfg, ctx: NewtonIKBuildContext)[source]#
- class isaaclab_newton.controllers.ik.NewtonIKJointLimitObjectiveCfg[source]#
Bases:
NewtonIKObjectiveCfgSoft joint-limit constraint penalizing coordinates outside the model limits.
A constraint-only objective: it adds a Newton residual but no action dimensions.
Methods:
- classmethod __new__(*args, **kwargs)#
- class isaaclab_newton.controllers.ik.NewtonIKObjective[source]#
Bases:
objectBase built IK objective.
Owns the concrete
newton.ik.IKObjectiveinstances insolver_objectives. Pose objectives also set anameand a non-zeroaction_dim; constraint objectives leave the defaults.Methods:
- classmethod __new__(*args, **kwargs)#
- __init__()#
- class isaaclab_newton.controllers.ik.NewtonIKObjectiveCfg[source]#
Bases:
objectBase configuration for a Newton IK objective.
Subclasses set
class_typeto the runtime implementation, which the solver constructs withinstantiate(cfg, context). The implementation exposes the concretenewton.ik.IKObjectiveinstances appended to the solver and, for command-driven objectives, an action-dimension contribution.Methods:
- classmethod __new__(*args, **kwargs)#
- class isaaclab_newton.controllers.ik.NewtonIKPoseObjective[source]#
Bases:
NewtonIKObjectiveCommand-driven position + rotation objective tracking one end-effector body.
Exposes its command convention to the action’s Warp kernel as data:
command_code/use_relative, the per-coordinatescale(wp.float32), the target-frameoffset(wp.transformf), and the position/rotation target arrays the kernel writes into.Methods:
- __init__(cfg: NewtonIKPoseObjectiveCfg, ctx: NewtonIKBuildContext)[source]#
- classmethod __new__(*args, **kwargs)#
- class isaaclab_newton.controllers.ik.NewtonIKPoseObjectiveCfg[source]#
Bases:
NewtonIKObjectiveCfgA pose objective tracking one end-effector body.
This is the command-driven objective: it contributes action dimensions (3 for
"position", 6 for relative"pose", 7 for absolute"pose") and maps its slice of the policy action onto a target pose forbody_name. Multiple pose objectives drive a multi-body solve, each with its own body, command convention, weights and scale.Methods:
- classmethod __new__(*args, **kwargs)#
- __init__(class_type: type | str = <factory>, body_name: str = <factory>, name: str | None = <factory>, body_offset_pos: tuple[float, float, float] = <factory>, body_offset_rot: tuple[float, float, float, float] = <factory>, command_type: str = <factory>, use_relative_mode: bool = <factory>, scale: float | tuple[float, ...] = <factory>, position_weight: float = <factory>, rotation_weight: float = <factory>) None#
- class isaaclab_newton.controllers.ik.NewtonIKSolver[source]#
Bases:
objectBatched wrapper around Newton’s inverse-kinematics solver.
The solver is configured by an ordered list of
NewtonIKObjectiveCfg. Each cfg is resolved to its runtimeNewtonIKObjectiveand its concrete Newton objectives are appended to the underlyingnewton.ik.IKSolver. The built objectives are exposed viaobjectives/objectives_by_name; callers update a pose objective’s target by callingset_target_pose()on it directly.The solver solves
num_envsindependent problems and is agnostic to how targets are produced – the prototype-broadcast policy used by the Newton IK action term lives in the action, not here.link_resolvermaps an objective’s body name to a Newton link index; the caller owns it because the name-to-index mapping depends on the model layout (e.g. cloned env prefixes).Methods:
- __init__(cfg: NewtonIKSolverCfg, *, model, num_envs: int, device: str, objectives: Sequence[NewtonIKObjectiveCfg], link_resolver: Callable[[str], int])[source]#
- classmethod __new__(*args, **kwargs)#
- class isaaclab_newton.controllers.ik.NewtonIKSolverCfg[source]#
Bases:
objectConfiguration for the Newton inverse-kinematics solver.
Holds solver hyperparameters only. Objectives (and their residual weights) are configured separately as a list of
NewtonIKObjectiveCfgpassed to the solver. Command semantics for manager-based actions (command_type,use_relative_mode) live on the action cfg.class_typeselects the solver implementation, so an alternative solver can be dropped in via config without changing callers.Methods:
- classmethod __new__(*args, **kwargs)#
- __init__(class_type: type | str = <factory>, optimizer: str = <factory>, jacobian_mode: str = <factory>, sampler: str = <factory>, n_seeds: int = <factory>, noise_std: float = <factory>, rng_seed: int = <factory>, iterations: int = <factory>, step_size: float = <factory>, lambda_initial: float = <factory>) None#