Skip to content

Refactor quintic optimizer into a pure 2D backend#2

Open
zefew6 wants to merge 5 commits intoMarineRock10:mainfrom
zefew6:feature/quintic-2d
Open

Refactor quintic optimizer into a pure 2D backend#2
zefew6 wants to merge 5 commits intoMarineRock10:mainfrom
zefew6:feature/quintic-2d

Conversation

@zefew6
Copy link
Copy Markdown

@zefew6 zefew6 commented Mar 17, 2026

  • switch the planner backend to quintic splines with per-segment time variables and acceleration-aware penalties

  • decouple TrajectoryOptimizer from GridMap and A* through pluggable trajectory environment interfaces, including a safe corridor hook and grid map adapter

  • add a pure backend demo and make test_opt save visualization images in headless environments

- switch the planner backend to quintic splines with per-segment time variables and acceleration-aware penalties

- decouple TrajectoryOptimizer from GridMap and A* through pluggable trajectory environment interfaces, including a safe corridor hook and grid map adapter

- add a pure backend demo and make test_opt save visualization images in headless environments
Copilot AI review requested due to automatic review settings March 17, 2026 06:46
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR refactors the trajectory optimization backend to be “pure 2D” by decoupling it from GridMap/A* through a pluggable environment interface, switching the spline backend to quintic with per-segment timing variables, and improving demos for headless visualization output.

Changes:

  • Introduces TrajectoryEnv (with optional SDF + safe-corridor hooks) and a GridMapEnv adapter, and updates the optimizer/demo wiring to use it.
  • Refactors TrajectoryOptimizer to use quintic splines, add acceleration-aware penalties/metrics, and optimize per-segment time variables.
  • Adds a pure-backend demo executable and updates test_opt visualization to save PNGs in headless environments.

Reviewed changes

Copilot reviewed 6 out of 7 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/test_opt.cpp Saves visualizations to PNG and updates optimizer construction to use GridMapEnv; adds accel metric printing.
src/test_backend.cpp New pure-backend demo using SafeCorridorEnv without GridMap/A*.
include/perception_tool/grid_map_env.hpp Adds GridMapEnv adapter implementing TrajectoryEnv from GridMap SDF/gradient.
include/backend_tool/traj_opt.hpp Refactors optimizer API to accept TrajectoryEnv, switches to quintic spline backend, adds per-segment timing + accel/corridor penalties & metrics.
include/backend_tool/traj_env.hpp Defines TrajectoryEnv interface and SafeCorridorEnv implementation.
CMakeLists.txt Adds test_backend executable.
.gitignore Ignores build/ and *.png.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

Comment on lines +205 to +206
cv::imwrite(output_path, img);
std::cout << "Saved visualization to " << output_path << std::endl;
Comment on lines +485 to +488
std::cout << "Cost breakdown - Vel: " << v_cost
<< ", Acc: " << a_cost
<< ", Coll: " << occ_cost
<< ", Corridor: " << corridor_cost << std::endl;
Comment on lines 109 to 111
params.piece_len = astar_traj.total_length / astar_traj.total_time;
params.total_time = astar_traj.total_time;
params.total_len = astar_traj.total_length;
zefew6 added 4 commits March 17, 2026 15:06
- replace the local spline core with the latest version from Bziyue/SplineTrajectory

- adapt the quintic optimizer to the new trajectory, energy-gradient, and propagateGrad interfaces

- keep the 2D pure-backend planner flow compiling and running with the updated spline backend
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants