-
Notifications
You must be signed in to change notification settings - Fork 15
Add Forklift dynamics model and parking example #133
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
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.
There was a problem hiding this 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
cddp-cpp/include/cddp-cpp/cddp_core/constraint.hpp
Lines 538 to 556 in 8273c7f
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; | |
} |
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 👎
* 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
* 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
Summary
Implementation Details
Test Results
All unit tests pass, verifying:
Example
The forklift parking example demonstrates successful back-in parking maneuver using MSIPDDP solver.