Video available at https://www.youtube.com/watch?v=GrKxC1hDQOI
Follow the guide at https://docs.px4.io/main/en/dev_setup/dev_env_windows_wsl.html.
Follow the guide at https://docs.px4.io/main/en/contribute/git_examples.html#get-a-specific-release, or
- Clone PX4-Autopilot repository and navigate to the directory
git clone https://github.com/PX4/PX4-Autopilot.git
cd ~/PX4-Autopilot
- Check out code for desired tag
git checkout v1.13.2
- Update submodules
make submodulesclean
- Install Dependencies
cd ~
bash ./PX4-Autopilot/Tools/setup/ubuntu.sh
- Restart WSL2
exit
wsl --shutdown
wsl
- Install Dependencies
sudo apt-get install protobuf-compiler libeigen3-dev libopencv-dev -y
- Build PX4 SITL
cd ~/PX4-Autopilot
make px4_sitl
Follow the guide at https://docs.px4.io/main/en/ros/mavros_installation.html, or
- Retrieve the latest package lists and install
sudo apt update
sudo apt upgrade
- Setup ROS sources list
sudo sh -c 'echo "deb http://packages.ros.org/ros/ubuntu $(lsb_release -sc) main" > /etc/apt/sources.list.d/ros-latest.list'
- Setup the keys
sudo apt install curl # if you haven't already installed curl
curl -s https://raw.githubusercontent.com/ros/rosdistro/master/ros.asc | sudo apt-key add -
- Install ROS
sudo apt install ros-noetic-desktop-full
- Setup environment
echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
source ~/.bashrc
- Install and initialized dependencies
sudo apt install python3-rosdep python3-rosinstall python3-rosinstall-generator python3-wstool build-essential
sudo apt install python3-rosdep
sudo rosdep init
rosdep update
- Install ROS python tools
sudo apt-get install python3-catkin-tools python3-rosinstall-generator -y
- Create ROS workspace folder
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws
catkin init
wstool init src
- Install MAVLink
# We use the Kinetic reference for all ROS distros as it's not distro-specific and up to date
rosinstall_generator --rosdistro kinetic mavlink | tee /tmp/mavros.rosinstall
- Install MAVROS with source installation
rosinstall_generator --upstream mavros | tee -a /tmp/mavros.rosinstall
Modify the "version" tag of MAVROS entry in ~/catkin_ws/src/.rosinstall to make it look like below:
- git:
local-name: mavlink
uri: https://github.com/mavlink/mavlink-gbp-release.git
version: release/kinetic/mavlink/2021.3.3-1
- git:
local-name: mavros
uri: https://github.com/mavlink/mavros.git
version: 1.16.0
Then install the dependency:
wstool merge -t src /tmp/mavros.rosinstall
wstool update -t src -j4
cd catkin_ws/src
git clone https://github.com/pal-robotics/gazebo_ros_link_attacher.git
cd ..
catkin build
cd ~/catkin_ws/src
git clone https://github.com/ANCL/double_sls_controller.git --recursive
cd ..
catkin build
sudo cp ~/catkin_ws/src/double_sls_controller/scripts/attach_sls.py ~/catkin_ws/src/gazebo_ros_link_attacher/scripts/attach_sls.py
chmod +x ~/catkin_ws/src/gazebo_ros_link_attacher/scripts/attach_sls.py
sudo apt install xmlstarlet
sudo vim ~/.bashrc
add following contents:
# For ROS Noetic
source /opt/ros/noetic/setup.bash
source ~/catkin_ws/devel/setup.bash
# For Gazebo 11
export GAZEBO_PLUGIN_PATH=$GAZEBO_PLUGIN_PATH:/usr/lib/x86_64-linux-gnu/gazebo-11/plugins
export GAZEBO_MODEL_PATH=$GAZEBO_MODEL_PATH:~/catkin_ws/src/double_sls_controller/models
# For PX4 v1.13.2
source ~/PX4-Autopilot/Tools/setup_gazebo.bash ~/PX4-Autopilot ~/PX4-Autopilot/build/px4_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/PX4-Autopilot
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:~/PX4-Autopilot/Tools/sitl_gazebo
Preparations
# in a new terminal
sudo usermod -a -G dialout $USER
sudo apt-get remove modemmanager -y
sudo apt install gstreamer1.0-plugins-bad gstreamer1.0-libav gstreamer1.0-gl -y
sudo apt install libqt5gui5 -y
sudo apt install libfuse2 -y
Download QGC AppImage
# in a new terminal
cd ~
wget https://d176tv9ibo4jno.cloudfront.net/latest/QGroundControl.AppImage
Install and run
chmod +x ./QGroundControl.AppImage
./QGroundControl.AppImage
Enable virtual joystick:
Important: Cannot takeoff without this step!
Application Settings > General > Check the Virtual Joystick checkbox.
# in a new terminal
roslaunch double_sls_controller double_px4vision_sls_world.launch
Note: There's a known graphical problem where one of the drones' graphic model is not generated properly in the Gazebo GUI. Please relaunch if this happens.
# in a new terminal
rosrun gazebo_ros_link_attacher attach_sls.py
# in a new terminal
cd
./QGroundControl.AppImage
# in a new terminal
roslaunch double_sls_controller double_sls_node.launch
Note: Sometimes the two drones may not switch mode and arm together. Please try relaunching if that happens.
# in a new terminal
rosrun rqt_reconfigure rqt_reconfigure
- Move sliders to change gains and references
- Check tick-box "dea_preintegrate_enabled" to let controller states converge
- Check tick-box "dea_enabled" to enable DEA
- Check tick-box "mission_enabled" to start set-point and trajectory tracking mission
