ArduPilot / ardupilot

ArduPlane, ArduCopter, ArduRover, ArduSub source
http://ardupilot.org/
GNU General Public License v3.0
10.93k stars 17.45k forks source link

Rover: Include Error in NAV_CONTROLLER_OUTPUT in Guided-within-Auto #11433

Open drew-heenan opened 5 years ago

drew-heenan commented 5 years ago

Bug

Issue Details Running a rover with MAV_CMD_NAV_GUIDED_ENABLE waypoints (3.6.0-dev guided-within-auto) to hand control to an external controller will result in the NAV_CONTROLLER_OUTPUT message being sent without calculating the various error values (particularly xtrack_error, wp_dist) in the message. These values will instead be zero, but they are still useful to an external controller and should be calculated and included, particularly since the message is output anyways.

Example Using SITL to demonstrate; Waypoints:

QGC WPL 110
0   0   0   16  0.000000    0.000000    0.000000    0.000000    -35.363262  149.165237  -0.110000   1
1   0   3   92  1.000000    0.000000    0.000000    0.000000    -35.363117  149.165100  50.000000   1
2   0   3   92  1.000000    0.000000    0.000000    0.000000    -35.363022  149.165253  50.000000   1
3   0   3   92  1.000000    0.000000    0.000000    0.000000    -35.362831  149.164963  50.000000   1

When switched to AUTO (and so targeting waypoint 1) and arming successfully, NAV_CONTROLLER_OUTPUT is:

AUTO> arm throttle
AUTO> status | grep NAV_CONTROLLER_OUTPUT
AUTO> 288: NAV_CONTROLLER_OUTPUT {nav_roll : 0.0, nav_pitch : 0.0, nav_bearing : 353, target_bearing : 90, wp_dist : 0, alt_error : 0.0, aspd_error : 0.0, xtrack_error : -0.0}

The error fields above are zero, which is incorrect. Switching to normal waypoints (16) results in the expected output.

Platform [ ] All [ ] AntennaTracker [ ] Copter [ ] Plane [x] Rover [ ] Submarine

magicrub commented 5 years ago

I would say the intent was probably to populate the wp_dist, not sure why it isn't. So, yes, I'd consider it a bug rather than a feature request.