-
Notifications
You must be signed in to change notification settings - Fork 57
send MAV_CMD #24
hi, this might be a really silly question but I am trying to use golang to communicate with SITL at TCP port 5760 (docker). With gomavlib provided examples, I can pick up the mavlink message (heartbeat, battery, etc) from sitl, but I was wondering how I could send out MAV_CMD to sitl to instruct it to do certain tasks; commands such as
MAV_CMD_NAV_WAYPOINT
MAV_CMD_NAV_RETURN_TO_LAUNCH
MAV_CMD_NAV_TAKEOFF
MAV_CMD_NAV_LAND
I am very new to mavlink, any advice would be really appreciated!
All reactions
Replies: 1 comment
Hello, in order to send commands, you have to follow the procedure described here:
https://mavlink.io/en/services/command.html
Therefore:
node.WriteMessageAll(&ardupilotmega.MessageCommandLong{ TargetSystem: ID, TargetComponent: ID, Command: ardupilotmega.MAV_CMD_NAV_TAKEOFF, })
In order to fill TargetSystem and TargetComponent, you have to listen for heartbeat message and find the system ID and component ID of your SITL drone.