How to set AUX PWM on Pixhawk with MAVLink (in OFFBOARD mode)

Hello,

I need to control an extra motor for a manipulation task while flying. I can already do this with the RC transmitter passthrough to AUX 1 (by setting RC_MAP_AUX1), but I need to
control the motor autonomously in OFFBOARD mode.

When I set the AUX 1 pulse width with the /mavros/actuator_control MAVROS topic (control group #3) the motor’s motion is very jerky, as if some other process is competing to set the PWM. This problem persists even after disabling the RC passthrough on AUX1. I was looking at rc_update.cpp and it appears to continuously publish the actuator_controls_3 uORB topic (which sets the AUX 1 PWM).

Does this mean it’s impossible to use MAVLink to set the AUX PWM while an RC transmitter is connected to the vehicle?

System Setup

Tricopter with PX4 flight stack (version 1.6.2dev) on Pixhawk (v2) with LPE and Vicon
Motion capture. I have OFFBOARD mode mapped to an RC switch, and am able
to command the vehicle pose with MAVROS (SET_POSITION_TARGET_LOCAL) using either the onboard Odroid XU4 or a Laptop running Ubuntu 14.04 + ROS Indigo.

1 Like

For offboard mode, maybe you can try the set_actuator_control_target message to send four actuators directly.
However, I think it probably has something to do with the firmware in ESC or the driver of the motor since I am not sure that you can send PWM via esc wrapper in PX4.

I am using the SET_ACTUATOR_CONTROL_TARGET mavlink message (via MAVROS’ /mavros/actuator_control topic) to send the actuator commands for control group 3, but I am only setting the control value for AUX 1.

I’m pretty sure it isn’t an ESC firmware problem since the motor runs very smoothly when controlled with the RC passthrough directly. I have also modified the pass.aux.mix file (in /fs/microsd/etc/mixers) to get the right scaling/offset for my ESC. What do you mean by “send PWM via esc wrapper”? Is that the driver that actually generates the PWM for the ESCs?

The control group was ignored and only enabled since: this PR thus This commit

I’m having real trouble sending a mavlink message to the /mavros/actuator_control topic, it seems like it only accepts mavros_msgs/ActuatorControl… did you use mavros_msg/Mavlink objects??