Trajectory¶
TimeOptimalParameterizer¶
TimeOptimalParameterizer(max_velocity: np.ndarray, max_acceleration: np.ndarray)
¶
Time-optimal trajectory parameteriser with fixed joint limits.
Instantiate once per robot (limits are cached), then call
:meth:parameterize on every path. The parameteriser itself holds
no state between calls — it is safe to reuse across threads so long
as the limits do not change.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
max_velocity
|
ndarray
|
|
required |
max_acceleration
|
ndarray
|
|
required |
Source code in wheelchair_planning/trajectory/parameterization.py
parameterize(path: np.ndarray, velocity_scaling: float = 1.0, acceleration_scaling: float = 1.0) -> Trajectory
¶
Convert a piecewise-linear joint-space path into a time-optimal trajectory.
TOPP-RA runs on a natural cubic spline through the supplied waypoints, so the result passes through every waypoint with continuous velocity and bounded acceleration.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
path
|
ndarray
|
|
required |
velocity_scaling
|
float
|
Scalar in |
1.0
|
acceleration_scaling
|
float
|
Scalar in |
1.0
|
Returns:
| Name | Type | Description |
|---|---|---|
A |
Trajectory
|
class: |
Raises:
| Type | Description |
|---|---|
ValueError
|
If |
Source code in wheelchair_planning/trajectory/parameterization.py
Convenience function¶
parameterize_path(path: np.ndarray, max_velocity: np.ndarray, max_acceleration: np.ndarray) -> Trajectory
¶
One-shot helper that builds a :class:TimeOptimalParameterizer
and immediately calls :meth:parameterize on path.
Prefer the class form when you are going to re-use the limits — it avoids revalidating them on every call.
Source code in wheelchair_planning/trajectory/parameterization.py
Trajectory¶
Trajectory(_handle: Any)
dataclass
¶
A time-optimal trajectory produced by
:class:~wheelchair_planning.trajectory.TimeOptimalParameterizer.
Instances are immutable handles around a concrete timing backend;
query them via :meth:position, :meth:velocity,
:meth:acceleration, or one of the batch samplers.
duration: float
property
¶
Trajectory duration in seconds.
position(t: float) -> np.ndarray
¶
Configuration at time t (seconds), clamped to [0, duration].
velocity(t: float) -> np.ndarray
¶
acceleration(t: float) -> np.ndarray
¶
sample(times: np.ndarray) -> tuple[np.ndarray, np.ndarray, np.ndarray]
¶
Sample at the user-supplied times grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
times
|
ndarray
|
|
required |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray, ndarray]
|
|
Source code in wheelchair_planning/trajectory/trajectory.py
sample_uniform(dt: float) -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]
¶
Uniformly-spaced rollout at step dt.
The returned times always start at 0 and end at
:attr:duration, which may make the final step shorter than
dt — this matches what a streaming controller expects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dt
|
float
|
Sample interval in seconds (must be |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
|
ndarray
|
|
ndarray
|
|
Source code in wheelchair_planning/trajectory/trajectory.py
KinodynamicTrajectory¶
KinodynamicTrajectory(_handle: '_FlatTrajectory')
dataclass
¶
A dynamically feasible trajectory produced by FLASK planning.
Instances are immutable handles around a C++ piecewise-cubic
trajectory; query them via :meth:position, :meth:velocity,
:meth:acceleration, or one of the batch samplers.
duration: float
property
¶
Trajectory duration in seconds.
num_dof: int
property
¶
Active DOF of the planner that produced the trajectory.
has_base: bool
property
¶
True if the leading three DOF are the mobile base.
num_segments: int
property
¶
Number of closed-form segments (after simplification).
knot_times: np.ndarray
property
¶
Segment boundary times [0, t_1, ..., duration].
segment_kinds: list[str]
property
¶
Per-segment kind: "drive" or "spin" (rotate in place).
segment_gears: list[int]
property
¶
Per-segment base gear: 0 forward, 1 reverse.
position(t: float) -> np.ndarray
¶
Configuration at time t (seconds), clamped to [0, duration].
velocity(t: float) -> np.ndarray
¶
Active-DOF velocity at time t (world-frame for the base).
acceleration(t: float) -> np.ndarray
¶
Active-DOF acceleration at time t (world-frame for the base).
base_twist(t: float) -> np.ndarray
¶
Body-frame base command (v, omega) at time t.
v is the signed forward speed (negative when reversing) and
omega the yaw rate. Zero for arm-only trajectories.
Source code in wheelchair_planning/trajectory/kinodynamic.py
sample(times: np.ndarray) -> tuple[np.ndarray, np.ndarray, np.ndarray]
¶
Sample at the user-supplied times grid.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
times
|
ndarray
|
|
required |
Returns:
| Type | Description |
|---|---|
tuple[ndarray, ndarray, ndarray]
|
|
Source code in wheelchair_planning/trajectory/kinodynamic.py
sample_uniform(dt: float) -> tuple[np.ndarray, np.ndarray, np.ndarray, np.ndarray]
¶
Uniformly-spaced rollout at step dt.
The returned times always start at 0 and end at
:attr:duration, which may make the final step shorter than
dt — this matches what a streaming controller expects.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dt
|
float
|
Sample interval in seconds (must be |
required |
Returns:
| Type | Description |
|---|---|
ndarray
|
|
ndarray
|
|
ndarray
|
|
Source code in wheelchair_planning/trajectory/kinodynamic.py
sample_base_twist(times: np.ndarray) -> np.ndarray
¶
Body-frame base commands (v, omega) at each time, (T, 2).