-
Notifications
You must be signed in to change notification settings - Fork 13.6k
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
Support gliding setpoints for autonomous soaring #14643
Conversation
ce44fb4
to
e368c35
Compare
Just thinking out loud for a minute, could we get this behavior for "free" (no special position setpoint type) by respecting the I'm also wondering about a manual soaring mode. Maybe instead of a separate mode it could be a side mechanism that allows cutting throttle in altitude mode and again switching the speed weight. From playing around in the past I recall switching the speed weight in flight is quite abrupt, but that could be addressed separately. |
@dagar That would indeed be better, since we can have use all waypoint types with / without gliding. However, if the setpoints are coming from offboard, what would be a good way to include that information in the local / global position messages? |
I'm not sure what the cleanest (or least bad) way to fit it into Wouldn't "soaring" be |
I also think we should find a solution that works well for all modes. Let's quickly think it through what a nice behavior for the user would be in all possible flight modes: (I'll just add whatever comes to my mind now, to have some points for a discussion)
How to do it:
And then we ofc need to handle it properly inside fw_position controller and TECS, but let's first discuss the interface to it. What do you think? |
e368c35
to
9cbf24e
Compare
@dagar @sfuhrer I have changed the approach to enable soaring by setting the following flags true: This sets the This only includes changes to enable offboard, but would be easy to extend this to other flight modes. although for including gliding in the mission would require a setpoint type that includes such information. Would this be something more preferable than the previous approach? |
6a56029
to
d16fd60
Compare
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.
Yes for me setting cruising_throttle
to -1 to indicate to the FW position controller that if should fly in gliding mode atm makes sense. Let's just make sure that we before did not set it to a negative value.
@dagar Is there anything I can improve on? |
62c3d9d
to
b70f6b7
Compare
29540d8
to
074ad55
Compare
@Jaeyoung-Lim Is there any doc impact to this? |
@hamishwillee There is! However, this PR has been going through quite some changes, so I will create a doc once it is stable :) |
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.
It's good for me.
Adds a capability to make the vehicle glide when given position setpoints. Gliding setpoints are enabled by setting POSITION_TARGET_TYPEMASK_Z_IGNORE, POSITION_TARGET_TYPEMASK_VZ_IGNORE, POSITION_TARGET_TYPEMASK_AZ_IGNORE on the typemask of position setpoints. Include zero cruising throttle Invalid setpoints with nan
074ad55
to
f2f6252
Compare
src/modules/navigator/mission.cpp
Outdated
@@ -1912,6 +1912,7 @@ bool Mission::position_setpoint_equal(const position_setpoint_s *p1, const posit | |||
(p1->acceleration_is_force == p2->acceleration_is_force) && | |||
(fabsf(p1->acceptance_radius - p2->acceptance_radius) < FLT_EPSILON) && | |||
(fabsf(p1->cruising_speed - p2->cruising_speed) < FLT_EPSILON) && | |||
(fabsf(p1->cruising_throttle - p2->cruising_throttle) < FLT_EPSILON)); | |||
((fabsf(p1->cruising_throttle - p2->cruising_throttle) < FLT_EPSILON) || (!PX4_ISFINITE(p1->cruising_throttle) | |||
&& !PX4_ISFINITE(p2->cruising_throttle))); |
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.
@dagar I couldn't think of any better way to handle the nans in this context. Any ideas?
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.
Yes I think that makes sense, although maintaining this entire thing is pretty gross. We should look at generating comparison operators for uORB later. https://github.com/PX4/Firmware/blob/df38e3798c25541d1462d8011fbf0d58904ce4f7/msg/templates/uorb/msg.cpp.em#L85-L99
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.
@dagar Right, makes sense
6562fec
to
a949a67
Compare
Looks good to me. |
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.
No, no objections from my side
@Jaeyoung-Lim Well done :-). Docs reminder. |
Describe problem solved by this pull request
There is currently no way in px4 to enable the vehicle to "glide" along the setpoint.
Describe your solution
This PR enables a soaring behavior while following a position setpoint in offboard mode. A soaring setpoint is sent through a setpoint_type mask, which configures TECS to prioritize kinetic energy and thus enabling the vehicle to soar along it's glide slope, while loitering around its setpoint.
This is needed for autonomous soaring applications, where the fixed wing vehicle needs to soar around a setpoint without activating any throttle.
Test data / coverage
A test code can be found in https://github.com/Jaeyoung-Lim/mav_soaring, which is a ROS based implementation(WIP) of Ardusoar
Video:
Log: https://review.px4.io/plot_app?log=35a0647d-f69f-4a19-bfe1-ea66d099a9a1