ArduPilot / ardupilot

ArduPlane, ArduCopter, ArduRover, ArduSub source
http://ardupilot.org/
GNU General Public License v3.0
10.73k stars 17.18k forks source link

Plane (tailsitter): starts the descent on the home only after it reaches it #25771

Closed robustini closed 6 months ago

robustini commented 9 months ago

Feature request

Is your feature request related to a problem? Please describe. The most critical phase of a non-vectored tailsitter flight is landing. After the transition in the case of (Q)RTL, the taisitter when switch into VTOL mode immediately begins the descent and repositioning to the home point. These two simultaneous maneuvers often cause instability, especially in windy conditions.

Describe the solution you'd like Instead, it would be very helpful if the tailsitter in the case of RTL behaved in this way:

1) Once the transition from plane to vtol is made, the code should store the height reached immediately after the transition angle 2) Waits a couple of seconds for it to stabilize perfectly vertically, only then reposition to the home point while maintaining the stored height 3) Start the descent for the land only after reaching the home after a few seconds so as to stabilize

Basically the behavior would be as if after a transition from Cruise to QLoiter the pilot waits a few seconds with the sticks centered, then gives a pitch and roll command by repositioning the tailsitter at the desired point while keeping the throttle in the center of the stick, once the point is reached he puts the throttle at idle to make the descent. When doing this with tx the tailsitter is absolutely stable, during RTL it is not. I have performed transitions from Cruise to QLoiter with repositioning hundreds of times without any problems, but RTL remains critical instead because precisely to repositioning it adds descent.

Platform [ ] All [ ] AntennaTracker [ ] Copter [ x ] Plane [ ] Rover [ ] Submarine

robustini commented 9 months ago

Here you can clearly see the downhill curve after in QRTL, and in this case it was not very critical since evenc with crosswind came very close to the home point.

immagine

Here, however, the problem is clearly visible.

immagine

Even on the SITL with Realflight with some wind and wheatherwane engaged the problem is clearly visible. This happens a lot in reality as well with the tailsitter well tuned, and it's not nice.

https://github.com/ArduPilot/ardupilot/assets/3864712/3c04a4a1-f9ad-41ab-8bbc-216ccb1e2b97

robustini commented 7 months ago

This is my QRTL concept explained with a video, which is easier to understand and where the result is clearly visible, obviously simulated using manual transition and repositioning with sticks. The tailsitter perform the transition in QRTL, as soon as it reaches the VT angle it stabilizes at that height for a few seconds, in this way the weathervaning feature has time to find if active the correct crosswind position, only then it is repositioned to the home keeping the height, once it reaches the point it always stabilizes for a few seconds then starts the descent. This is what it should do with the tailsitter, and if my programming skills were apt to implement it I would have already done so because this protects tailsitters during the most complicated maneuver under QRTL, which I precisely do not use for now and prefer to manually carry out that procedure.

https://github.com/ArduPilot/ardupilot/assets/3864712/a9bd517a-b1f4-4996-8940-5ad467f1b8d1

nishant-sg commented 7 months ago

Hi, I was trying to reproduce the issue , which frame type did you use?

robustini commented 7 months ago

Hi, I was trying to reproduce the issue , which frame type did you use?

I use the eXplora frame created for my tailsitter but it is irrelevant, it does this with any non-vectored tailsitter.

nishant-sg commented 7 months ago

Okay, I asked this becoz I am unable to get any quadplane to fly in SITL, as soon as I apply rc 3 input (throttle input) the map shows the plane spinning and on flightgear the plane is standing still. Infact the console HDG value keeps changing rapidly. Any idea why this happens ? Can you help?

robustini commented 7 months ago

This is not the correct forum for this, you are better off asking on Discord in the channel that contemplates simulators.

nishant-sg commented 7 months ago

Hi I have tried and implemented, the desired task, although I would like it to be verified before I submit a pull request. What I have done is: once the tail sitter is in QRTL mode and it completes VTOL transition, then it will maintain its altitude until it has reached its correct landing spot( x,y coordinates) and then immediately start descent. I don't have any 3D sim, I have only tested it using SITL console and map.

I am sharing a video of what it looks like as of now. In this example I have changed a lot of parameters to start the VTOL phase early and test the feature. As soon as you see position2 the vehicle is in VTOL mode and is slowly moving towards the landing spot maintaining the same altitude.

