Files
Main/99 Work/0 OneSec/OneSecNotes/10 Projects/PX4/Payload Controller.md
2024-12-02 15:11:30 +01:00

1.6 KiB

The first quick and dirty implementation was done on the companion computer using a ROS2 Node (see Direct Actuator Control from ROS2). But this will use too much bandwidth on the datalink between the flight controller and the companion computer.

PX4 Implementation

We want to be able to open and close the payload bay even if the drone is not armed. Therefore, we need to make use of the pre-arm state that exists in order to check the functionality of non-dangerous Actuators (e.g. control surfaces. not motors/propellers). The arm, disarm and pre-arm configuration is explained on the PX4 user guide. We want the following parameters:

Parameter Description Value
COM_PREARM_MODE ALWAYS 2
CBRK_IO_SAFETY No Safety Switch 22027
This puts the drone into the pre-arm state upon boot and allows to move the control surfaces immediately, without engaging the propellers.

PWM Calibration

The payload servos should be calibrated like any other servo motor. We need to configure the following parameters (assuming the servo is MAIN_5):

Parameter Description Value
PWM_MAIN_DIS5 PWM value in disarm state e.g. 1500
PWM_MAIN_FAIL5 PWM Value in failsafe state e.g 1500
PWM_MAIN_MAX5 Maximum PWM value commanded e.g. 1958
PWM_MAIN_MIN5 Minimum PWM value commanded e.g. 867
The values are usually experimentally measured using a simple PWM controller (aka. servo tester).

Payload Controller Module