ROS (Robot Operating System) can be used with PX4 and the Gazebo simulator. It uses the MAVROS MAVLink node to communicate with PX4.
Before coming to ROS with Gaszebo Simulation you need prior setting.You can find here Autonomous_Quadcopter
- Linux: Development Environment on Linux (Ubuntu 16.04) > jMAVSim/Gazebo Simulation
To install the Gazebo7 and Gazebo/jMAVSim simulators:
- Download ubuntu_sim.sh.
- Run the script in a bash shell:
source ubuntu_sim.sh
To install the development toolchain:
- Download ubuntu_sim_ros_gazebo.sh.
- Run the script in a bash shell:
source ubuntu_sim_ros_gazebo.sh
mkdir -p ~/src
cd ~/src
git clone https://github.com/pkyadav73199/Firmware.git
cd Firmware
git submodule update --init --recursive
cd ~/src/Firmware
./Tools/setup/ubuntu.sh --no-sim-tools --no-nuttx
sudo apt install gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly libgstreamer-plugins-base1.0-dev
cd ~/src/Firmware
make px4_sitl gazebo
- Start ROS master as mentioned above
- Start gazebo
cd ~/src/Firmware
make px4_sitl gazebo
- Launch px4 with mavros
roslaunch mavros px4.launch fcu_url:="udp://:14540@127.0.0.1:14540"
- Running ros node for created task
cd ~/catkin_ws
source ./devel/setup.bash
rosrun offb uav