I was thinking it would be nice to get confirmation that the drone has received my MAVLINK_MSG_SET_POSITION_TARGET_POSITION message to send the drone to a particular location. I request that message using MAV_CMD_SET_MESSAGE_INTERVAL in my start up code.
Unfortunately, I never receive the MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT which I was expecting to get. This would hopefully tell me that the drone had updated its target to fly to.
I had a look at the Arducopter source code and found this in GCS_Mavlink.cpp:
I quite sure you should automatically receive that message as it is part of a stream. (Setting the message interval should be unnecessary unless you want to change the rate of the message.)
I would like to add that I found my code had a mistake so it did not explicitly request the MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT message, however based on what you said, I should be seeing this message regardless.
It was doing a takeoff to 10m followed by ascent to position target another 5m up and finally an attempt to set an attitude target. To be honest, there was only one position+yaw target set (with type mask set to only allow position i.e. POSITION_TARGET_TYPEMASK_VELOCITY_IGNORE | POSITION_TARGET_TYPEMASK_ACCELERATION_IGNORE | POSITION_TARGET_TYPEMASK_YAW_RATE_IGNORE) but still I did not see the Position_Target_Global_Int messages.
Thank you for your work on that pull request. It makes sense to have it enabled during GUIDED mode, especially since you can request position targets so why not receive confirmation of them?
I know that it is possible to receive POSITION_TARGET_LOCAL_NED when in GUIDED mode, for instance, so your pull request makes sense.
Are you able to receive the POSITION_TARGET_LOCAL_NED messages if you request them?
Possibly, the reason you arenāt getting that message is that terrain data is still pending download and thus is not available to convert the altitude frame. This means we donāt send Position_Target_Global_Int messages. Not 100% on this though as I canāt replicate the behavior in SITL.
Maybe try ensuring the terrain data is available by downloading it from the server for your locale?
My PR is just to fill out the data set further. I might follow-up with a PR to ensure for example in takeoff we send and log the targets which doesnāt seem to be occurring.
With my drone sitting on the ground unarmed, I only get MAVLINK_MSG_ID_GLOBAL_POSITION_INT and MAVLINK_MSG_ID_LOCAL_POSITION_NED messages. Do I need to be in GUIDED mode or flying to get the POSITION_TARGET messages?
The type-mask is set to POSITION_TARGET_TYPEMASK_VELOCITY_IGNORE | POSITION_TARGET_TYPEMASK_ACCELERATION_IGNORE | POSITION_TARGET_TYPEMASK_YAW_RATE_IGNORE
I do not have a tlog as I am not using Mission Planner to control the drone.
I think itās best that I repeat my tests with an explicit request for the position targets as by default it does not seem to work. Iāll post here with updates.
Yes, you must be in GUIDED to get POSITION_TARGET_LOCAL messages.
POSITION_TARGET_GLOBAL_INT is available in other modes RTL (all submodes but Landing), Smart_RTL (similar to landing), Auto, Follow, and Guided (when in WP mode, Pos control mode)
Have you tried using your code in SITL?? That is what I would do next.
Okay, I did some more flying today and it seems that MAVLINK_MSG_ID_POSITION_TARGET_GLOBAL_INT must be explicitly requested. At least that is what I am seeing in GUIDED mode. I do get the message when I ask for it.
I am potentially seeing a discrepancy in the position target fields vs what I request. This may be an issue with float truncation maybe. Iām not sure yet.
Yeah that it partly what my PR above is trying to address in regards to the reporting in guided mode. *Though i still have to add the yaw bit though that shouldnāt be too bad.)
Right now the output from the message is quite limited.
I think there is an issue for it somewhere just having trouble finding it.