I’ll start by saying the versions of everything I am running are shown below:
I come to these forums to ask for some help with some MAV commands that I am using for a project. The short version is: I am attempting to send a X-UAV Mini Talon up to altitude (nothing too high, maybe 1kft for now) on a balloon, disconnect the drone, and have it return to the launch point without any user interaction after pressing ‘arm’. The issue I am facing is in the balloon stage. Specifically, having the drone do nothing until height ‘X’.
I’ve been searching through the documentation in the wikis on this site, diydrones forums, and any random google result that seems like it would help for about a week and have yet to find any similar questions being asked.
I have some C and C++ experience, but not an extreme amount. So looking through the code and other forums I’ve managed to find mentions to an ‘IDLE’ mode and a MAV command named: MAV_CMD_NAV_ALTITUDE_WAIT, and associated do_altitude_wait command. (see pictures)
These are specifically mentioned in comments as being for balloon launches and I have seen posts about other teams using them successfully. The question I ask is how do I access these commands/functions? The drop down boxes in mission planner does not have the options available (see pictures below) and as such I assume that I need to do some work in the code to either enable these as options in mission planner or write the waypoint/mission file in a text editor instead.
A work around I have been attempting to use is the CONDITION_CHANGE_ALT command, coupled with SET_SERVO to turn motors on/off at various point but that comes with its own issues with failing to upload the WP throwing “Upload wps failed CONDITION_CHANGE_ALT MAV_MISSION_UNSUPPORTED”
Avoiding setting the mission this way would be preferable anyway.
If anyone has any helpful hints, or can point me to someone that has done this type of mission before I would appreciate it. Thank you advance for your time. I’ll in New Zealand (GMT +12) time and will be around for most of the work week to answer any further questions.
Some updates for anyone else who is trying this in the future, as I work through this to try and figure it out:
It looks like the idle mode is an induced state inside the MAV command: MAV_CMD_NAV_ALTITUDE_WAIT
I still haven’t found a way to get this command to appear in the Mission Planer > Flight Plan page so I tried to brute force it.
I found this section in the message_definitions/v1.0/common.xml file:
Using the command value of ‘83’ I chucked it straight into the waypoint text file with the appropriate paramaters:
Unfortunately when I then opened the file in Mission Planner it looked less than ideal:
The work continues however, again if anyone has any insight as to how to get the MAV_CMD_NAV_ALTITUDE_WAIT command to show up in the Flight Plan drop down box, or can point me in the direction/at the right people that would be awesome.
More progress to record!
I had a look through my common.xml file and did not find the MAV_CMD_NAV_ALTITUDE_WAIT listed anywhere, I instead found it in the ardupilotmega.xml file.
Further from the brute force method I wrote about in the post above. Mission Planner may not recognise the command as anything it can display on the Flight Planning page, but when I uploaded the file to this MAVProxy simulator it seemed to work!
I don’t have a way to simulate a balloon launch in the simulator so I just did an auto take off, switched into the ‘alt_wait’ state and let the drone fall out the sky. The ‘decent rate’ parameter caught it and everything kicked back to life and started the journey home.
In this picture you can see the readout showing the drone completing the take off, hitting a decent rate param and then executing the next set of instructions in the chain. (The relay on/delay/off chain is the output to a hot-wire circuit to cut the drone off the balloon tether)
Just to check it wasn’t a fluke i changed the params so that the alt_wait height limit was set lower than the ‘takeoff achieved’ height, seen below:
Here you can see the takeoff complete, the alt_wait cmd execute, ‘hit’ the altitude instantly and move on.
This proved to me enough that just editing the WP text file was enough to get what I wanted functionality wise. The next step was to get it to work in real life. I wasn’t sure I trusted Mission Planner to upload the file to the pixhawk correctly if it couldn’t recognise the command properly in the flight planner. I opened the file in MP and saved it again as a different filename to compare. Nothing had changed to I tired uploading and completed with no errors. I have no way of testing the height triggers at any decent altitude at the moment so I set the take off complete height at 2 meters, the alt_wait cmd to 3 meters and 100% GPS altitude. I then carried the drone up a large flight of stairs pretending it was attached to a balloon and reviewed the ‘Messages’ tab in the Flight Data screen. So far it seems to be working!
The task for me now is digging through the mission planner code in Visual Studio. I trying to find the file/source of the commands that the drop down box on the Flight Plan page is getting its data from so I can get the alt_wait command added to it. I’ve been bumbling my way through Visual Studio for about 4hrs with no success.
If anyone has any idea where this list of commands is hiding/being called from please let me know. Once I find it/get the drop down box updated I’ll chuck up the info/how to for future reference/archive purposes.
Could you succeed for this mission in real life?