mavlink / c_uart_interface_example

Simple MAVLink to UART interface example for *nix systems
264 stars 257 forks source link

Some commands not working #20

Closed ruralguru closed 6 years ago

ruralguru commented 7 years ago

I am utilizing an off-board computer to control the Pixhawk using v3.3.3 firmware The MAVLink documentation states that REQUEST_DATA_STREAM is deprecated and to instead use SET_MESSAGE_INTERVAL. However when I try to utilize the command_long encode to send I get no response as per the following c++ code:

**mavlink_command_long_t com = { 0 }; com.target_system = system_id; com.target_component = autopilot_id; com.command = MAV_CMD_GET_MESSAGE_INTERVAL; com.confirmation = 0; com.param1 = mav_msg_ID; //The MAVLink message ID com.param2 = interval_us; //The interval between two messages, in microseconds. Set to -1 to disable and 0 to request default rate. printf("Sent request for ID#:%.0f to be output every %.0f us\n",com.param1, com.param2);

mavlink_message_t message; mavlink_msg_command_long_encode(system_id, companion_id, &message, &com); //Encode

int len = serial_port->write_message(message); //Send the message return len;**

this is based off the toggle_offboard utilized in c_uart_example code also under mavlink.

I assume this is due to the library being version 1. I tried to add the mavlink_msg_message_interval.h file to the common folder in library 1 however I get no response from the pixhawk. We have tried basemode as 3 and 12. neither likes it The code used for this was based off ned utilizing the encode from inside the particular .h file

Any help would be appriciated as only the deprecated method of requesting data from the pixhawk seems to work.