Companion Computer
Last updated
Was this helpful?
Last updated
Was this helpful?
This section introduces how to set up the (on-board) companion computer for PX4-based drones.
Connect onboard computer and Pixhawk flight controller via an FTDI Chip USB-to-serial adapter.
use the TELEM2
port on Pixhawk and a USB port on companion computer
make sure the FTDI chip or logic level shifter is compatible in our use case
see for recommended ones (Pixdev discontinued though)
make sure the pin-to-pin connection is correct
out of 6 pins, 3 pins must be connected (TX-RX, RX-TX, GND-GND)
the red power pin must not be connected
CTS and RTS pins are optional; for the use of so called "flow control" for Pixhawk
see for the full wiring table
It is recommended that the FTDI chip operates at 3.3V, but not required
the red power pin is not connected anyway
according to in PX4 docs, all Pixhawk serial ports operate at 3.3V and are 5V level compatible.
Example:
warning: this product is not a ready-to-go adapter; need to switch RX and TX cables (cut them off and then solder together)
see for a quick recap about soldering two wires together
soldering quality can also affect the performance; bad soldering will lead to high noise level in the communication
the connection link is: computer --- USB port --- USB to micro USB cable --- micro USB port --- FTDI chip --- 6-pin JST port --- JST cable --- 6-pin TELEM2 port --- Pixhawk
Need to prepare a high-speed low-latency WiFi router
edit settings to shrink DHCP range and leave a range of IP addresses unused for static IP
in my case, I use 192.168.0.21
for onboard computer and 192.168.0.121
for gcs computer
Need to enable MAVLink on a configurable serial port (typically TELEM2
).
Connect the Pixhawk flight controller to QGroundControl via USB or Telemetry (TELEM1), so that you can change parameters in the parameter table and push them to the vehicle.
Set param MAV_1_CONFIG = TELEM 2
(MAV_1_CONFIG is often used to map the TELEM 2 port)
Reboot the vehicle to make other parameters visible.
Set the remaining parameters if not being set by default.
MAV_1_MODE = Onboard
SER_TEL2_BAUD = 921600
(921600 or higher recommended for applications like log streaming or FastRTPS)
Once this parameter is enabled, when Pixhawk is powered on, it will automatically broadcast messages (drone status) via TELEM2 port. The RX indicator should be flickering accordingly.
Set up a static IP address for WiFi connection
in my case, I use 192.168.0.21
for onboard computer and 192.168.0.121
for gcs computer
optional: edit hosts
file by sudo gedit /etc/hosts
and add item 192.168.0.121 arcs-gcs
udev rule: create a new file at /etc/udev/rules.d/99-pixhawk.rules
with the following content
double check by lsusb
the actual vendor and product ID of the FTDI chip
Add current user to the tty
and dialout
groups to avoid to have to execute scripts as root
Launch file is the same as mavros/launch/px4.launch
except for the following modifications
set fcu_url
to /dev/ttyPixhawk:921600
set gcs_url
to udp://@arcs-gcs:14550
double check if tgt_system
matches MAV_SYS_ID
parameter in PX4 firmware (default 1)
double check if tgt_component
matches MAV_COMP_ID
parameter in PX4 firmware (default 1)
Set up a static IP address for WiFi connection
in my case, I use 192.168.0.21
for onboard computer and 192.168.0.121
for gcs computer
optional: edit hosts
file by sudo gedit /etc/hosts
and add item 192.168.0.21 arcs-robot
optional: set up password-free SSH login by ssh-copy-id arcs@arcs-robot
Download QGroundControl Ubuntu amd64 build (arm architecture is not supported)
run ./QGroundControl
and you can see drone status
it will automatically listen to port 14550 for UDP connections
lsusb
check the vendor ID and product ID of FTDI chip
ls -l /dev/ttyPixhawk
check the read/write permission
use a multi-meter to check voltage level
find a chip that has TX/RX indicators to help debugging
rostopic echo -n1 /diagnostics
rosrun mavros checkid
If TELEM2 port is indeed broadcasting messages, then cat /dev/ttyPixhawk
should print out random symbols/streaming and rostopic echo -n1 /diagnostics
should have RX packages/bytes received.
See for more details.
PX4 docs:
PX4 docs:
PX4 docs:
PX4 docs:
Holybro docs: