master.mav.command_long_send( master.target_system, master.target_component, mavutil.mavlink.MAV_CMD_SET_MESSAGE_INTERVAL, 0, message_id, # The MAVLink message ID 1e6 / frequency_hz, # The interval between two messages in microseconds. Set to -1 to disable and 0 to request default rate. -->0, # Target address of message stream (if message has target address fields). 0: Flight-stack default (recommended), 1: address of requestor, 2: broadcast. 0, 0, 0, -->0)
Recently I have been reading the mavlink message format in order to learn more of the mavlink protocol. If I have read this correctly, a Command_long command message needs to take in:
- the target system
- the target component
- the command message ID (which for the message interval command would be 511)
- message confirmation
and then 7 parameters based on the command type.
I have two questions regarding this.
- Some commands require less than 7 parameters, for example the MAV_CMD_DO_SET_MODE command requires 3. When sending a command_long_send() message, do we send zeros for the parameters that aren’t specified? Does the autopilot just disregard those parameters regardless of the values sent?
- In the pymavlink documentation for requesting a message interval (given above), the “0” after the 1e6/frequency argument (the first arrow. In parameter 2’s position) is explained to be the target address of message stream. But, when I check the mavlink message documentation, it is the 7th argument that determines the target address. This confused me and that is why I am asking. Does the autopilot use the 2nd position in place of the 7th because there are no other parameters in between? Unlike some other mavlink commands, the unused parameter “slots” in the MAV_CMD_SET_MESSAGE_INTERVAL aren’t labeled as “empty” either.
This may come across as nitpicky but I think others may experience the same confusion.
Could someone explain this situation please?
Thanks for your time.