I am using Mavlink protocol (in c++) to communicate with the ArduPilotMega, I am able to read messages such as ATTITUDE for example.
I am currently getting only 2Hz (message rate) and I would like to increase it. I found out that I should use MESSAGE_INTERVAL in order to change it, and that I probably need to use the command
MAV_CMD_SET_MESSAGE_INTERVAL to set it.
So my question is, how do I send that command using mavlink in c++?
I tried doing this with the code below but it did not work, I guess that I should use the command that I mentioned above but I don't know how.
mavlink_message_t command; mavlink_message_interval_t interval; interval.interval_us = 100000; interval.message_id = 30; mavlink_msg_message_interval_encode(255, 200, &command, &interval); p_sensorsPort->write_message(command);
Update: I also tried this code below, maybe I am not giving it the right system id or component id.
mavlink_message_t command; mavlink_command_long_t interval; interval.param1 = MAVLINK_MSG_ID_ATTITUDE; interval.param2 = 100000; interval.command = MAV_CMD_SET_MESSAGE_INTERVAL; interval.target_system = 0; interval.target_component = 0; mavlink_msg_command_long_encode(255, 0, &command, &interval); p_sensorsPort->write_message(command);
Maybe I am missing something about the difference between
compid. I tried few values for each but nothing worked. Is there any ack that will be able to tell me if it even got the command?