Skip to content

Conversation

astomodynamics
Copy link
Owner

@astomodynamics astomodynamics commented Jul 12, 2025

Summary

  • Implement Forklift dynamics model with rear-steering kinematic bicycle model
  • Add forklift parking example using IPDDP solver
  • Include comprehensive unit tests

Implementation Details

  • Forklift class: 5-state (x, y, theta, v, delta) and 2-control (acceleration, steering_rate) dynamics
  • Autodiff support: Full gradient computation capabilities
  • Constraints: Max acceleration ±1.5 m/s², max steering rate ±0.4 rad/s
  • Cost weights: Bryson-scaled
  • StateConstraint class: Added to handle velocity and steering angle constraints

Test Results

All unit tests pass, verifying:

  • Forward dynamics computation
  • Jacobian calculations
  • Control and state constraint enforcement
  • Proper rear-steering kinematics

Example

The forklift parking example demonstrates successful back-in parking maneuver using MSIPDDP solver.

This commit introduces a new Forklift class in the dynamics model, implementing a kinematic forklift model with rear-wheel steering. The class includes methods for continuous and discrete dynamics, as well as Jacobian and Hessian computations. This addition enhances the CDDP framework by providing a specialized model for forklift dynamics, suitable for warehouse applications.
This commit introduces the Forklift class, implementing a kinematic model for forklifts with rear-wheel steering. It includes methods for discrete dynamics, Jacobian, and Hessian calculations using automatic differentiation. This enhancement provides a specialized dynamics model for forklift applications within the CDDP framework.
This commit updates the CMakeLists.txt to include the newly added Forklift dynamics model source file. This integration ensures that the Forklift class is compiled as part of the project, enabling its use within the CDDP framework.
This commit introduces a new test file for the Forklift dynamics model, implementing various test cases to validate its discrete dynamics, rear-steer behavior, and Jacobian calculations. Additionally, the CMake configuration is updated to include the new test executable, ensuring comprehensive testing within the CDDP framework.
This commit introduces the StateConstraint class, which extends the Constraint base class. It includes methods for evaluating constraints, computing violations, and obtaining Jacobians and Hessians. The class supports upper and lower bounds with scaling, enhancing the constraint handling capabilities within the CDDP framework.
This commit introduces a new example for forklift parking using the IPDDP solver. The implementation includes a ForkliftParkingObjective class for defining the nonlinear objective, a main function to set up the problem, and visualization of the parking maneuver through an animated GIF. Additionally, the CMake configuration is updated to include the new example in the build process.
@astomodynamics astomodynamics merged commit d0427b6 into master Jul 12, 2025
3 checks passed
@astomodynamics astomodynamics deleted the forklift branch July 12, 2025 01:37
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

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

Bug: Incorrect Jacobian Implementations in `StateConstraint`

The StateConstraint class has incorrect Jacobian implementations. The getStateJacobian method incorrectly returns a zero matrix; it should return [-I; I] * scale_factor_ as the constraint g = [-state; state] * scale_factor_ depends on state. Conversely, the getControlJacobian method incorrectly returns the state-dependent Jacobian [-I; I] with wrong dimensions (2*state.size(), state.size()); it should return a zero matrix with dimensions (2*state.size(), control.size()) since the constraint does not depend on control.

include/cddp-cpp/cddp_core/constraint.hpp#L538-L556

Eigen::MatrixXd
getStateJacobian(const Eigen::VectorXd &state,
const Eigen::VectorXd &control) const override
{
return Eigen::MatrixXd::Zero(dim_, state.size());
}
Eigen::MatrixXd
getControlJacobian(const Eigen::VectorXd &state,
const Eigen::VectorXd &control) const override
{
Eigen::MatrixXd jac(2 * state.size(), state.size());
jac.topLeftCorner(state.size(), state.size()) =
-Eigen::MatrixXd::Identity(state.size(), state.size());
jac.bottomRightCorner(state.size(), state.size()) =
Eigen::MatrixXd::Identity(state.size(), state.size());
return jac;
}

Fix in CursorFix in Web


BugBot free trial expires on July 22, 2025
You have used $0.00 of your $10.00 spend limit so far. Manage your spend limit in the Cursor dashboard.

Was this report helpful? Give feedback by reacting with 👍 or 👎

astomodynamics added a commit that referenced this pull request Jul 18, 2025
* Add Forklift dynamics model implementation

* Add Forklift dynamics model to CMake build

* Add unit tests for Forklift dynamics model

* Format constraint.hpp

* Add StateConstraint class to constraint.hpp

* Add forklift parking example with IPDDP solver
astomodynamics added a commit that referenced this pull request Jul 18, 2025
* Add Forklift dynamics model implementation

* Add Forklift dynamics model to CMake build

* Add unit tests for Forklift dynamics model

* Format constraint.hpp

* Add StateConstraint class to constraint.hpp

* Add forklift parking example with IPDDP solver
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.

1 participant