Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jaeyoung-lim/px4-mpc
MPC implementation using acados integrated with with PX4 on ROS2
https://github.com/jaeyoung-lim/px4-mpc
drones mpc px4 robotics ros2
Last synced: 5 days ago
JSON representation
MPC implementation using acados integrated with with PX4 on ROS2
- Host: GitHub
- URL: https://github.com/jaeyoung-lim/px4-mpc
- Owner: Jaeyoung-Lim
- License: bsd-3-clause
- Created: 2022-05-29T13:41:25.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2025-01-07T08:48:22.000Z (15 days ago)
- Last Synced: 2025-01-07T09:38:41.501Z (15 days ago)
- Topics: drones, mpc, px4, robotics, ros2
- Language: Python
- Homepage:
- Size: 66.4 KB
- Stars: 58
- Watchers: 3
- Forks: 12
- Open Issues: 3
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# px4-mpc
This package contains an MPC integrated with with [PX4 Autopilot](https://px4.io/) and [ROS 2](https://ros.org/).The MPC uses the [acados framework](https://github.com/acados/acados)
![mpc_setpoint](https://github.com/Jaeyoung-Lim/px4-mpc/assets/5248102/35dae5bf-626e-4272-a552-5f5d7e3c04cd)
## Setup
The MPC formulation uses acados. In order to install acados, follow the following [instructions](https://docs.acados.org/installation/)
To build the code, clone the following repositories into a ros2 workspace
Dependencies
- [px4_msgs](https://github.com/PX4/px4_msgs/pull/15)
- [px4-offboard](https://github.com/Jaeyoung-Lim/px4-offboard) (Optional): Used for RViz visualization```
colcon build --packages-up-to px4_mpc
```### Testing demos
```
ros2 run px4_mpc quadrotor_demo
```### Running MPC with PX4 SITL
In order to run the SITL(Software-In-The-Loop) simulation, the PX4 simulation environment and ROS2 needs to be setup.
For instructions, follow the [documentation](https://docs.px4.io/main/en/ros/ros2_comm.html)Run PX4 SITL
```
make px4_sitl gazebo
```Run the micro-ros-agent
```
micro-ros-agent udp4 --port 8888
```In order to launch the mpc quadrotor in a ros2 launchfile,
```
ros2 launch px4_mpc mpc_quadrotor_launch.py
```The mpc_spacecraft_launch.py file includes optional arguments:
- **mode**: Control mode (wrench by default). Options: wrench, rate, direct_allocation.
- **namespace**: Spacecraft namespace ('' by default).
- **setpoint_from_rviz**: Use RViz for setpoints (True by default).**Example:**
```bash
ros2 launch px4_mpc mpc_spacecraft_launch.py mode:=wrench namespace:= setpoint_from_rviz:=False
```