Unexpected outcome after publishing to actuator_controls_0

Goal

In order to evaluate a mixer-file that I wrote for a coaxial helicopter, I wrote a module to publish messages to the actuator_controls_0 topic. I want to be able to observe if the servos are reacting to a certain flight command like roll or pitch as I expected.

Question

The module I implemented is based on the motor test module. Just instead of publishing messages to test_motor it publishes messages to actuator_controls_0. Unfortunately the module is not working as I expected and I want to know where I am wrong: Is my concept just nonesense and it just can’t be done like this, or did I just mess up the implementation?

Test setup and problem

To test the module, I wrote a very simple mixer file consisting of two simple mixers each of which just “mixes” one flight control input. The first one takes only the pitch as an input and the second one only takes roll as an input. So the mixer file looks like this:

pitch axis
-------------
M: 1
S: 0 1  -10000  -10000      0 -10000  10000

roll axis
-------------
M: 1
S: 0 0  10000  10000      0 -10000  10000

Now I connected one servo to MAIN1 and one servo to MAIN2. So I would expect, that when I publish a message to actuator_controls that has all 0s except for roll that only the MAIN1 servo does something and when I publish a message with only a pitch signal that only the MAIN2 servo moves. However, in both cases both servos move. Actually, it doesn’t matter at all what I publish, in all cases both servos move in the excact same way.

Implementation

As I said before, the module that I implemented is based on the motor_test module. It this function to publish to the actuator_controls_0 topic:

static void servo_test(const float roll, const float pitch, const float yaw, const float throttle)
{
  uORB::Publication<actuator_controls_s>   actuator_controls_0_pub(ORB_ID(actuator_controls_0));
  actuator_controls_s output;
  output.control[actuator_controls_s::INDEX_ROLL]=roll;
  output.control[actuator_controls_s::INDEX_PITCH]=pitch;
  output.control[actuator_controls_s::INDEX_YAW]=yaw;
  output.control[actuator_controls_s::INDEX_THROTTLE]=throttle;
  output.control[actuator_controls_s::INDEX_FLAPS]=0;
  output.control[actuator_controls_s::INDEX_SPOILERS]=0;
  output.control[actuator_controls_s::INDEX_AIRBRAKES]=0;
  output.control[actuator_controls_s::INDEX_LANDING_GEAR]=0;
  output.timestamp = hrt_absolute_time();
  output.timestamp_sample= hrt_absolute_time();
  actuator_controls_0_pub.publish(output);
}

If needed I can also add the full source code of the module. However, I think that there is a major flaw in this and I guess the rest of the code won’t be needed to detect my error.

1 Like