Servers by jDrones

RC_CHANNEL_OVERRIDE command doubts

(Gianluca Gregnol) #1

Goodmorning community, i’m trying to fully understand mavlink and i’m facing a problem.

I have a plane that i want to control using arduino by sending command to my PX2 (cube).

The control surfaces are elevons as the model i’m using is the skywalker (see picture below)

To control them i want to use the MAVLINK_MSG_ID_RC_CHANNELS_OVERRIDE #70 as i want to have direct control on their actual angular deflection.

My question are basically 3 :

  1. in the header file related to the message, in the struct of mavlink_rc_channels_override_t is written:

uint16_t chan1_raw; /*… A value of UINT16_MAX means to ignore this field.

Does that mean that i have to write literally UINT16_MAX instead of the channel value if i want to ignore this field?

  1. Are those channels the same that i set with my taranis to manually control the aircraft? is there a way to understand which channel is used or i can just try using the stream from MAV_DATA_STREAM_RC_CHANNELS?

  2. Does the command need any particular aircraft mode to be activated? or i can just recall it and use it as i need?

Right now the function i wrote to recall the command is the following (please note that “x” is placed just to indicate where i will insert the 18 PPM values)

void elevon_control() {

mavlink_message_t msg;
uint8_t buf[MAVLINK_MAX_PACKET_LEN];

mavlink_msg_rc_channels_override_pack_chan(2, 200, &msg, 1,0,x,x,x,x,x,x,x,x,x);
uint16_t len = mavlink_msg_to_send_buffer(buf, &msg);

#ifdef SOFT_SERIAL_DEBUGGING
pxSerial.write(buf, len);
#else
Serial.write(buf, len);
#endif

}

Kind of a long post, but i’d love hear your answers to improve my understanding with mavlink. :blush:
Thanks,
Gianluca