| CI status | Debian package |
|
|
|
Multi-drone PX4 SITL setup using Gazebo and ROS2. Generally follows https://docs.px4.io/main/en/sim_gazebo_gz/, but uses custom bringup scripts which serve as a showcase of https://github.com/asherikov/cdinit.
Workspace documentation is at http://www.sherikov.net/px4ws/.
-
Build
px4sitlmaster package. Workspace is designed to be used with https://github.com/asherikov/ccws, but basiccolconbuild should work too. -
Dependencies can be installed with
rosdepexcept a few PX4 python dependencies that are installed with cmake during build step.
- Go to
cloudsmithpackage repo, add new apt source, and run apt update. sudo apt install px4ws--reldebug--allsource /opt/px4ws/px4ws__reldebug__all/setup.bash- Launch as explained below.
- Run
px4sitl.sh -w walls -d 4001 "0,1.0,0,0,0,0" -d 4004 "0,-5.0,0,0,0,0"where-wspecifies world ('default' if not set),-dspecifies a drone model id and its location (x,y,z,r,p,y). Numerical ids can be found in a table at https://docs.px4.io/main/en/sim_gazebo_gz/. px4sitl.shalso supports headless mode, which is enabled by passing-Hflag.- Terminate by closing Gazebo gui, or with
cdinit.sh shutdown.
All components are started using dinit service files located in
px4sitl/cdinit_services/, see https://github.com/davmac314/dinit,
https://github.com/asherikov/cdinit provides a cmake wrapper for dinit and
helper scripts. Shell scripts are primarily used to setup environment and
working directories.
- Start
px4sitl.sh -w walls -d 4001 "0,1.0,0,0,0,0" -d 4004 "0,-5.0,0,0,0,0" - List services
cdinit.sh list | sortto get something like
# dummy "boot" service
[[+] ] cdinit_main
# Gazebo gui
[[+] ] px4sitl_gz_gui (pid: XXX)
# PX4 instances, number after @ symbol is a corresponding system id
[[+] ] px4sitl_px4@0 (pid: XXX)
[[+] ] px4sitl_px4@1 (pid: XXX)
# logging services, cdinit_log helper adds timestamps
[{+} ] cdinit_log@px4sitl_dds_agent (pid: XXX)
[{+} ] cdinit_log@px4sitl_gz_clock (pid: XXX)
[{+} ] cdinit_log@px4sitl_gz_gui (pid: XXX)
[{+} ] cdinit_log@px4sitl_gz_headless (pid: XXX)
[{+} ] cdinit_log@px4sitl_gz_wait (pid: XXX)
[{+} ] cdinit_log@px4sitl_px4@0 (pid: XXX)
[{+} ] cdinit_log@px4sitl_px4@1 (pid: XXX)
# Micro-XRCE-DDS-Agent bridging PX4 and ros2
[{+} ] px4sitl_dds_agent (pid: XXX)
# Gazebo -> ROS2 simulation clock bridge
[{+} ] px4sitl_gz_clock (pid: XXX)
# Gazebo simulation core
[{+} ] px4sitl_gz_headless (pid: XXX)
# Helper service which waits for Gazebo to start
[{+} ] px4sitl_gz_wait
# Dummy "master" service
[{+} ] px4sitl_ros
- Location of the log files depends on environment variables, e.g.,
ROS_LOG_DIRand is printed on startup. - Terminate using
cdinit.sh shutdown. Since all processes are required, termination can also be performed by stopping a particular service, e.g.,cdinit.sh stop --force px4sitl_gz_clock.
protobuferrors like the following could be caused by multiple Gazebo versions installed in parallel:[libprotobuf ERROR google/protobuf/descriptor_database.cc:121] File already exists in database: gz/msgs/pointcloud.proto- PX4 fails during automatic takeoff with "Disarmed by auto preflight disarming": make sure that unused parameters in vehicle command message are set to NaN.
- Is installation of
px4/build/intentional? CMakeLists.txt,package.xmlshould not be installed.