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

[WIP] FW navigation first order hold move to position controller #8883

Closed
wants to merge 9 commits into from

Conversation

dagar
Copy link
Member

@dagar dagar commented Feb 14, 2018

Navigator mission first order hold (FOH) altitude setpoint was limited to non-rotary wing missions within navigator. Given those restrictions it's a much better fit within the fixed wing position controller.

@dagar
Copy link
Member Author

dagar commented Feb 14, 2018

TODO: unify FW position + loiter handling in position controller

  • loiter to climb or descend
  • position for large xy (FOH altitude)

@dagar dagar changed the title FW navigation first order hold move to position controller [WIP] FW navigation first order hold move to position controller Feb 14, 2018
@dagar dagar force-pushed the pr-nav_foh_loiter branch 3 times, most recently from 973ed76 to fc98262 Compare February 17, 2018 16:18
@dagar dagar force-pushed the pr-nav_foh_loiter branch from fc98262 to 53955b3 Compare March 7, 2018 01:20
This was referenced Mar 20, 2018
@dagar dagar force-pushed the pr-nav_foh_loiter branch from 53955b3 to 42619d8 Compare April 3, 2018 21:59
@dagar dagar requested review from RomanBapst and Stifael April 3, 2018 21:59
@dagar
Copy link
Member Author

dagar commented Apr 3, 2018

@Stifael this kills off the navigator FOH entirely.

The MissionBlock change is rather large. Additional review would be greatly appreciated.

_global_pos.lat, _global_pos.lon, _global_pos.alt,
&dist_xy, &dist_z);

/* close to waypoint, but altitude error greater than twice acceptance */
Copy link
Contributor

Choose a reason for hiding this comment

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

Because I just recently started to change comments type in another PR, I was wondering why you choose here /* but above you chose the if // -comment?

Copy link
Member Author

Choose a reason for hiding this comment

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

It's a carry over from moving the old code. I use c++ style // for any new comments.

if ((dist >= 0.0f)
&& (dist_z > 2 * _parameters.climbout_diff)
&& (dist_xy < 2 * pos_sp_curr.acceptance_radius)) {

Copy link
Contributor

Choose a reason for hiding this comment

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

why two times the acceptance radius?

Copy link
Member Author

Choose a reason for hiding this comment

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

Enough distance to cleanly enter the loiter radius. It's a bit arbitrary.

@tstastny might be cleaner to use L1 distance here?

Copy link

Choose a reason for hiding this comment

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

yes I would. This is anyway when the controller would start commanding a turn.

const float d_current = get_distance_to_next_waypoint(pos_sp_curr.lat, pos_sp_curr.lon, curr_pos(0), curr_pos(1));

/* Save distance to waypoint if it is the smallest ever achieved, however make sure that
* min_current_sp_distance_xy is never larger than the distance between the current and the previous wp */
Copy link
Contributor

Choose a reason for hiding this comment

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

What do you mean with

Save distance to waypoint if it is the smallest ever achieved

min_current_sp_distance _xy is always d_current as long as the distance is below distance_current_previous

Copy link
Member Author

Choose a reason for hiding this comment

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

It's possible for a plane to miss waypoint acceptance and have to turn around and come back.

