Trajectory Generation
The moro.trajectory module provides numerical point-to-point
and multi-waypoint trajectories in joint and Cartesian position spaces.
Multi-waypoint interpolation supports linear, cubic Hermite, and quintic
Hermite methods, as well as a PCHIP-style shape-preserving cubic
interior-velocity policy with resting endpoints. Synchronized rest-to-rest
joint motion also supports trapezoidal/triangular velocity profiles with
optional immutable phase metadata.
Numerical point-to-point and multi-waypoint trajectory generation.
This module provides compact, robot-independent trajectory generation in joint space and Cartesian position space, including polynomial interpolation and synchronized trapezoidal motion profiles.
- class moro.trajectory.JointTrajectory(t: ndarray, q: ndarray, qd: ndarray, qdd: ndarray, method: str, *, profile: TrapezoidalProfileInfo | None = None)[source]
Bases:
objectNumerical joint-space trajectory sampled at explicit times.
- property dof
- property duration
- method: str
- profile: TrapezoidalProfileInfo | None = None
- q: ndarray
- qd: ndarray
- qdd: ndarray
- property samples
- t: ndarray
- class moro.trajectory.PositionTrajectory(t: ndarray, p: ndarray, v: ndarray, a: ndarray, method: str)[source]
Bases:
objectNumerical Cartesian-position trajectory sampled at explicit times.
- a: ndarray
- property duration
- method: str
- p: ndarray
- property samples
- t: ndarray
- v: ndarray
- class moro.trajectory.TrapezoidalProfileInfo(kind: str, t_accel: float, t_cruise: float, t_decel: float, duration: float, minimum_duration: float | None, peak_path_speed: float, path_acceleration: float)[source]
Bases:
objectGeneration metadata for a synchronized, sampled trapezoidal motion.
Velocities and accelerations describe the dimensionless progress coordinate s(t), not an individual joint. This object cannot resample the trajectory and does not track subsequent edits to trajectory arrays.
- duration: float
- kind: str
- minimum_duration: float | None
- path_acceleration: float
- peak_path_speed: float
- t_accel: float
- t_cruise: float
- t_decel: float
- moro.trajectory.joint_trajectory(q0, qf, t, *, method='quintic', qd0=None, qdf=None, qdd0=None, qddf=None)[source]
Generate a numerical point-to-point joint-space trajectory.
- moro.trajectory.joint_trapezoidal_trajectory(q0, qf, *, v_max, a_max, duration=None, t0=0.0, samples=101)[source]
Generate a synchronized rest-to-rest, point-to-point joint trajectory.
The normalized progress s follows a triangular or trapezoidal speed profile. Every joint traces a straight-line path in joint space with shared phase times. Limits are applied independently to each coordinate and the shortest feasible duration within this profile family is used unless a larger duration is requested.
Initial/final velocities are zero. Acceleration is piecewise constant and its value at phase changes uses the right-hand phase, except for the final time (left-hand phase). No jerk or dynamic feasibility guarantee is implied. Only stationary moves may use a prescribed zero displacement.
- moro.trajectory.joint_waypoint_trajectory(waypoints, waypoint_times, *, method='quintic', derivative_policy='zero', velocities=None, accelerations=None, sample_times=None, samples_per_segment=None)[source]
Generate piecewise linear, cubic or quintic joint-space trajectories.
The ‘zero’ policy stops at every waypoint unless complete derivative arrays are provided. The cubic-only ‘shape_preserving’ policy estimates interior velocities, with zero velocities at both global endpoints.
- moro.trajectory.position_trajectory(p0, pf, t, *, method='quintic', v0=None, vf=None, a0=None, af=None)[source]
Generate a numerical point-to-point Cartesian position trajectory.
- moro.trajectory.position_waypoint_trajectory(waypoints, waypoint_times, *, method='quintic', derivative_policy='zero', velocities=None, accelerations=None, sample_times=None, samples_per_segment=None)[source]
Generate piecewise polynomial Cartesian-position trajectories.
Cartesian waypoints and derivative matrices must have shape (K, 3). The cubic-only ‘shape_preserving’ policy estimates coordinate-wise interior velocities and rests at both endpoints.