DIYDrones,

I have two question related to MAVLink commands.  First, I'm trying to send a MAVLink command to my MAV which will make the plane fly to the desired waypoint and then continue on its mission.  For example, If the MAV's mission was A-B-C-D-HOME and the MAV has already reached waypoint A in autopilot mode.  I am wondering if there is a MAVLink command so that I can insert a waypoint into the middle of a mission.  Therefore, the mission would end up something like A-X-B-C-D-HOME.  Obviously the X MAVLink would either have to send lat,long and alt of a waypoint struct.  Is there a predefined MAVLink command to do this?  

Secondly, I was wondering if there was a way to send my MAV and guided waypoint.  For example, if my MAV was in autopilot mode flying the same mission A-B-C-D-HOME and I sent my MAV a MAVLink command to go the X waypoint in guided mode.  Is there a MAVLink command to do this?

I know that this page shows all of the predefined APM MAVLink commands, but there isn't very much description on what they do.  It seems that one of the NAV commands might be designed for what i'm trying to do but i'm not sure.  Any help would be very appreciated.

Views: 5621

Reply to This

Replies to This Discussion

David,

      i think there's a do_jump command.  so you could make it jump after a to wp E and then jump back to B maybe?

Randy, 

Thanks for the reply!  Can anyone else confirm this?  Also, is there a way I can test this without having to fly my UAV?  Maybe SITL?  I have a little experience with HIL but I haven't tried doing SITL yet so i'm not sure if you can test waypoint flights using SITL.

I'm sure it's possible to test waypoints with SITL because we use it for our autotester that runs after every check in and it includes flying a little course.

 

HIL is broken in trunk at the moment (I made a change a few days ago that broke it) but I'll get it working again within a few days.

So, I've been doing some research and I think the do_jump command is not what I am looking for. Here is the description of the do_jump command: 

entry value="177" name="MAV_CMD_DO_JUMP">
  description>Jump to the desired command in the mission list. Repeat this action only the specified number of times</description>
  param index="1">Sequence number</param>
  param index="2">Repeat count</param>
  param index="3">Empty</param>
  param index="4">Empty</param>
  param index="5">Empty</param>
  param index="6">Empty</param>
  param index="7">Empty</param>
  </entry>
the description says that using this command jumps to a desired command in the mission list.  Although I may have alluded to this above, this is not what I am looking for.  I want a mavlink message that will allow me to send lat,lng and alt for a waypoint.  Then, the APM will recieve this message and proceed to fly to this waypoint.  Once reaching this waypoint, the UAV will proceed to continue on the mission it was already flying.
I'm not exactly sure, but it seems like either MAV_CMD_NAV_PATHPLANNING or a MAV_GOTO command will conquer what i'm trying to achieve.  Although, i'm not very familiar with these commands and the code isn't clear explaining this.  Randy, or anyone else, do you have any insight into this? 

David: Did you get an answer to your question? I have a similar need, as described on my thread: http://www.diydrones.com/forum/topics/apm-adaptive-flying-video-ana...

I found a nice list of commands for MAV, might be useful, but I'm still deciphering it: https://pixhawk.ethz.ch/mavlink/

If you figure it out, let me know! I'll let you know if I figure it out too!

Austin,

I've actually scratched this idea, and I am now looking at my problem a different way.  Instead of having the APM store a mission, and then have intermediate points that the UAV would fly to during the mission, I am now just entirely using the "Guided mode" mechanism of ArduPlane.  Now, instead of having the APM store all the waypoints, I am dynamically sending up "guided waypoints" to the APM, and simply just having the APM fly to the desired location.  The ground-station is monitoring the APM and making decisions on whether the UAV has hit the waypoint.  If it has, the next waypoint is sent wirelessly to the APM so it will continue to fly its mission.   Does this help?  Or, are you specifically looking for help with the DO_JUMP command?

After reading your thread it looks like i'm doing exactly what you don't want to do.  I am completely phasing out the Mission Planner, because I have built my own GUI to do what I want as a ground station.  So, I am sending commands serially to the APM, and receiving constant telemetry updates from the APM.

Actually, that is fairly close to what I am looking for. Are you doing this using MAV commands, or the planner? I need to have a computer send the points up automatically, not set them in-flight by hand. Thanks!

-Austin

No I am not using the Mission Planner.  Basically, I'm running a CPP program that monitors serial messages (MAVLink messages), coming in through the serial port.  The program then comptues stuff like if the UAV has hit its desired waypoint.  If it has, the program then sends the next waypoint to the APM, where the APM receives the command and attempts to fly to the next waypoint.

Essentially, the code I am using to receive telemetry updates is here:https://github.com/mavlink/mavlink_ros.  And to send commands, all you have to do it populate the MAVLink message correctly so that when the APM receives it the correct logic is executed.  You can figure out this by looking in the GCS_MAVLink.pde file in ArduPlane folder.

Thank you very much! There isn't a way for two different programs to read from the same serial connection, is there? Or, a way for me to get the data out of the planner? I can use a pre-loaded grid to find the "targets" if I have to, as the competition I'm doing this for is coming up soon, and I'm getting short on time, but I still need the GPS data from the plane to output for the judges. Any thoughts on how to get this data while still using the planner?

I don't see any reason why you couldn't run the mission planner, and another program strictly to monitor the telemetry information coming through the serial port, although I haven't tested to see if this would work.  But, the program on the github I specified should simply monitor the serial port, and if anything is sent to it the program will react accordingly.

By the way, the only issue i see with this is what do you do when you lose contact with the ground station.  We should have a groundstation-failsafe feature so that it returns automatically to home if it loses contact.  ArduPlane has this already so we should bring it over into arducopter at some point.

Reply to Discussion

RSS

© 2019   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service