Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rover: add NAV_GUIDED_ENABLED support #10775

Merged
merged 11 commits into from
Mar 15, 2019

Conversation

rmackay9
Copy link
Contributor

@rmackay9 rmackay9 commented Mar 11, 2019

This PR adds support to Rover for the NAV_GUIDED_ENABLE and DO_GUIDED_LIMITS commands.

Supporting these commands allows "Guided within Auto" which means an external navigation source (like ROS) can temporarily take control of the vehicle during a mission.

This feature is very similar to what is already in Copter but there are some changes:

  • AP_Mission's NAV_GUIDED_ENABLE command handler stores a user provided lat, lon and alt.
  • If a NAV_GUIDED_ENABLE command has a position then we send this to the external navigation controller within a SET_POSITION_TARGET_GLOBAL_INT message at 1hz. We also use this position to "verify" that the command has been completed (i.e. when the vehicle is within WP_RADIUS of the position we move to the next command)

Similar to copter, the DO_GUIDED_LIMITS command allows the user to specify a timeout and a safe radius (i.e. a small fence) to help ensure the external controller doesn't do anything crazy

This has been tested in SITL and on a real vehicle. Here's a video of the test using ROS as the external path planner.

There are some related changes to other system that I will take care of separately from this PR:

  • change the MAVLink spec for the NAV_GUIDED_ENABLE command to allow lat,lon,alt to be stored. As far as I know we are the only users of this command - I originally added it as part of the red-balloon-popper project
  • get this mavros PR merged to allow ROS to accept the position target sent from ArduPilot
  • Mission Planner should be changed to make the GUIDED_ENABLE and DO_GUIDED_LIMITS commands available to the user (issue raised here)

Ah, there are also two small changes to Copter that should be non-functional changes to remove a duplicate call and fix some formatting and comments.

@rmackay9
Copy link
Contributor Author

rmackay9 commented Mar 12, 2019

@OXINARF, could you have a peek at this when you have time? It's not desperately urgent of course so whenever is fine.. I've tested it and I think it's OK but I'd like a 2nd opinion before merging 'cuz I pretty much always make a mistake :-)

@magicrub
Copy link
Contributor

confirmed working on our hardware

APMrover2/mode.h Outdated Show resolved Hide resolved
APMrover2/mode.h Outdated Show resolved Hide resolved
APMrover2/mode.h Outdated Show resolved Hide resolved
APMrover2/mode.h Outdated Show resolved Hide resolved
APMrover2/mode.h Outdated Show resolved Hide resolved
APMrover2/mode_guided.cpp Outdated Show resolved Hide resolved
APMrover2/mode_guided.cpp Outdated Show resolved Hide resolved
libraries/GCS_MAVLink/GCS_Common.cpp Outdated Show resolved Hide resolved
libraries/GCS_MAVLink/GCS_Common.cpp Outdated Show resolved Hide resolved
libraries/GCS_MAVLink/GCS_Common.cpp Outdated Show resolved Hide resolved
commands are placed in numerical order
this is called from nav_guided_start()
this allows sending the location to an offboard navigation system
also add text string for nav-guided-enable command
this supports sending the position target to an offboard navigation controller
also adds support for sending position targets to offboard controller which is assumed to return velocity commands
@rmackay9
Copy link
Contributor Author

I think I've addressed pretty much all the items raised during the review so I'll merge after it passes travis. thanks @peterbarker!

@rmackay9 rmackay9 merged commit 873096f into ArduPilot:master Mar 15, 2019
@rmackay9 rmackay9 deleted the rover-nav-guided1 branch March 15, 2019 05:51
@rmackay9 rmackay9 restored the rover-nav-guided1 branch March 15, 2019 05:52
@rmackay9 rmackay9 deleted the rover-nav-guided1 branch March 15, 2019 06:26
@magicrub
Copy link
Contributor

doh! @jmachuca77 found something wrong...

@rmackay9
Copy link
Contributor Author

@magicrub, that's OK, now it's a support issue is all..

@jmachuca77
Copy link
Contributor

@magicrub yeah its not a real issue, that's why I did not comment. Works once you know how it should work haha.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants