Hello Everyone -
I'm trying to integrate information from Mavlink messages into a 3D Game Engine in order to visualize the drone in a virtual world. I'm able to obtain the drone position/orientation from the information in the MAVLINK_MSG_ID_GLOBAL_POSITION_INT and MAVLINK_MSG_ID_ATTITUDE messages. However the attitude message is sent about 200ms and the global position message is sent every 600ms. Is there a way to change the frequency of these messages?
Google search and Mavlink docs appear to suggest using the MAV_DATA_STREAM_POSITION message to set the frequency of different types of updates. I tried this approach using the following code:
mavlink_data_stream_t gps_stream;
gps_stream.message_rate = 100;
gps_stream.on_off = 1;
gps_stream.stream_id = MAV_DATA_STREAM_POSITION;
mavlink_msg_data_stream_encode(254, 254, &msg, &gps_stream);
uint8_t sendbuf[MAVLINK_MAX_PACKET_LEN];
uint16_t len = mavlink_msg_to_send_buffer(sendbuf, &msg);
pSerialPort->WriteData((const char*)(sendbuf), len);
but it does nothing. Any ideas?
Replies