Hi,
We have developed and tested tilt quad copter, two dimensional vectored thrust machines from ArduCopter.
It works well.
Servo motors are used to tilt rotors or deflection nozzle.
In those source code, first, we add the code as
add_motor_raw(AP_MOTORS_MOT_5, 0.0f, 0.0f, 0.0f, 5);
add_motor_raw(AP_MOTORS_MOT_6, 0.0f, 0.0f, 0.0f, 6);
for servo motor which are connected to Pixhawk.
Then, set output PWM value as
// elevator and rudder
motor_out[LeftPlate] = LeftTrim+_thrust_rpyt_out[7];
motor_out[RightPlate] = RightTrim+_thrust_rpyt_out[7];
After, they are output as
// send output to each motor
for (i=0; i<AP_MOTORS_MAX_NUM_MOTORS; i++) {
if (motor_enabled[i]) {
rc_write(i, motor_out[i]);
}
}
https://github.com/ZetaMiw/ardupilot/blob/Copter-3.6/libraries/AP_Motors/AP_MotorsMatrix.cpp
This way succeeded to output pwm signals.
But in this way, we must build every time when we want to set new trim pwm values.
So, we want to use SRV_Channels.
We tried as:
// right servo defaults to servo output 5
SRV_Channels::set_aux_channel_default(SRV_Channel::k_tiltMotorRight, CH_5);
// left servo defaults to servo output 6
SRV_Channels::set_aux_channel_default(SRV_Channel::k_tiltMotorLeft, CH_6);
…
SRV_Channels::set_output_pwm_trimmed(SRV_Channel::k_tiltMotorLeft,_thrust_rpyt_out[7]);
SRV_Channels::set_output_pwm_trimmed(SRV_Channel::k_tiltMotorRight,_thrust_rpyt_out[7]);
…
SRV_Channels::calc_pwm();
SRV_Channels::output_ch_all();
We used Mission Planner : Servo output to check/set servo function.
But, 5ch and 6ch always output 1100usec.
I think that it lacks to activate servo motors.
Please give me some help.