Minimum Jerk and Snap Trajectory Optimization: Codebase Structure and Execution Guide
Project Structure Overview
The system is organized into a set of headers and source files responsible for mathematical optimization and ROS integration:
- min_snap_optimizer.h: Defines the
MinSnapOptimizerclass, which exposes thecalculateClosedFormCoeffs()method to compute the polynomial coefficients for the trajectory segments via Quadratic Programming. - min_snap_optimizer.cpp: Implements the closed-form QP solver. The primary output is the
coeff_matrix, containing the solved polynomial parameters which can be printed to the console or broadcasted. - trajectory_manager.h: Declares the
TrajectoryManagerclass, encapsulating utilities for processing coefficients, path computation, and ROS topic publishing. Its methods includeretrieveCoefficients(),generatePath(),broadcastTrajectory(),fetchParameters(), andevaluatePolyPosition(). - trajectory_manager.cpp: Contains the implementation of
broadcastTrajectory()for transmitting the generated path over ROS networks. - main_entry.cpp: Initializes the ROS node, instantiates the manager, and initiates the topic publication loop.
Execution and Environment Setup
Clone the repository and attempt the initial build:
cd traj_opt_workspace
catkin_make
If the compiler fails due to missing Eigen/Dense, install the linear algebra library:
sudo apt-get install libeigen3-dev
Post-installation, the system typically places headers under /usr/include/eigen3. Because the build system expects direct access to Eigen and unsupported directories, create symbolic links to resolve the path discrepancy. Verify the installation directory before executing:
cd /usr/include
sudo ln -sf eigen3/Eigen Eigen
sudo ln -sf eigen3/unsupported unsupported
Re-run the build process to compile successfully. Trajectory constraints, including waypoint coordinates and segment durations, are defined within the config.yaml file.
Launch the optimization node using the following command:
roslaunch min_snap_planner start_planner.launch
To inspect the output data stream, monitor the dedicated ROS topic:
rostopic echo /optimized_trajectory