-
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
Adjustable land speed via RC #12220
Adjustable land speed via RC #12220
Conversation
b6c6b1d
to
efc2617
Compare
We might want a check for |
Also it might be nice to make this a parameter that defaults to DISABLED, as people will probably have the throttle stick down while landing, and the increased descent speed would be very concerning if they were not aware of the fact that their stick positions are now contributing to the descent speed. |
@LorenzMeier Do you have any comments/concerns? Do you think this is a feature worth pursuing? |
This has come up before and high level I think it's a good idea, but we need to be extremely careful with the user interaction as well as failsafe edge cases (intermittent manual control with the stick in a weird position). At a minimum I'd update it to respect the systems notion of manual control lost (vehicle_status.rc_signal_lost) and put it behind a parameter that's disabled by default (at least to start). |
src/lib/FlightTasks/tasks/AutoMapper2/FlightTaskAutoMapper2.cpp
Outdated
Show resolved
Hide resolved
Why treat RC differently than mavlink? |
Yeah, that was my first thought. Nvm then. |
rgr rgr |
This is complete. Ready for final review. If you look at flight log from sim, I turned on/off the parameter as well as unplugged/replugged the RC. I probably won't make it to the dev call tomorrow. |
…. Added a _getLandSpeed function the the FlightTaskAutoMapper2 class which uses the manual_control_setpoint topic to adjust landing descent speed based on user input
Co-Authored-By: Daniel Agar <[email protected]>
…status.rc_signal_lost. Added a parameter for this feature that defaults to disabled.
3617ff4
to
ebd7ddf
Compare
@PX4/testflights Can you test this PR in mission mode and set |
@bresch @dagar, the feature is not working at the moment. Tested on Pixhawk 4 mini v5Procedure
Notes Log Tested on Pixhawk Pro v4 and Pixhawk 4 v5 and same results. |
@Junkim3DR , thanks for the tests. I checked the logs and it is actually working. The problem why you didn't see it is that this logic is only active in "land mode". During RTL, the drone is in land mode during the last 10 meters ( Here is the plot showing that it worked in your test: This is unfortunately the tiny last part of the flight (because it's only active during the last 10 meters): |
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.
Thanks for that nice feature!
The XY adjustments would also be something super nice. Currently we have to switch to manual position mode and is not as nice as being able to adjust the landing while in auto mode.
Actually I think my comment in the parameter file is wrong, looks like I changed it to
What do you think is best? A fixed small value like 0.5? A number that is a function of the land speed like the current implementation? Maybe another parameter to set this? I'll see what I can do for XY control, look for a PR soon. |
Right, I think 0.5 x land speed is a reasonable choice. Can you update the parameter description please? |
Done |
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.
All good now
float land_speed = _param_mpc_land_speed.get(); | ||
float head_room = _constraints.speed_down - land_speed; | ||
|
||
speed = land_speed + 2 * (0.5f - throttle) * head_room; |
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.
I don't want to offend at all but this implementation is quite hacky and needs improvement for sure.
Issues that come to my mind:
- Stick subscription and evaluation is duplicate to https://github.com/PX4/Firmware/blob/e25db0162019e5f0bb7171ec6f3db2f456672d95/src/lib/FlightTasks/tasks/Manual/FlightTaskManual.cpp#L70-L115 but misses important checks and e.g. deadzone.
- It's implemented in AutoMapper2 which duplicates big parts of AutoMapper so in some configurations this feature is not available.
- We should support general correction of the land location by sticks not only adjusting the land speed.
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 offense taken at all, I like critical feedback. I am pretty unfamiliar with FlightTasks in general, so indeed it may be hacky as I was unsure the correct spot to put this.
We should support general correction of the land location by sticks not only adjusting the land speed.
I've got a WIP branch open right now. My plan was to move the sticks stuff into the FlightTask
base class so I could use _evaluateSticks
It's implemented in AutoMapper2 which duplicates big parts of AutoMapper so in some configurations this feature is not available.
I was very confused by the naming of these two. Without getting intimate with the code, it is very unclear what their roles/responsibilities are. I actually implemented it AutoMapper
at first and then realized nothing was happening.
If you've got any suggestions or just random details in general don't hesitate to share. Thanks!
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.
I've got a WIP branch open right now. My plan was to move the sticks stuff into the FlightTask base class so I could use _evaluateSticks
I'm quite sure by now that inheriting all the data processing in the flight tasks does not scale. We should pull e.g. the stick processing into a library such that not every task that uses sticks has to inherit from Manual. (The same of course also for other reusable logic.)
I was very confused by the naming of these two.
That's definitely far from your fault. They do almost completely the same thing but for later auto task with the "AutoSmoothVel" ending (which is default) there are some small differences. We need to get rid of that duplication, here's the issue for that: #11209. The existence of Automapper and having two versions is in my eyes partly caused by the inheritance structure.
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.
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.
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.
Sweet! Have others found it useful? Haha I never did get around to allowing XY control, it would be cool if it did
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.
I think it doesn't get used that often because of RC override which by default makes it switch out of land when you move the sticks. We'll enable x, y control soon. We can still discuss how it should work together with the mode override.
btw I changed the behavior a bit to not have such a high downwards speed on the sticks. Is that a problem? We can maybe discuss in the dev call...
Describe problem solved by the proposed pull request
This allows user input to assist in a quicker land during the land routine. This is enabled by a parameter which defaults to disabled.
Test data / coverage
Tested in sim using a Taranis X7 plugged in via USB (QGC Joystick)
https://review.px4.io/plot_app?log=b3208c83-0f28-4a43-ba85-0324b4f785be
Additional context
This is a feature DJI has and I have found it to be extremely convenient. Users switching from DJI to PX4 builds are not going to like losing features 😉
Edit: it would also be cool to be able to adjust the X/Y position during land. If anyone else thinks this is worth adding I can do that as well.