if (min_current_sp_distance_xy > pos_sp_curr.acceptance_radius) {

/* update the altitude sp of the 'current' item in the sp triplet, but do not update the altitude sp
* of the mission item as it is used to check if the mission item is reached
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this comment is a leftover from the navigator, since mission_item does not exist in the position-controller.

@@ -198,10 +198,6 @@ Mission::on_active()
set_mission_items();
}

} else if (_mission_type != MISSION_TYPE_NONE && _param_altmode.get() == MISSION_ALTMODE_FOH) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I assume this param_altmode parameter is now not used anymore

Param no longer exists

@@ -1058,14 +1032,6 @@ Mission::heading_sp_update()
_mission_item.yaw = _wrap_pi(yaw + M_PI_F);
pos_sp_triplet->current.yaw = _mission_item.yaw;

} else if (_param_yawmode.get() == MISSION_YAWMODE_FRONT_TO_WAYPOINT
Copy link
Contributor

Choose a reason for hiding this comment

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

whay is this one gone?

Copy link
Member Author

Choose a reason for hiding this comment

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

I was assuming/anticipating you handling it entirely in the MC position controller. This was done before #9146 and needs review.

Copy link
Member Author

Choose a reason for hiding this comment

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

The ROI portion should have been kept.

// set required yaw from bearing to the next mission item
if (_mission_item.force_heading) {
struct position_setpoint_s next_sp = _navigator->get_position_setpoint_triplet()->next;
if (!_navigator->get_vstatus()->is_rotary_wing) {
Copy link
Contributor

Choose a reason for hiding this comment

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

i think it should be without negation

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, good catch.


if (fabsf(yaw_err) > math::radians(_navigator->get_yaw_threshold())) {
success = false;
Copy link
Contributor

Choose a reason for hiding this comment

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

The success and yaw_required boolean are a bit confusing to me.
Should not first be checked that yaw is required, and if required (https://github.com/PX4/Firmware/pull/8883/files#diff-7a824e3d1e9a5420071c8c9bbe27b8e7R353) it then needs to be checked for success?

@dagar dagar force-pushed the pr-nav_foh_loiter branch from 42619d8 to 07947c3 Compare April 4, 2018 13:45
@dagar
Copy link
Member Author

dagar commented Apr 4, 2018

Testing required

  • fixed wing mission testing

    • TAKEOFF
    • WAYPOINT
    • LOITER (timed, unlimited, to alt)
      • timed acceptance or successful timeout
    • test changing the active waypoint (especially back to takeoff, or interrupting a loiter and coming back to it)
    • loiter acceptance/exit when heading is aligned
  • multicopter

    • LOITER (timed, unlimited, to alt)
    • anything with yaw acceptance
    • yaw acceptance timeout

@Antiheavy
Copy link
Contributor

@dagar would addressing the min pitch angle on FW takeoff as a PX4 parameter (instead of a MAVlink param) be appropriate for this PR. see issue here: #6787

@dagar dagar force-pushed the pr-nav_foh_loiter branch 2 times, most recently from 93ba6f1 to 953c4e9 Compare April 4, 2018 22:03
@Antiheavy
Copy link
Contributor

Antiheavy commented Apr 7, 2018

I just started SITL testing this on FW. So far haven't noticed anything bad, but I have a lot more testing to do. edit: i spoke too soon. It's having a very hard time with trying to achieve a large altitude change with two waypoints that are close together:
image

Question: is there such a thing as tangent exit on time based loiters? I'm guessing not because that wouldn't make sense anyway.
image

@dagar
Copy link
Member Author

dagar commented Apr 9, 2018

@Antiheavy thanks for the thorough test. We need to think about how the switch between regular waypoint navigation and achieve waypoint altitude via loiter (once arriving) is handled. It might need to latch between one mode or the other a little more carefully.

@dagar dagar force-pushed the pr-nav_foh_loiter branch from 953c4e9 to 4b57be8 Compare May 23, 2018 01:11
@dagar dagar force-pushed the pr-nav_foh_loiter branch from 4b57be8 to b24801f Compare July 1, 2018 19:26
@dagar
Copy link
Member Author

dagar commented Jul 1, 2018

I'd like to pick this up again, starting by reviewing actual FW requirements.

@philipoe

@stale stale bot closed this Feb 4, 2019
@dagar dagar reopened this Aug 25, 2020
@PX4 PX4 deleted a comment from stale bot Aug 25, 2020
@PX4 PX4 deleted a comment from stale bot Aug 25, 2020
@dagar dagar added Hybrid VTOL 🛩️🚁 Multirotor + Fixedwing! and removed Admin: Wont fix labels Aug 25, 2020
@dagar
Copy link
Member Author

dagar commented Aug 25, 2020

@RomanBapst @sfuhrer let's take another look at this one.

@sfuhrer
Copy link
Contributor

sfuhrer commented Dec 11, 2020

@dagar I guess we can close this one since #15677 is in?

@LorenzMeier
Copy link
Member

Closing as stale.

@LorenzMeier LorenzMeier deleted the pr-nav_foh_loiter branch January 10, 2021 17:52
@dagar
Copy link
Member Author

dagar commented Jan 10, 2021

This was finally completed in #15677.

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