Details on the PX4 Autopilot - Chroma-CITI/DANCERS GitHub Wiki
Nowadays, small-size quadricopters are all composed of two main computing machines : an on-board computer and an autopilot.
An autopilot task is to handle the sensors and actuators of a robot, and to provide the developer with an easy way of controlling the robot. It is a small computer with inputs and outputs, that usually handle motor control, sensor acquisition and sensor fusion, basic collision avoidance, low-level stabilization, etc.
PX4 Autopilot is an open-source project that seeks to develop the best and most agile autopilot, for all sorts of application and robots, from hobby to professional use and for ground, underwater and aerial robots.
For more information, I invite you to visit the excellent PX4 User Guide.
In DANCER, PX4 Autopilot is an important building block. We use its SITL (Software-in-the-Loop) version to mimic the real behavior of an autopilot in simulation.
The rest of this page will focus on the usage of the PX4 Autopilot in DANCER.
For autonomous navigation, the UAV must have a decision-making entity that controls how the UAV moves. This decision-making entity can be a human on the ground (controller), a Ground-Control-Station (a centralized algorithm running on a computer) or onboard (an algorithm running on the companion computer of each drone).
Controlling a quadricopter means giving commands to its (electric) motors. Actually, we give commands to ESC (Electric Speed Controllers) that are in charge of converting it to electric current.
Of course, nobody wants to control the speed of the motors directly, we need a control chain that takes an input a human can grasp and transform it in motor controls.
For the PX4 Autopilot, the control-chain looks like that :
The PX4 Autopilot accepts different levels for offboard control : position
, velocity
, acceleration
and attitude
+body_rate
.
For our setup, the companion computer
will run a program that outputs commands to the PX4 autopilot. Communication between the companion computer
and the autopilot
is made through the Serial link, in the form of MAVLINK messages. Because handling MAVLINK directly is painful, we will use the micro-ROS bridge
offered with PX4 to send commands to the UAV.
The ROS topics are :
-
/<namspace>/fmu/in/offboard_control_mode
: MUST be published faster than 2 Hz to stay in offboard mode (keepalive) It also tells the autopilot which level of command we use, among the following list :- position
- velocity
- acceleration
- attitude
- body_rate Documentation
-
/<namespace>/fmu/in/trajectory_setpoint
: Sends the values of the command. It has several fields that are not all used. Documentation