Some code problems in "tailsitter.cpp"

Hello everyone! We are doing the control of a tailsitter nowadays. There are some problems in the code. Hope anyone can give me some advice.

1. The following code does the back transition of the vehicle.

_v_att_sp->pitch_body = M_PI_2_F + _pitch_transition_start + fabsf(PITCH_TRANSITION_BACK + 1.57f) *
				(float)hrt_elapsed_time(&_vtol_schedule.transition_start) / (_params_tailsitter.back_trans_dur * 1000000.0f);
_v_att_sp->pitch_body = math::constrain(_v_att_sp->pitch_body, -2.0f, PITCH_TRANSITION_BACK + 0.2f);

I am puzzling whether _pitch_transition_start ~= -pi/2 ? so the _v_att_sp->pitch_body changes from 0 to pi/2 ? But why the _v_att_sp->pitch_body is constrained in -2.0~0.05 ? I donnot know whether _v_att_sp->pitch_body is described in fixed-wing body frame or mc body frame?

2. The problem about _actuators _out _0 and _actuators _out _1.

The code annotation says that _actuators _out _0 is actuator controls going to the mc mixer. Does it means this?

Motor mixer

Channel 1 connects to the right (starboard) motor.
Channel 2 connects to the left (port) motor.

R: 2- 10000 10000 10000 0

And _actuators _out _1 is actuator controls going to the fw mixer (used for elevons). Does it means this?

Elevons mixer

Channel 5 connects to the right (starboard) elevon.
Channel 6 connects to the left (port) elevon.

M: 2
O: 7500 7500 0 -10000 10000
S: 1 0 10000 10000 0 -10000 10000
S: 1 1 10000 10000 0 -10000 10000

M: 2
O: 7500 7500 0 -10000 10000
S: 1 0 10000 10000 0 -10000 10000
S: 1 1 -10000 -10000 0 -10000 10000

Thank you. Have a nice weekend!

  1. It’s in the MC frame.

  2. Yes actuators 0 is MC and actuators 1 is FW.

Thank you!

I am focusing on the fixed-wing attitude control these days. As my understand of the vtol transition, the attitude setpoints published in tailsitter.cpp are in MC frame, thus they should be convert to FW frame when the sp are used for fw attitude control. But I only find the conversion of estimate attitude, and don’t find where setpoint are converted. Is this an error ?

Buy the way, the log is a bit confusing, the estimate attitude are record in MC frame and setpoints are record in FW frame during horizontal flight?

Yes it is a bit confusing. Right now the conversion to FW frame is done right in the fixedwing attitude controller. This keeps the code simple, but the logs are missing the conversion. We could think about adding some additional topics for logging what the FW controller is actually using, and perhaps sending it to the ground station as well.