On a companion computer I have a connection to Rover 4.2.1
I request a stream like this;
#define CC_SYSID 2
#define CC_COMPID 200
void mavlink_Request_Data()
{
mavlink_message_t msg;
uint8_t buf[MAVLINK_MAX_PACKET_LEN];
const int maxStreams = 1;
const uint8_t MAVStreams[maxStreams] = {MAV_DATA_STREAM_RC_CHANNELS};
const uint16_t MAVRates[maxStreams] = {0x01};
for (int i=0; i < maxStreams; i++) {
mavlink_msg_request_data_stream_pack(CC_SYSID, CC_COMPID, &msg, 1, 0, MAVStreams[i], MAVRates[i], 1);
uint16_t len = mavlink_msg_to_send_buffer(buf, &msg);
ardupilotPort.write(buf, len);
}
}
and I receive like this;
void mavlink_receive() {
mavlink_message_t msg;
mavlink_status_t status;
while(ardupilotPort.available()>0) {
uint8_t c = ardupilotPort.read();
if(mavlink_parse_char(MAVLINK_COMM_0, c, &msg, &status)) {
Serial.println(msg.msgid);
// Handle message
switch(msg.msgid) {
case MAVLINK_MSG_ID_RC_CHANNELS_RAW:
{
mavlink_rc_channels_raw_t rc_channels_raw;
mavlink_msg_rc_channels_raw_decode(&msg, &rc_channels_raw);
Serial.println("CHANNEL RAW");
}
break;
default:
break;
}
}
}
Where ardupilotPort is the UART the Pixhawk is connected to.
The only thing I am getting now is a msg.msgid == 66 which is a MAVLINK_MSG_ID_REQUEST_DATA_STREAM message.
How do I get the raw RC channels data?
Thanks.