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

FW: support Land command outside of a mission #21036

Merged
merged 8 commits into from Feb 20, 2023
Merged

Conversation

sfuhrer
Copy link
Contributor

@sfuhrer sfuhrer commented Feb 1, 2023

Solved Problem

When triggering a land outside of a mission (e.g. by switching to Land mode, sending DO_LAND command or typing commander land in shell), vehicle does a fly away. Instead if should come down at current location and "land" more or less smoothly.

Solution

  • rename existing landing method control_auto_landing to control_auto_landing_straight()
  • add new landing method control_auto_landing_circular()
    --> control_auto_landing_circular() is used if _position_setpoint_previous_valid=false, which is the case for landings outside of missions. At some point we could add a flag to CMD_NAV_LAND to be able to distinguish straight and circular landings this way (there may be valid use cases where circular mission landings are preferred over straight ones, eg when planning multiple mission landings as rally points)
  • in control_auto_landing_circular(), keep loitering down at a fixed descend speed (based on FW_LND_ANG) in landing configuration (landing airspeed, flaps in landing config etc) until flaring altitude is breached, then flare (flaring is unchanged from straight landing)
  • don't allow any nudging, only keep wheel control when flaring
  • enable landing abort (both automatic and user triggered) --> establish loiter at current position and altitude (without climbing!)
  • I had to make one change that potentially also affect MC - could you check @MaEtUgR that it's fine? To me it sounds like the right thing to do anyway. eafb281

@sfuhrer
Copy link
Contributor Author

sfuhrer commented Feb 1, 2023

FYI @ryanjAA @chris1seto , if you want to give feedback, would be appreciated.

@ryanjAA
Copy link
Contributor

ryanjAA commented Feb 2, 2023

This is pretty cool! Awesome work! Will see what we can find to test this. Also, @dirksavage88 may be interested in trying this too (he’s joining the fw club and likely has better weather than myself and Chris atm).

@chris1seto
Copy link
Contributor

I like the general direction! Very nice work!

I think given this is a command (implying, more commands can be given, possibly to steer the vehicle home or to at least a good place before augering down), this approach seems good. If there is to be any automatic behavior that calls this, we definitely want to be extremely careful about coming down in this fashion over anything that isn't known good terrain to be landing, but I think that's out of scope for just this addition.

I'll definitely want to test this and will have more feedback then.

@dirksavage88
Copy link
Contributor

The weather is definitely 💯

would be interesting to test out

@tstastny
Copy link
Contributor

tstastny commented Feb 6, 2023

enable landing abort (both automatic and user triggered) --> establish loiter at current position and altitude (without climbing!)

no minimum altitude for abort orbit?

Copy link
Contributor

@tstastny tstastny left a comment

Choose a reason for hiding this comment

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

Great to have this patched! I have a few comments - but otherwise agree with the approach for now.

src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp Outdated Show resolved Hide resolved
src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp Outdated Show resolved Hide resolved
src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp Outdated Show resolved Hide resolved
src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp Outdated Show resolved Hide resolved
src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp Outdated Show resolved Hide resolved
src/modules/fw_pos_control_l1/FixedwingPositionControl.cpp Outdated Show resolved Hide resolved
src/modules/fw_pos_control_l1/FixedwingPositionControl.hpp Outdated Show resolved Hide resolved
src/modules/navigator/land.cpp Show resolved Hide resolved
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
…pos_sp_curr

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
Add method for circular landing, that is used instead of the straight fixed-wing
landings in case the landing is not part of a mission landing.
Use straight landing if previous WP is valid, and the ciruclar otherwise.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
@sfuhrer
Copy link
Contributor Author

sfuhrer commented Feb 13, 2023

@tstastny rebased on latest main and squashed the last commits.

As we don't know the landing point altitude in non-mission landings, assume
the worst case (abort right before touchdown) and thus always climb
MIS_LND_ABRT_ALT on triggering an abort.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
Enable automatic landing abort on timed out distance sensor reading also for
the circular landing. Do not enable the no-terrain timeout check, as, opposed
to the straight landing, we here don't know when to expect the distance sensor
to get valid.

Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
Signed-off-by: Silvan Fuhrer <silvan@auterion.com>
@sfuhrer sfuhrer merged commit 2008a44 into main Feb 20, 2023
84 of 86 checks passed
@sfuhrer sfuhrer deleted the pr-fw-land-command-main branch February 20, 2023 16:04
Copy link
Member

@MaEtUgR MaEtUgR left a comment

Choose a reason for hiding this comment

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

@sfuhrer That's a very useful addition 🙏

I double-checked for multicopter what is done with these coordinates:

  • If they are set by navigator, they are considered
  • If they are unset it just takes the current vehicle local position as land position. See first and last line of:
    _land_position = Vector3f(_target(0), _target(1), NAN);
    // User input assisted landing
    if (_param_mpc_land_rc_help.get() && _sticks.checkAndUpdateStickInputs()) {
    // Stick full up -1 -> stop, stick full down 1 -> double the speed
    vertical_speed *= (1 + _sticks.getPositionExpo()(2));
    // Only set a yawrate setpoint if weather vane is not active or the yaw stick is out of its dead-zone
    if (!_weathervane.isActive() || fabsf(_sticks.getPositionExpo()(3)) > FLT_EPSILON) {
    _stick_yaw.generateYawSetpoint(_yawspeed_setpoint, _land_heading,
    _sticks.getPositionExpo()(3) * math::radians(_param_mpc_man_y_max.get()), _yaw, _is_yaw_good_for_control, _deltatime);
    }
    _stick_acceleration_xy.generateSetpoints(_sticks.getPositionExpo().slice<2, 1>(0, 0), _yaw, _land_heading, _position,
    _velocity_setpoint_feedback.xy(), _deltatime);
    _stick_acceleration_xy.getSetpoints(_land_position, _velocity_setpoint, _acceleration_setpoint);
    // Hack to make sure the MPC_YAW_MODE 4 alignment doesn't stop the vehicle from descending when there's yaw input
    if (fabsf(_yawspeed_setpoint) > FLT_EPSILON) {
    _yaw_sp_aligned = true;
    }
    } else {
    // Make sure we have a valid land position even in the case we loose RC while amending it
    if (!PX4_ISFINITE(_land_position(0))) {
    _land_position.xy() = Vector2f(_position);

    So if I read it correctly the land position setpoint is now set by navigator from current global position instead of by FlightTaskAuto from current local position. Except for timing it shouldn't make a difference (famous last words).

@hamishwillee
Copy link
Contributor

@sfuhrer Does this mean we need to do some fix up - see the note in https://docs.px4.io/main/en/flight_modes/land.html#fixed-wing-fw ?

@tstastny
Copy link
Contributor

@hamishwillee - yup. we'll need to add docs. @sfuhrer is on holiday for 3 weeks. i can try to find some time to update the docs while he's out.

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

Successfully merging this pull request may close these issues.

None yet

7 participants