pyroboplan.trajectory package
Trajectory generation and execution module.
This module contains utilities for generating trajectories from paths, executing them at specified times, and visualizing them.
Submodules
pyroboplan.trajectory.polynomial module
Implementations of polynomial trajectories.
- Some good resources:
Video with derivation: https://robotacademy.net.au/lesson/1d-polynomial-trajectory
Chapter 9 of this book: https://hades.mech.northwestern.edu/images/7/7f/MR.pdf
- class pyroboplan.trajectory.polynomial.CubicPolynomialTrajectory(t, q, qd=0.0)
Bases:
PolynomialTrajectoryBaseDescribes a cubic (3rd-order) polynomial trajectory.
- class pyroboplan.trajectory.polynomial.PolynomialTrajectoryBase
Bases:
ABCAbstract base class for polynomial trajectories.
- evaluate(t)
Evaluates the trajectory at a specific time.
- Parameters:
t (float) – The time, in seconds, at which to evaluate the trajectory.
- Returns:
The tuple of (q, qd, qdd, qddd) trajectory values at the specified time. If the trajectory is single-DOF, these will be scalars, otherwise they are arrays.
- Return type:
tuple(array-like or float, array-like or float, array-like or float, array-like or float)
- generate(dt)
Generates a full trajectory at a specified sample time.
- Parameters:
dt (float) – The sample time, in seconds.
- Returns:
The tuple of (t, q, qd, qdd, qddd) trajectory values generated at the sample time. The time vector is 1D, and the others are 2D (time and dimension).
- Return type:
tuple(array-like, array-like, array-like, array-like, array-like)
- visualize(dt=0.01, joint_names=None, show_position=True, show_velocity=False, show_acceleration=False, show_jerk=False)
Visualizes a generated trajectory with one figure window per dimension.
- Parameters:
dt (float, optional) – The sample time at which to generate the trajectory by evaluating the polynomial.
joint_names (list[str], optional) – The joint names to use for the figure titles. If unset, uses the text “Dimension 1”, “Dimension 2”, etc.
show_position (bool, optional) – If true, shows the trajectory position values.
show_velocity (bool, optional) – If true, shows the trajectory velocity values.
show_acceleration (bool, optional) – If true, shows the trajectory acceleration values.
show_jerk (bool, optional) – If true, shows the trajectory jerk values.
- class pyroboplan.trajectory.polynomial.QuinticPolynomialTrajectory(t, q, qd=0.0, qdd=0.0)
Bases:
PolynomialTrajectoryBaseDescribes a quintic (5th-order) polynomial trajectory.
pyroboplan.trajectory.trajectory_optimization module
Utilities for trajectory optimization based planning.
- class pyroboplan.trajectory.trajectory_optimization.CubicTrajectoryOptimization(model, collision_model, options=<pyroboplan.trajectory.trajectory_optimization.CubicTrajectoryOptimizationOptions object>)
Bases:
objectTrajectory optimization based planner.
This uses the direct collocation approach to optimize over waypoint and collocation point placements that describe a multi-segment cubic polynomial trajectory.
- Some good resources include:
Matthew Kelly’s tutorials: https://www.matthewpeterkelly.com/tutorials/trajectoryOptimization/index.html
Russ Tedrake’s manipulation course book: https://underactuated.mit.edu/trajopt.html
- plan(q_path, init_path=None)
Plans a trajectory from a start to a goal configuration, or along an entire trajectory.
If the input list has 2 elements, then this is assumed to be the start and goal configurations. The intermediate waypoints will be determined automatically.
If the input list has more than 2 elements, then these are the actual waypoints that must be achieved.
- Parameters:
q_path (list[array-like]) – A list of joint configurations describing the desired motion.
init_path (list[array-like], optional) – If set, defines the initial guess for the path waypoints.
- Returns:
The resulting trajectory, or None if optimization failed
- Return type:
Optional[pyroboplan.trajectory.polynomial.CubicPolynomialTrajectory]
- class pyroboplan.trajectory.trajectory_optimization.CubicTrajectoryOptimizationOptions(num_waypoints=3, samples_per_segment=11, min_segment_time=0.01, max_segment_time=10.0, min_vel=-inf, max_vel=inf, min_accel=-inf, max_accel=inf, min_jerk=-inf, max_jerk=inf, max_planning_time=30.0, check_collisions=False, collision_link_list=[], min_collision_dist=0.0, collision_influence_dist=0.1, collision_avoidance_cost_weight=0.0)
Bases:
objectOptions for cubic polynomial trajectory optimization.
pyroboplan.trajectory.trapezoidal_velocity module
- class pyroboplan.trajectory.trapezoidal_velocity.TrapezoidalVelocityTrajectory(q, qd_max, qdd_max, t_start=0.0)
Bases:
objectDescribes a trapezoidal velocity profile trajectory.
- Some good resources:
Chapter 9 of this book: https://hades.mech.northwestern.edu/images/7/7f/MR.pdf
MATLAB documentation: https://www.mathworks.com/help/robotics/ref/trapveltraj.html
- evaluate(t)
Evaluates the trajectory at a specific time.
- Parameters:
t (float) – The time, in seconds, at which to evaluate the trajectory.
- Returns:
The tuple of (q, qd, qdd) trajectory values at the specified time. If the trajectory is single-DOF, these will be scalars, otherwise they are arrays.
- Return type:
tuple(array-like or float, array-like or float, array-like or float)
- generate(dt)
Generates a full trajectory at a specified sample time.
- Parameters:
dt (float) – The sample time, in seconds.
- Returns:
The tuple of (t, q, qd, qdd) trajectory values generated at the sample time. The time vector is 1D, and the others are 2D (time and dimension).
- Return type:
tuple(array-like, array-like, array-like, array-like)
- visualize(dt=0.01, joint_names=None, show_position=True, show_velocity=False, show_acceleration=False)
Visualizes a generated trajectory with one figure window per dimension.
- Parameters:
dt (float, optional) – The sample time at which to generate the trajectory. This is needed to produce the position curve.
joint_names (list[str], optional) – The joint names to use for the figure titles. If unset, uses the text “Dimension 1”, “Dimension 2”, etc.
show_position (bool, optional) – If true, shows the trajectory position values.
show_velocity (bool, optional) – If true, shows the trajectory velocity values.
show_acceleration (bool, optional) – If true, shows the trajectory acceleration values.
- class pyroboplan.trajectory.trapezoidal_velocity.TrapezoidalVelocityTrajectorySingleDofContainer
Bases:
objectHelper data structure containing data for a single-dof trapezoidal velocity profile trajectory.
This class should not be used standalone.