This repo was initially considered to implement an MPC controller along with PX4 firmware (hence its name). However, this has evolved to the more general case where any controller outputting motor thrusts (or motor speed) can be implemented.
In case one wants to implement its own controller he/she only needs to create a derived class from the derived controller overwritting the necessary methods and properties.
Follow this installation link. Then:
cd path/to/the/FastRTPS
mkdir build && cd build
cmake -DTHIRDPARTY=ON -DSECURITY=ON ..
make -j6
sudo make install
Follow this installation link. Then:
cd path/to/the/FastRTPSGen
gradle assemble
gradle install
Note: when doing gradle install
, sudo
might be required. If that is the case, when doing sudo gradle install
, gradle might not be in the sudoer PATH. If this is the case do: sudo path/to/gradle/executable install
, usually: sudo /opt/gradle/gradle-6.2.2/bin/gradle install
.
cd path/to/the/PX4Firmware
make px4_sitl_rtps
ROS2 Dashing is required (install link).
Then
- Create the message inside the folder msgs of PX4
- List it in the
CMakeLists.txt
inside the folder msgs of PX4 - List in the
/Firmware/msg/tools/uorb_rtps_message_ids.yaml
file so that it can be translated to FastRTPS - Build PX4 with RTPS enabled (see above)
See the given example code: `example_controller.cpp