GCOPTER Trajectory Optimizer
repository·main·Indexed 23 days ago
https://github.com/zju-fast-lab/gcopterA high-performance multicopter trajectory optimizer utilizing MINCO sparse trajectory representation for real-time, geometrically constrained motion planning. It supports complex dynamics including nonlinear drag effects, non-uniform MINCO variants, and fast iterative region inflation (FIRI) for corridor generation. The project includes a ROS-based GlobalPlanner node for kinodynamic trajectory planning and mockamap, a synthetic environment generator for robotics testing.
What's inside GCOPTER
- mockamap is a simple map generator based on ROS (Robot Operating System). It is used to generate synthetic environments for robotics testing, such as Perlin 3D maps and post2d maps.
What is GCOPTER and MINCO?
mainGCOPTER is an efficient and versatile multicopter trajectory optimizer. It is built upon MINCO, a novel sparse trajectory representation.
Key features include:
- Dynamic Constraints: Supports user-defined state-input constraints for dynamics involving nonlinear drag effects.
- MINCO Variants: Supports non-uniform MINCO for $s=2$, $s=3$, and $s=4$.
- Corridor Generation: Includes modules for fast iterative region inflation (FIRI) for corridor generation.
Install GCOPTER for Global Trajectory Planning
mainTo run the global trajectory planning example, you need to install system dependencies, set the CPU governor to performance mode, and build the project within a ROS workspace.
Prerequisites:
- ROS (Robot Operating System) installed and configured.
libompl-devfor motion planning.cpufrequtilsfor CPU performance management.
Installation Steps:
- Update system and install dependencies.
- Set CPU to performance mode.
- Create a ROS workspace, clone the repository, and build using
catkin_make. - Source the workspace and launch the global planning node.
sudo apt update sudo apt install cpufrequtils sudo apt install libompl-dev sudo cpufreq-set -g performance mkdir ROS; cd ROS; mkdir src; cd src git clone https://github.com/ZJU-FAST-Lab/GCOPTER.git cd .. catkin_make source devel/setup.bash roslaunch gcopter global_planning.launchUse the Global Trajectory Planning Example
mainThe global trajectory planning example provides real-time high-quality corridor and trajectory generation subject to dynamic constraints.
Usage in RViz:
- Relative Height: The angle between the arrow of the 2D Nav Goal and the positive x-axis (red axis) determines the relative height of the goal.
- Triggering Planning: You can repeat the selection of start and goal points to trigger new global planning cycles.
- Observing Results: The solution considers spatial-temporal optimality and vehicle dynamics (including drag effects). You can monitor states like net thrust, tilt angle, and body rate using
rqt_plot.
Customization:
- Physical Parameters: All physical parameters in standard units are modifiable in the configuration file.
- Performance Optimization: To achieve faster computing by using a point-mass model instead of full multicopter dynamics, modify the penalty-functional-relevant code.
Understand the GlobalPlanner workflow
mainThe
GlobalPlanneroperates through a continuous loop of map updates, target acquisition, and trajectory processing:- Map Initialization: The planner subscribes to a
MapTopic(sensor_msgs/PointCloud2). Upon receiving the first valid point cloud, it populates aVoxelMapand applies dilation based onDilateRadius. - Target Acquisition: The planner subscribes to a
TargetTopic(geometry_msgs/PoseStamped). When a new target is received, it calculates a safezGoalbased on the map bounds and dilation, then attempts to plan a path from the current position to this goal. - Trajectory Planning:
- Generates a path using
sfc_gen::planPath. - Creates a convex cover using
sfc_gen::convexCoverand simplifies it withsfc_gen::shortCut. - Optimizes a kinodynamic trajectory using
gcopter::GCOPTER_PolytopeSFCsubject to physical constraints (velocity, tilt, thrust, etc.).
- Generates a path using
- Trajectory Execution/Processing: The
process()method tracks the elapsed time since the trajectory was generated. It uses aFlatnessMapto map the trajectory's state (velocity, acceleration, jerk) back to vehicle control inputs (thrust, quaternion, body rates) and publishes these to the visualizer.
- Map Initialization: The planner subscribes to a
Configure the GlobalPlanner ROS node
mainThe
GlobalPlanneris a ROS-based node for kinodynamic trajectory planning. It is configured using ROS parameters via theConfigstruct. When running the node, you must provide these parameters to define the environment, vehicle physics, and planning constraints.ROS Parameter Keys
Parameter Type Description MapTopicstringThe topic for incoming sensor_msgs/PointCloud2map data.TargetTopicstringThe topic for incoming geometry_msgs/PoseStampedtarget poses.DilateRadiusdoubleRadius used to dilate the voxel map for safety. VoxelWidthdoubleThe size of each voxel in the map. MapBounddouble[6]The bounding box of the map: [x_min, x_max, y_min, y_max, z_min, z_max].TimeoutRRTdoubleTimeout for the RRT planning process. MaxVelMagdoubleMaximum allowable velocity magnitude. MaxBdrMagdoubleMaximum allowable body rate magnitude. MaxTiltAngledoubleMaximum allowable tilt angle. MinThrustdoubleMinimum allowable thrust. MaxThrustdoubleMaximum allowable thrust. VehicleMassdoubleMass of the vehicle. GravAccdoubleGravitational acceleration. HorizDragdoubleHorizontal drag coefficient. VertDragdoubleVertical drag coefficient. ParasDragdoubleParasitic drag coefficient. SpeedEpsdoubleSpeed smoothing factor. WeightTdoubleWeight for the time parameter in optimization. ChiVecdouble[5]Penalty weights for [pos, vel, omg, theta, thrust].SmoothingEpsdoubleSmoothing epsilon for trajectory optimization. IntegralIntervsintNumber of quadrature intervals for integration. RelCostToldoubleRelative cost tolerance for optimization.