Python API¶
cuRobo provides accelerated modules for robotics which can be used to build high-performance robotics applications. The library has several modules for numerical optimization, robot kinematics, geometry processing, collision checking, graph search planning. cuRobo provides high-level APIs for performing tasks like collision-free inverse kinematics, model predictive control, and motion planning.
Public API Quick Start:
from curobo.inverse_kinematics import InverseKinematics, InverseKinematicsCfg
from curobo.trajectory_optimizer import TrajectoryOptimizer, TrajectoryOptimizerCfg
from curobo.motion_planner import MotionPlanner, MotionPlannerCfg
from curobo.model_predictive_control import ModelPredictiveControl, ModelPredictiveControlCfg
from curobo.kinematics import Kinematics, KinematicsCfg
from curobo.scene import Scene, Cuboid, Sphere, Mesh
from curobo.servo import JointTargetServo
from curobo.types import JointState
# Forward kinematics
kin = Kinematics(KinematicsCfg.from_robot_yaml_file("franka.yml"))
js = JointState.from_position(q, joint_names=kin.joint_names)
state = kin.compute_kinematics(js)
# Scene representation
scene = Scene(
cuboid=[Cuboid(name="table", dims=[1, 1, 0.1], pose=[0, 0, 0.5, 1, 0, 0, 0])],
)
# Inverse kinematics
ik_config = InverseKinematicsCfg.create(robot="franka.yml")
ik = InverseKinematics(ik_config)
result = ik.solve_pose(goal_tool_poses=target_poses)
# Trajectory optimization
trajopt = TrajectoryOptimizer(trajopt_config)
trajectory = trajopt.solve_pose(goal_tool_poses=target_poses)
# Model predictive control
mpc = ModelPredictiveControl(mpc_config)
result = mpc.optimize_action_sequence(current_state)
Public API Modules:
curobo.kinematics- Forward kinematicscurobo.inverse_kinematics- Inverse kinematics solvercurobo.trajectory_optimizer- Trajectory optimizationcurobo.trajectory_timeopt- GPU trajectory timeopt with joint and torque limitscurobo.motion_planner- Motion planningcurobo.model_predictive_control- Model predictive controlcurobo.motion_retargeter- Motion retargeting using inverse kinematics and model predictive controlcurobo.scene- Scene representation with obstaclescurobo.collision_checking- Robot collision checking (for custom pipelines)curobo.perception- Perception utilities (robot segmentation)curobo.robot_builder- Build robot configs from URDFcurobo.servo- Joint-space command smoothingcurobo.viewer- Visualization (Rerun, Viser)curobo.types- Common data types (JointState, Pose, etc.)
Motion planning iteration budgets¶
MotionPlanner and BatchMotionPlanner accept a positive integer
outer_iterations on each pose-planning call:
Method |
Default |
Maximum optimizer steps with default configuration |
|---|---|---|
|
2 |
100 per trajectory-optimization solve |
|
4 |
200 per trajectory-optimization solve |
Each pass runs initial_check_interval optimizer steps (50 by default), checks
feasibility, and stops continuation on success. Further passes retain the iterate and
optimizer history. The budget applies independently to direct and RRT-seeded solves;
it does not limit the total work across planning retries.
max_attempts limits planning retries. finetune_attempts controls additional
refinement passes, each using a separate 25-step budget by default. Changing
outer_iterations on one call does not change later calls’ defaults. Waypoint planning
uses four passes in both position-only and position-and-orientation tracking modes.
Python plan_cspace uses TrajOptSolverCfg.initial_max_iters (default 100) rather
than a per-call outer_iterations argument. Standalone TrajOpt uses the same cap,
with an optional per-call initial_iters override.
The C++ equivalents are PoseMotionPlanningRequest::outer_iterations (default 2)
and WaypointMotionPlanningRequest::outer_iterations (default 4). The waypoint
field supplies the budget independently of the embedded motion request. C++
recaptures its optimization graph when the pass count changes; Python reuses its
25-step optimizer graphs within each solve/check pass.
C++ joint-space planning uses MotionPlanningRequest::outer_iterations (default 2).
Standalone TrajOpt uses TrajectoryOptimizationConfig::max_iterations (default 100);
a positive TrajectoryOptimizationRequest::outer_iterations overrides that cap.
Ordinary pose and joint-space planning default to a 100-step initial budget, checking
success after 50 steps. Success proceeds to refinement; failure continues the same
optimizer state for another 50 steps. The default optimizer collision activation
distance is 0.0025 m for IK and TrajOpt in Python and for TrajOpt in C++. Native IK
preserves the exported activation distance by default (-1); newly generated
exports use the Python default of 0.0025 m.
Complete spline trajectories¶
curobo.types.SplineTrajectory contains a complete cubic path, joint names in
control-point order, and either UniformTiming or TimeOptTiming. Its
duration is a device tensor in seconds. control_points has shape
[B, C, D] and includes boundary support; the active path has C - 3 spans.
The timing variants contain:
UniformTiming.knot_dt: seconds per spatial span, shape[B].TimeOptTiming.controls: squared-progress-speed coefficients, shape[B, 32].TimeOptTiming.time: integrated seconds at uniformly spaced progress nodes, shape[B, G]. Its final entry is the duration.
A successful motion-planning or trajectory-optimization result exposes
get_trajectory(batch_index=None, seed_index=None). Specify an index whenever
that result contains multiple problems or retained seeds. Failed selections raise
an error. The selected value contains one trajectory, with B = 1.
trajectory.interpolate(dt) evaluates positions, velocities, accelerations, and
jerks on CUDA and returns a JointState of shape [1, N, D]. dt is a
positive maximum interval in seconds. The returned JointState.dt stores the
actual interval, adjusted to include both endpoints exactly. A stationary
zero-duration TimeOpt path returns one state, zero derivatives, and dt=None.
Interpolation allocates output and reads duration; call it outside CUDA capture,
once when preparing a controller buffer. The spline does not cache sampled states.
trajectory.clone() copies all controls, timing, and names.
trajectory.to(device) transfers the complete value to CPU or CUDA; a
same-device call may return the original value. CPU storage supports controller
handoff; interpolation requires CUDA. Python copies follow PyTorch’s current-stream
ordering. Coordinate separate streams explicitly before consuming or reusing buffers.
Spline joint names describe active coordinates; existing interpolated-result helpers
can also include locked joints. Existing sampled-result APIs remain available.
Grasp results expose get_approach_trajectory(), get_grasp_trajectory(), and
get_lift_trajectory(). Each successful phase retains its complete spline before
another phase reuses the solver. An omitted phase returns None; an attempted
phase that failed raises an error. Overall grasp success must be checked separately.
C++ provides the same value and timing variants through
curobo_robot_runtime/spline_trajectory.h. MotionPlanner::trajectory() and
TrajectoryOptimizer::trajectory() return the selected successful spline;
TrajectoryTimeOpt::trajectory(seed) selects a TimeOpt seed. Native
interpolate(dt, stream) returns owning CUDA buffers with joint names,
sample_count, and actual dt. Planner and optimizer accessors require the
latest request’s output buffers to remain alive until selection. CPU device
-1 supports storage and transfer;
nonnegative device values are CUDA ordinals. Native checked copies synchronize the
supplied stream. One-sample stationary output has dt=0. Native grasp phase
getters return std::optional<SplineTrajectory> with the same omission and failure
rules as Python.