SITL
Flight stack
PX4
Simulation environment
Gazebo
proccess communication
ROS
Setup environment for simulation using ROS2 with ePromisa fastrtps as middleware
requirements: mkdir uav cd uav setup px4 toolchain git clone https://github.com/PX4/PX4-Autopilot.git —recursive bash ./PX4-Autopilot/Tools/setup/ubuntu.sh also need ros2 gazebo
fastdds: install foonathan memory
for secure version
after dds install fastrtpsgen for code generation
build ros2(colcon) workspace mkdir -p px4-colcon-ws/src populate src dir with code at bare minimum we need px4-ros-com and it’s dependacny px-msgs git clone https://github.com/PX4/px4_ros_com.git ~/px4_ros_com_ros2/src/px4_ros_com git clone https://github.com/PX4/px4_msgs.git ~/px4_ros_com_ros2/src/px4_msgs
we can also add support for ros1 bridge if needed git clone https://github.com/ros2/ros1_bridge.git -b dashing ~/px4_ros_com_ros2/src/ros1_bridge
Sanity check:
skip ros1_bridge —packages-skip ros1_bridge
verbose —event-handlers console_direct+
for rel —cmake-args -DCMAKE_BUILD_TYPE=RELWITHDEBINFO
generate code for clangd —cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
then we can build colcon build —cmake-args -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_BUILD_TYPE=RELWITHDEBINFO —symlink-install —packages-skip ros1_bridge —event-handlers console_direct+
run the sim make px4_sitl_rtps gazebo