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

Plane: takeoff to xtrack to virtual wp ahead instead of heading-hold #14679

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

magicrub
Copy link
Contributor

@magicrub magicrub commented Jun 24, 2020

On plane auto-takeoff, current implementation is a simple heading hold which gets pushed by the wind. This PR will generate a virtual waypoint 10km ahead and xtrack to it. All the usual low-altitude roll limits still apply. I'm not sure if this is something we should hard-code enabled, or use a param (TKOFF_OPTIONS?)

Test:
AUTO mode with 2 waypoints:

  1. takeoff of alt=100m pitch=2deg (to exaggerate the problem on SITL)
  2. Any NAV point. (For my tests I used a LOITER_UNLIMITED, alt=100)

SITL params:
SIM_WIND_DIR=270
SIM_WIND_SPD=10

image
Above is existing heading-hold behavior

image
Above is new wp xtrack behavior

@magicrub
Copy link
Contributor Author

I'll be flying this in a couple days from now. Would love some feedback about it before then

// when true, we will follow the recorded takeoff heading.
// when false, we xtrack to a virtual waypoint 10km ahead of us on this takeoff heading
// TODO: turn this hardcoded value into a param/option?
steer_state.locked_course = false;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An improvement would be to start off as true and then flip to false one we gain a little altitude, like 10m. That would solve any ground-steering vehicle issues and not induce any funny low-altitude behavior.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This relies on starting with a good initial velocity vector. I had to look at this for a fast plane that had a longer takeoff run a while ago and ended up adding an option to use the takeoff waypoint location to set the desired ground track - see priseborough@a6d2b2b

ArduPlane/commands_logic.cpp Show resolved Hide resolved
@magicrub
Copy link
Contributor Author

magicrub commented Jul 7, 2020

This has been flight tested and works great! I might have a few tweaks before I want this merged so I'll leave it as WIP for now

@magicrub magicrub removed the WIP label Nov 19, 2020
@magicrub
Copy link
Contributor Author

magicrub commented May 9, 2021

I've been flying this for almost a year and is a required part of being a good citizen of taking off on a runway and not flying over crowds of people and/or crew and buildings on the sidelines. Any more comments on this?

@magicrub
Copy link
Contributor Author

rebased.

@danvel9
Copy link

danvel9 commented Feb 24, 2022

I've been waiting for this for more than one year... Any chance this feature will be included in an official Arduplane release anytime soon?

@magicrub magicrub added this to Plane in Roadmap 2022 Apr 10, 2022
@magicrub
Copy link
Contributor Author

@danvel9 I've totally forgotten about this. I'll follow-up and rebase this so it's ready to be evaluated again for a merge.

@magicrub
Copy link
Contributor Author

I've rebased this but it needs testing. @danvel9 are you able to help with that? Basically, I'd like to see how it interacts with how auto takeoff mission item now supports a lat/lng point to head towards. This would basically become how to do it with a lat/lng of 0,0. Don't test yet until I take a look at this closer.

@danvel9
Copy link

danvel9 commented Feb 21, 2023 via email

@magicrub
Copy link
Contributor Author

@danvel9 Here's an apj for a CubeOrange. Let me know if you want a build for different HW
CubeOrange_Plane_takeoff_xtrack.zip

I've rebased and re-tested on SITL. Works great.

@danvel9
Copy link

danvel9 commented Feb 25, 2023 via email

@magicrub
Copy link
Contributor Author

This needs a check to only run if the mission waypoint is invalid, typically (0,0)

@tridge
Copy link
Contributor

tridge commented Feb 28, 2023

I'd much rather have an option to use the lat/lon in the NAV_TAKEOFF waypoint along with the position when takeoff starts to define the course. When this option is not enabled then use the current strategy
The lat/lon of the TAKEOFF wp would only be used for the ground course, not for a distance
the height would be handled exactly as it is now
image

@priseborough
Copy link
Contributor

@tridge I did something along those lines for a fast plane with a longer than usual takeoff run as part of a few miscellaneous takeoff improvements priseborough@a6d2b2b

@jschall
Copy link
Contributor

jschall commented May 2, 2023

@tridge I am pretty sure that this PR doesn't preclude doing it your way as well. Takeoff with 0/0 coordinates could do it Tom's way, with coordinates it could happen your way.

@magicrub
Copy link
Contributor Author

@jschall @priseborough @tridge @peterbarker @danvel9 @WickedShell I've marked this for dev call so we can get some minds together on it.

gcs().send_text(MAV_SEVERITY_INFO, "Holding course %d at %.1fm/s (%.1f)",
(int)steer_state.hold_course_cd,
(double)gps.ground_speed(),
(double)degrees(steer_state.locked_course_err));
}
}

if (steer_state.hold_course_cd != -1) {
if (!steer_state.locked_course && !prev_WP_loc.same_latlon_as(next_WP_loc)) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should instead check auto_state.crosstrack

float takeoff_course = wrap_PI(radians(gps.ground_course())) - steer_state.locked_course_err;
takeoff_course = wrap_PI(takeoff_course);
steer_state.hold_course_cd = wrap_360_cd(degrees(takeoff_course)*100);
const float ground_course_rad = wrap_PI(ahrs.groundspeed_vector().angle());
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should have parameters to choose between current scheme, next WP lat/lon and this scheme

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

Successfully merging this pull request may close these issues.

None yet

9 participants