My goal is to get the Bebop2 drone to follow a flight plan in Sphinx. Right now I can’t figure out how to export a flight plan as a mavlink file (see final comment on this question). In the FreeFlight app I have paid for the flight plan feature, created a flight plan and saved it locally, but cant find a way to export the flight plan to my PC.
I need it on my PC so that I can upload it to the drone using an FTP connection (see question). Right now, I am running FreeFlight on my iPad. The only solution I can think of is using FreeFlight on an android system so that I can access the entire file system and extract the flight plan that way? Is there an easier option that I am overlooking?
Have you tried to connect to the drone web server http://10.202.0.1/ for a simulated drone or http://192.168.42.1 for a physical drone ?
There is a Flightplan tab from which you can upload and download your mavlink files.
I however was reading this question. They state that you can create a .mavlink file using Mission Planner. I tried that and uploaded the file to the simulated drone using FTP:
curl -T test.mavlink ftp://10.202.0.1:61
Looking at the output of the command I believe the command is successful:
% Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed
100 848 0 0 100 848 0 33421 --:--:-- --:--:-- --:--:-- 33920
However when I request the drone to follow the waypoints using:
http://10.202.0.1/ is the (simulated) drone web interface while http://localhost:9002 is the simulator web interface. I know this can get confusing but you should really try the former.
I haven’t any experience with ROS so I can’t help you with that, sorry.
The Web server only runs on Anafi. For Bebop 2, you can use curl to transfer your file. I am not familiar with bebop_autonomy but it seems that the data field should contain the name of the flight plan to execute:
The problem was with the content of my mavlink file. The short answer was that I had my latitude and longitude mixed up in the file and the drone would go into a pause state. (I assume this was because I was requesting a waypoint 100’s or 1000’s of km away).
Thank you very much @ndessart and @ocrave you have both been super helpful !
For anyone that wants a longer answer I will post more details below:
The mavlink file format is based on the waypoint file format used in Mission Planner. The waypoint file format is described in the Mavlink docs as follows:
In the Mavlink docs they describe <PARAM5/X/LONGITUDE> and <PARAM6/Y/LATITUDE> which is where my mistake originated.
Note: The <PARAM5> and <PARAM6> meanings are based on the <COMMAND> tag, and in all cases I have found they are <PARAM5/LATITUDE> and <PARAM6/LONGITUDE> which is the inverse of the Mavlink docs.
So for instance in our case we are sending waypoints, i.e. <COMMAND>==16 (See above mavlink file). The number 16 refers to a MAV_CMD_NAV_WAYPOINT message whose description can be found in the Mavlink Github Page as seen below:
<enum name="MAV_CMD">
<description>Commands to be executed by the MAV. They can be executed on user request, or as part of a mission script. If the action is used in a mission, the parameter mapping to the waypoint/mission message is as follows: Param 1, Param 2, Param 3, Param 4, X: Param 5, Y:Param 6, Z:Param 7. This command list is similar what ARINC 424 is for commercial aircraft: A data format how to interpret waypoint/mission data. See https://mavlink.io/en/guide/xml_schema.html#MAV_CMD for information about the structure of the MAV_CMD entries</description>
<entry value="16" name="MAV_CMD_NAV_WAYPOINT" hasLocation="true" isDestination="true">
<description>Navigate to waypoint.</description>
<param index="1" label="Hold" units="s" minValue="0">Hold time. (ignored by fixed wing, time to stay at waypoint for rotary wing)</param>
<param index="2" label="Accept Radius" units="m" minValue="0">Acceptance radius (if the sphere with this radius is hit, the waypoint counts as reached)</param>
<param index="3" label="Pass Radius" units="m">0 to pass through the WP, if > 0 radius to pass by WP. Positive value for clockwise orbit, negative value for counter-clockwise orbit. Allows trajectory control.</param>
<param index="4" label="Yaw" units="deg">Desired yaw angle at waypoint (rotary wing). NaN for unchanged.</param>
<param index="5">Latitude</param>
<param index="6">Longitude</param>
<param index="7">Altitude</param>
</entry>
Here you can see that <PARAM5> and <PARAM6> are clearly latitude followed by longitude. This is also confirmed in the Mavlink Docs and Ardupilot Docs.