Hi all,
I am currently working on a project using a Pixhawk flight controller and communicating with it using MAVLink through a Raspberry Pi. I’ve been attempting to control the rate of specific MAVLink messages using the MAV_CMD_SET_MESSAGE_INTERVAL
command. However, I’ve encountered an issue that I hope to get some assistance with.
Here’s a brief overview of what I’m trying to achieve and the problem I’m facing:
Objective:
- Increase the rate of message ID 30 (ATTITUDE) to 10Hz.
- Add message ID 31 (GLOBAL_POSITION_INT) with a rate of 4Hz.
- Disable or reduce the rate of message ID 193.
Issue: When I send the MAV_CMD_SET_MESSAGE_INTERVAL
command, I receive a positive acknowledgment (MAV_RESULT_ACCEPTED
). However, when I check the message rates using MAVLink Inspector, I do not observe the expected changes in the message rates, except for the addition of message ID 31.
Steps Taken:
- Established a MAVLink connection using pymavlink on a Raspberry Pi.
- Sent
MAV_CMD_SET_MESSAGE_INTERVAL
commands to set the desired message rates. - Checked the rates using MAVLink Inspector and found inconsistencies with expected results.
Code Snippet: I have been using a Python script with pymavlink to establish the connection and send the commands. Here’s a snippet of the code I use to send the MAV_CMD_SET_MESSAGE_INTERVAL
command:
message = master.mav.command_long_send(
master.target_system, # Target system ID
master.target_component, # Target component ID
mavutil.mavlink.MAV_CMD_SET_MESSAGE_INTERVAL, # ID of command to send
0, # Confirmation
message_id, # param1: Message ID to be streamed
int(1e6 / rate_hz), # param2: Interval in microseconds
0, # param3 (unused)
0, # param4 (unused)
0, # param5 (unused)
0, # param6 (unused)
0 # param7 (unused)
)
Has anyone faced a similar issue or is there something I might be missing? Any help or guidance would be immensely appreciated. Thank you in advance!
Best Regards,