sudo apt update
sudo apt upgrade
sudo apt install git
git clone <https://github.com/PX4/PX4-Autopilot.git> --recursive
bash ./PX4-Autopilot/Tools/setup/ubuntu.sh
sudo reboot
https://docs.ros.org/en/humble/Installation/Ubuntu-Install-Debians.html
echo "source /opt/ros/humble/setup.bash" >> ~/.bashrc
pip3 install --user -U empy pyros-genmsg setuptools
sudo apt install python3-colcon-common-extensions
sudo apt install ros-humble-desktop python3-argcomplete
sudo apt install ros-dev-tools
git clone [<https://github.com/eProsima/Micro-XRCE-DDS-Agent.git>](<https://github.com/eProsima/Micro-XRCE-DDS-Agent.git>)
cd Micro-XRCE-DDS-Agent
mkdir build
cd build
cmake ..
make
sudo make install
sudo ldconfig /usr/local/lib/
mkdir -p ~/ws_ros2/src/
cd ~/ws_ros2/src/
git clone <https://github.com/PX4/px4_msgs.git>
git clone <https://github.com/PX4/px4_ros_com.git>
cd ..
colcon build
#if failed, re-run the build command
cd ~/PX4-Autopilot
make px4_sitl gz_x500
#for ubuntu20 run -> make px4_sitl gazebo-classic
MicroXRCEAgent udp4 -p 8888
cd ~/ws_ros2
source install/local_setup.bash
ros2 run px4_ros_com offboard_control