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
Conversation
FYI @ryanjAA @chris1seto , if you want to give feedback, would be appreciated. |
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). |
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. |
The weather is definitely 💯 would be interesting to test out |
no minimum altitude for abort orbit? |
There was a problem hiding this 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.
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>
2e98b3b
to
b6cfd62
Compare
@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>
There was a problem hiding this 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:
PX4-Autopilot/src/modules/flight_mode_manager/tasks/Auto/FlightTaskAuto.cpp
Lines 238 to 263 in 3bdb42b
_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).
@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 ? |
@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. |
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
control_auto_landing
tocontrol_auto_landing_straight()
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)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)