GLOBAL_POSITION_INT is not sent frequently as set

Hi everyone

I am using 2 ardupilot for a project, one as leader and one as follower in maximum speed 50km/h. My problem is that I set the SR1_POSITION of leader to 100, but it was not actually sending out 100 times GLOBAL_POSITION_INT every second. It just sent 50~70 times on average, and occasionally 10 even 0 times on 1 second. The follower could not follow well as a result.

This has been improved in ArduCopter 4.1.

I advise you to set all the SR_* rates as low as possible, and then use the SET_MESSAGE_INTERVAL Mavlink message to increase the rate of just the GLOBAL_POSITION_INT message.
That is more efficient than using the SR_1_POSITION stream.

And update to ArduCopter 4.1.0

Thanks for replying

I tried to use the SET_MESSAGE_INTERVAL Mavlink message but did not work.
I first tried as this page said, then tried to use mavlink_msg_message_interval_pack() function, both failed.
https://ardupilot.org/dev/docs/mavlink-requesting-data.html

Here is my code.
mavlink_heart_beat();
delay(20); //delay 20ms
mavlink_set_msg();

mavlink_heart_beat() {
static uint32_t last_t = 0;

if (millis() - last_t < 1000) return;

last_t = millis();

mavlink_message_t msg;

uint8_t buf[MAVLINK_MAX_PACKET_LEN];

mavlink_msg_heartbeat_pack(255, 1, &msg, 

                            6, 8, 0, 0, 0);

uint16_t buf_len = mavlink_msg_to_send_buffer(buf, &msg);

Serial.write(buf, buf_len);

}

mavlink_set_msg(uint32_t hz) {
mavlink_message_t msg;

//mavlink_msg_command_long_pack(255, 1, &msg, 150, 1, 

//                            MAVLINK_MSG_ID_MESSAGE_INTERVAL, 0, 

//                            MAVLINK_MSG_ID_GLOBAL_POSITION_INT, hz*100.0, 0.0, 0.0, 0.0, 0.0, 0.0);

mavlink_msg_message_interval_pack(255, 1, &msg, MAVLINK_MSG_ID_GLOBAL_POSITION_INT, hz*200);

uint8_t buf[MAVLINK_MAX_PACKET_LEN];

uint32_t buf_len = mavlink_msg_to_send_buffer(&buf[0], &msg);

Serial.write(buf, buf_len);

}

Interval is not in hz, interval is in us period.

Thanks!

but I tried 10000 for 100hz, still did not work.

What can I say… here it works fine!

Could you share me any example?
Thanks

We use MavROS and C++ as well. No, sorry I can not.