Using actuator_control group 1 in vtol and mixer

Hey everyone,

I’m working from stable 1.8.2

I am making a custom vtol airframe and mixer and am attempting to write my control values to
_actuators_out_1->control[i] for roll, pitch, yaw, and thrust.

In my custom vtol_att_control class

void
Customvtol::fill_actuator_outputs(){
_actuators_out_1->timestamp = hrt_absolute_time();
_actuators_out_1->timestamp_sample = _actuators_mc_in->timestamp_sample;
// roll
_actuators_out_1->control[0] = _actuators_mc_in->control[0] * _mc_roll_weight;
// pitch
_actuators_out_1->control[1] = _actuators_mc_in->control[1] * _mc_pitch_weight;
// yaw
_actuators_out_1->control[2] = _actuators_mc_in->control[2] * _mc_yaw_weight;
// thrust
_actuators_out_1->control[3] = _thrust;  
}

In my mixer I would like to then use that actuator group instead of group 0.

In my CustomMixer::mix(…) I then want to grab the control from group 1 instead of group 0. (assume this is a near exact copy of the mix_multirotor.cpp)

float		roll    = math::constrain(get_control(1, 0) * _roll_scale, -1.0f, 1.0f);
float		pitch   = math::constrain(get_control(1, 1) * _pitch_scale, -1.0f, 1.0f);
float		yaw     = math::constrain(get_control(1, 2) * _yaw_scale, -1.0f, 1.0f);
float		thrust  = math::constrain(get_control(1, 3), 0.0f, 1.0f);

But I just get 0s for these control values.

Everything works fine if I use _actuators_out_0->control[i] and get_control(0, i) instead.

From the logs it looks like vtol_att_control is correctly writing values to the topic actuators_out_1.

Plot of actuator_controls_1.control[3]

So my guess is the problem is in the get_control() function in the mixer file mixer_multirotor.cpp. I guess that doesn’t have access to the other actuator_control groups?

Hello @dlwalter ,

This is strange since get_control is just a helper to the control callback and that control callback is also use in mixer_simple.cpp and works with group 1. I’m a bit surprised however that mixer_simple.cpp doesn’t use get_control(...).
Try to directly use the callback like in mixer_simple.cpp and if it works, I can have a look to understand what’s wrong with get_control.

Thanks, I’ll give that a shot and see if I can get it working.

Let me know if you find anything with get_control.