https://github.com/ArduPilot/ardupilot/assets/70840360/35c6c6cd-11e9-4cfd-9105-320f38024d1d

Let me know what you think of this.

robustini commented 6 months ago

Nice result @nishant-sg! From what I see on the sim it looks correct to me, although that doesn't look like a tailsitter to me because during the transition it maintains the same altitude and that's quite unlikely, mine usually gains in reality at least 10 meters. The only thing is that when it reaches the home point it should not start the descent immediately but do so after a few seconds, not less than three, so that the tailsitter stabilizes before starting the descent. If you have the code on one of your forks and share it I can test it with Realflight. And if it passes the test in the sim I can test it in the real flight before any of your PR, thanks!

nishant-sg commented 6 months ago

Hi! I have uploaded the changes to this fork (https://github.com/nishant-sg/ardupilot/tree/test). I have also reverted all the parameters back to normal. So I think it should be final product of what is required. Share the results, then if it requires a delay, will add that also.

robustini commented 6 months ago

Hi! I have uploaded the changes to this fork (https://github.com/nishant-sg/ardupilot/tree/test). I have also reverted all the parameters back to normal. So I think it should be final product of what is required. Share the results, then if it requires a delay, will add that also.

I saw your modification, thank you, and tested it. It would never be approved since you do not create a condition for the tailistter but this behavior by modifying the quadplane.cpp would cover all VTOLs. It does exactly what I asked for right after the transition, and in the video I made in fact you see that when it transitions to VTOL it maintains the 18 meters, so correct behavior here. From the code you have in fact removed the condition that contemplated repositioning in Z in case of QRTL, right. But you also see that when it reaches home it immediately starts its descent and given the very high angle of 50 degrees it loses attitude. In the second attempt I switch instead to QLoiter just before home and bring it down manually, that should do, i.e. arrived on home it should wait at least 3 seconds then start the descent, not immediately. Also after transitioning to VTOL always at least 3 seconds pause and then start translating to home. That pause is necessary for the tailsitter to tend to stabilize before making the descent or even repositioning in XY. However good start, some of the work is correct.

https://youtu.be/9-eGFlBw8I8

nishant-sg commented 6 months ago

Hi, I have gone through your concerns. I have added the tailsitter condition, so only tailsitters would be affected. Also I have added a 7second delay since 3 felt very less, but it can be easily changed in the code. Kindly test and please provide feedback. https://github.com/nishant-sg/ardupilot/tree/tailsitter-qrtl-fix

robustini commented 6 months ago

Hi @nishant-sg, I tested the latest fix and always make a video to show its behavior, and I insert in the second RTL some wind to increase the difficulty. As soon as the transition to VTOL is done it does not stop 5 seconds (I dropped from 7) as I had requested but proceeds towards immediately to home, it would be needed instead what I had requested. Very good behavior instead when it gets to home, stops 5 seconds and performs LAND. And you can see very well that now it doesn't go out of the flight envelope, it was as I thought, great! So once the pause is inserted even immediately after the transition the change is perfect, it was as I predicted, well done! The 5-second pauses should be two, one immediately after the transition into VTOL and the other (which works now) when it gets to home before doing the QLAND. This first pause is useful to further stabilize the tailsitter at the end of the transition and in the case of weathervaning to allow it to perform the automatic yaw rotation before beginning XY repositioning at constant Z, i.e. to translate to the home sideways. The second first immediately of the QLAND, i.e. the one that now works prevents starting the descent without first the tailsitter being stable with the nose up after repositioning in XY at constant Z.

https://youtu.be/HmkdrlRkClY

nishant-sg commented 6 months ago

So just to clear up before next changes, you want a 5 second delay after transition to VTOL and then a 5 second delay when it reaches the home location, correct?

robustini commented 6 months ago

So just to clear up before next changes, you want a 5 second delay after transition to VTOL and then a 5 second delay when it reaches the home location, correct?

Correct!

robustini commented 6 months ago

@nishant-sg complex thing to insert delay also after transition to VTOL?

robustini commented 6 months ago

@nishant-sg I did some tests, I think the point where the pause should be inserted is obviously in 'case QPOS_POSITION1:', but obviously with the tailsitter condition in QRTL.

nishant-sg commented 6 months ago

Hi, sorry for the delay got stuck somewhere. It might not be that tough to code, what I find more challenging is testing tail sitter since it is very hard to takeoff , so it creates a huge delay in the coding process as well. I will try and do something today.

robustini commented 6 months ago

Hi, sorry for the delay got stuck somewhere. It might not be that tough to code, what I find more challenging is testing tail sitter since it is very hard to takeoff , so it creates a huge delay in the coding process as well. I will try and do something today.

I don't understand the difficulty in getting tailsitter off the ground, you mean on SITL? You do not have to use a talisitter to do that test, a classic quadplane such as frametype is sufficient to check the first delay, as the rest now works. And in changing the code, at least here at my computer, if I only change the quadplane.cpp and recompile it takes 10 seconds. As it is very quick for me to make a change in the code and test it immediately, but so far only bad results.

nishant-sg commented 6 months ago

Hi, I have tried somethings and according to my understanding this should fix most of the issue of stabilising after transition. Pls share a video to the latest fix (https://github.com/nishant-sg/ardupilot/tree/tailsitter-qrtl-fix). It is a very small change but must definitely solve the issue. If it does not, it will give me a better understanding of what can be done. The transition distance is set quite high right now for testing purposes. One of the things I realised that cannot be done is that we stop after transition to VTOL. you see we are switching to VTOL 10 m away from our final point to disperse the momentum, but if we want to stop immediately it would be a very complex maneuver. Hence I suggest it to stay how it is currently as it is quite better from what it was initially. or we can change the distance when we switch to VTOL. Please share your thoughts. It would be great if you could share your mav.parm file along with your takeoff sequence thank you. I find it quite hard to understand whats happening in 2D

robustini commented 6 months ago

@nishant-sg the log and the video of your latest fix. In the second attemp, I increase one transition parameter to make it happen sooner. You can extract the parameters from the log.

00000047.ZIP

https://youtu.be/uJIEtrpfwJY

robustini commented 6 months ago

@nishant-sg I have yet to investigate but I have seen a problem that now occurs if the tailsitter passes the home point during QRTL. Instead of staying at the preset height it starts to climb many metres, and then regularly descends. In the video I show what happens by varying the Q_TRANS_DECEL parameter, if set to 6 (the default, wrong for that tailsitter) it overtakes the home point a lot but does not generate the problem, the same thing if set to 1, i.e. it anticipates the VT transition a lot. But if I set it to 4, i.e. it makes the transition practically on the home point, the problem is generated. I do not know if this is due to your modifications, but it certainly did not happen originally. Here the video and the log.

https://youtu.be/CDkLzWjN6Zs

00000004.ZIP

robustini commented 6 months ago

@nishant-sg this value was fine before, at 10, and that climb does not happen.

// distance that we switch to QPOS_POSITION2 const float position2_dist_threshold = 10.0

I would say that the correct modification is the one I have posted on my GitHub for reference. If you want to update yours to do a PR because now I see it with a lot of useless stuff, files that you didn't edit and whoie's in the commit.

https://github.com/robustini/ardupilot/commit/3f7a0c5c09057b643534995f7c223141a1230f60

robustini commented 6 months ago

@nishant-sg I realised why in some conditions the tailsitter was rising in the 7-second pause. I solved it by forcing the climb to 0 there as well. So in the quadplane.cpp it will be:

case QPOS_LAND_FINAL: { if (tailsitter.enabled() && now_ms-last_pos2_ms<7000) { set_climb_rate_cms(0);
break;

nishant-sg commented 6 months ago

So is the issue completely resolved? are you able to stabilize just after coming out of forward flight? If so then should we close this issue?

robustini commented 6 months ago

So is the issue completely resolved? are you able to stabilize just after coming out of forward flight? If so then should we close this issue?

Yes thanks, do you do a PR on this?

nishant-sg commented 6 months ago

Thanks to you for your support and the especially providing such wonderful feedbacks. Also if possible, please share video of the final changes. Yes I will do a PR on this now.

robustini commented 6 months ago

Thanks to you for your support and the especially providing such wonderful feedbacks. Also if possible, please share video of the final changes. Yes I will do a PR on this now.

I await your PR and comment with a video, without this modification and with.

robustini commented 6 months ago

Resolved by #26417