Skip to content
Batuhan Yumurtaci edited this page Oct 10, 2022 · 3 revisions

Important Links

Installation Steps for PX4 SITL

Clone the PX4 Library

git clone https://github.com/PX4/PX4-Autopilot.git --recursive

Build the standard software-in-the-loop simulation for jmavsim

make px4_sitl jmavsim
Debugging

Some python libraries that might be missing:

pip3 install kconfiglib

pip3 install --user jsonschema

If java error occurs:

sudo apt install default-jdk

Build the standard software-in-the-loop simulation for gazebo

make px4_sitl gazebo
Debugging

Configuring incomplete, errors occurred!

sudo apt install libgstreamer1.0-dev

sudo apt install gstreamer1.0-plugins-good

sudo apt install gstreamer1.0-plugins-bad

sudo apt install gstreamer1.0-plugins-ugly

sudo apt-get install libgstreamer-plugins-bad1.0-dev gstreamer1.0-plugins-good

Running the ROS/Gazebo Simulation

Open QGroundControl

./QGroundControl.AppImage

Start the simulation

make px4_sitl gazebo

Connect to local host with mavros

roslaunch mavros px4.launch fcu_url:="udp://:14540@127.0.0.1:14557"

Take-off

commander takeoff

Running SITL Using the Core Repository

Change .bashrc file !!

cd
nano .bashrc

Roscore running at host computer

export ROS_MASTER_URI=http://localhost:11311/
#export ROS_MASTER_URI=http://192.168.0.227:11311/
source .bashrc

Terminal 1 - Start Gazebo PX4 simulation

cd ~/Repos/PX4-Autopilot/
source Tools/setup_gazebo.bash $(pwd) $(pwd)/build/px4_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)/Tools/sitl_gazebo
make px4_sitl gazebo

Terminal 2 - Data stream to QGroundControl

cd ~/catkin_ws/
roslaunch mavros px4.launch fcu_url:="udp://:14540@127.0.0.1:14557"

Terminal 3 - Start the mission

cd ~/catkin_ws/
source devel/setup.bash
roslaunch state_machine sim_state_machine.launch

Terminal 4 - Repeat the last trajectory (optional)

rosservice call /planner/trigger 1 0 0 0 0.1

Terminal 5 - Data logging (optional)

rosbag record -a

Running Mavros Controllers

Mavros Controllers Repo

Mavros Controllers Forked Repo

# cd <Firmware_directory>
cd ~/Repos/PX4-Autopilot
# source ~/catkin_ws/devel/setup.bash    # (optional)
source Tools/setup_gazebo.bash $(pwd) $(pwd)/build/px4_sitl_default
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)
export ROS_PACKAGE_PATH=$ROS_PACKAGE_PATH:$(pwd)/Tools/sitl_gazebo
mkdir -p ~/catkin_ws/src
cd ~/catkin_ws
catkin init
catkin config --merge-devel
wstool init
cd ~/catkin_ws/src
git clone https://github.com/Jaeyoung-Lim/mavros_controllers
cd ~/catkin_ws/src
git clone https://github.com/catkin/catkin_simple
git clone https://github.com/ethz-asl/eigen_catkin
git clone https://github.com/ethz-asl/mav_comm
cd ~/catkin_ws
catkin build
source ~/catkin_ws/devel/setup.bash

roslaunch geometric_controller sitl_trajectory_track_circle.launch

Deactivate the failsafe

pxh> param set COM_RCL_EXCEPT 4