GitHunt
AS

astomodynamics/casadi_mpc

This package implements a Model Predictive Control (MPC) node using CasADi in a ROS2 environment.

CasadiMPCNode ROS2 Package

This package implements a Model Predictive Control (MPC) node using CasADi for optimization in a ROS2 environment.

Prerequisites

  • ROS2 (tested with Humble)
  • Python 3.10+
  • CasADi
  • NumPy

Installation

  1. Create a ROS2 workspace if you haven't already:

    mkdir -p ~/ros2_ws/src
    cd ~/ros2_ws/src
    
  2. Clone this package into your workspace:

    git clone https://github.com/astomodynamics/casadi_mpc.git
    
  3. Install the required Python packages:

    cd casadi_mpc
    pip install -r requirements.txt
    
  4. Build the ROS2 package:

    cd ~/ros2_ws
    colcon build --packages-select casadi_mpc
    
  5. Source the setup file:

    source ~/ros2_ws/install/setup.bash
    

Usage

  1. Run the CasadiMPCNode:

    ros2 run casadi_mpc casadi_mpc
    
  2. The node subscribes to the /robot_id/pose topic for state updates, the /robot_id/goal_pose topic for goal updates, and publishes control inputs to the /robot_id/cmd_vel topic.

Customization

  • Adjust MPC parameters in the CasadiMPCNode.__init__ method.
  • Modify the system model in setup_mpc method to match your specific use case.

Contributing

Contributions to improve the package are welcome. Please feel free to submit pull requests or open issues for bugs and feature requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Languages

Python100.0%

Contributors

MIT License
Created August 24, 2024
Updated November 19, 2025
astomodynamics/casadi_mpc | GitHunt