LibrePilot Forum

Users => Applications - Autonomous Flight => Topic started by: startrek66 on September 18, 2018, 08:25:51 am

Title: RTB mode
Post by: startrek66 on September 18, 2018, 08:25:51 am
hi guys, currently flying with stabilized 1 and velocity roam. I would like to add RTB. I checked the page at the following link https://librepilot.atlassian.net/wiki/x/OwC4 and I set the parameters.
 I ask you if it is correct to set for the RTB mode the stabilization configuration equal to that of VELOCITY ROAM.
Regards
Title: Re: RTB mode
Post by: TheOtherCliff on September 18, 2018, 09:24:23 am
For this question, Velocity Roam is equivalent to Position Hold, so yes, RTB should work fine if VR is working fine.

Understand where "base" is.  By default it should be where you armed.  Make sure this works, I recall some issues where it actually seemed to be where the GPS first got a good lock.

In System -> Settings -> FligthModeSettings there is a settings called ReturnToBaseNextCommand.  Default value is Hold (PositionHold).  Consider whether you want to set it to Land (automatic landing after reaching base).

ReturnToBaseAltitudeOffset might need to be increased if you fly at ground level behind tall trees and want it to climb higher than the default of 10m before returning to base, but that is dangerous if it would typically hit the tree when climbing.

Understand that there are two forms of failsafe; RC, and FC.  They both work.  Consider setting a failsafe to do RTB.  Beware that you need to be careful to switch things off in the correct order once you set this up.  If the quad is armed, and you switch the transmitter off, it may jump up and do RTB.
Title: Re: RTB mode
Post by: startrek66 on September 18, 2018, 07:51:52 pm
Thanks for the information. I will use your advice to make a correct parameter setup. my quadcopter in VR mode flies well and holds the position when the gas is at 50%. here the video of one of my tests in position hold.

(use youtube.com link because youtu.be link does not work in the forum)
https://www.youtube.com/watch?v=3CamRUftk5Q

I definitely have to choose a type of fail safe. I would like to start with a return to the base without however autonomous landing. therefore the correct procedure should be as follows: takeoff with stabilized, removal and change in VR. then inserting the RTB mode. the quadrocopter should move above the vertical from which it takeoff, stopping at a height of 10 m higher than the one in which I entered the RTB mode. so I should switch to VR mode and take it to the landing.
Title: Re: RTB mode
Post by: startrek66 on September 23, 2018, 12:55:09 am
hi guys, currently flying with stabilized 1 and velocity roam. I would like to add RTB. I checked the page at the following link https://librepilot.atlassian.net/wiki/x/OwC4 and I set the parameters.
 I ask you if it is correct to set for the RTB mode the stabilization configuration equal to that of VELOCITY ROAM.
Regards
I ask you if I have correctly adjusted the setting of the thrust for the rtb mode (see photo)
Title: Re: RTB mode
Post by: TheOtherCliff on September 23, 2018, 08:19:09 am
I forget whether (default settings) RTB stops the motors when you move the throttle to zero.  I think it stops the motors.  Your FC failsafe is set to move the throttle to zero.  It's easy to test.  :)

I don't have "-100" throttle on any of my RTB failsafe setups.
Title: Re: RTB mode
Post by: startrek66 on September 23, 2018, 08:33:15 am
I forget whether (default settings) RTB stops the motors when you move the throttle to zero.  I think it stops the motors.  Your FC failsafe is set to move the throttle to zero.  It's easy to test.  :)

I don't have "-100" throttle on any of my RTB failsafe setups.
I found this fail safe motor setting as default in the gcs. I have only assigned that in case of fail safe intervention the RTB is activated. but how can I test without flying?
Title: Re: RTB mode
Post by: TheOtherCliff on September 23, 2018, 03:52:25 pm
I assume you are using FC failsafe (not RC failsafe).

Well you could take the props off, FMS to ATtitude (or Rate) mode, arm, carry quad away from Base location, increase throttle to 50% (motors should spin), switch transmitter off.  That would test that failsafe does what you think it does.  If you are using FC failsafe with the settings you posted, the motors should stop.

Also: take the props off, FMS to ATtitude (or Rate) mode, arm, carry quad away from Base location, increase throttle to 50% (motors should spin), switch FMS into RTB (motors change, but still running), reduce throttle to zero; motors should stop.  Increase throttle to 50%; motors should come back on.  That would test how RTB works with live transmitter sticks, not RTB with configured FMS stick positions.

Of course if you are using RC failsafe with throttle set to zero, there is no difference between these two.

I don't like taking my props off, so for a quad (different for airplane) I would:
 - fly at least 15m high and 50m away from Base,
 - be ready on FMS to switch to some mode you know works
 - throttle stick at hover power, switch FMS into RTB
 - if that is OK, it should climb 10m and start flying toward Base
 - for 1 or 2 seconds, play with throttle from 25% to 100%; changing the throttle like this should not actually do anything.
 - drop throttle from mid stick to zero and immediately move throttle back to mid stick
 - you should see motors stop and immediately restart, just like ALtitudeHold / ALtitudeVario thrust modes
Title: Re: RTB mode
Post by: startrek66 on September 30, 2018, 05:49:07 pm
I assume you are using FC failsafe (not RC failsafe).

Well you could take the props off, FMS to ATtitude (or Rate) mode, arm, carry quad away from Base location, increase throttle to 50% (motors should spin), switch transmitter off.  That would test that failsafe does what you think it does.  If you are using FC failsafe with the settings you posted, the motors should stop.


It works exactly like this

Also: take the props off, FMS to ATtitude (or Rate) mode, arm, carry quad away from Base location, increase throttle to 50% (motors should spin), switch FMS into RTB (motors change, but still running), reduce throttle to zero; motors should stop.  Increase throttle to 50%; motors should come back on.  That would test how RTB works with live transmitter sticks, not RTB with configured FMS stick positions.

Unfortunately I did not perform exactly your procedure. After changing RTB mode I turned off the transmitter and the engines didn't stop.
I'll do the test again, even if I think it's right that the engines don't have to stop.


Of course if you are using RC failsafe with throttle set to zero, there is no difference between these two.

I don't like taking my props off, so for a quad (different for airplane) I would:
 - fly at least 15m high and 50m away from Base,
 - be ready on FMS to switch to some mode you know works
 - throttle stick at hover power, switch FMS into RTB
 - if that is OK, it should climb 10m and start flying toward Base
 - for 1 or 2 seconds, play with throttle from 25% to 100%; changing the throttle like this should not actually do anything.
 - drop throttle from mid stick to zero and immediately move throttle back to mid stick
 - you should see motors stop and immediately restart, just like ALtitudeHold / ALtitudeVario thrust modes


I also have a new question about RTB. I didn't set the auto landing. I noticed that when the quadcopter arrives on the vertical of the base obviously it stops in hovering but swings on the sides. Is this oscillation normal?

Regards
Title: Re: RTB mode
Post by: TheOtherCliff on September 30, 2018, 06:32:04 pm
If you are using a DJI GPS, there is a known issue.  It oscillates east west about 4 seconds per cycle or so when doing position hold in many GPS modes like PH, VR, RTB-Hold, probably GPS Assisted modes, etc.  Are you using DJI GPS and is the oscillation east-west?  For me, the oscillation is worse or better depending on the direction of the quad.  I recall it being worse when the quad is pointing north.

Here is work around firmware that is compatible with 16.09 (and source code for you to build your own for other versions).  No need to erase or change settings.  Just flash the firmware.
https://forum.librepilot.org/index.php?topic=3012.msg21154#msg21154
Title: Re: RTB mode
Post by: startrek66 on September 30, 2018, 07:30:57 pm
I do not think I bought a Dji GPS. The seller wrote that it was set up for the Pixhawk. I attach a photo of the card. I saw these fluctuations today for the first time. With the VR mode there are absolutely no. these oscillations have appeared with RTB mode. I made a video


(https://uploads.tapatalk-cdn.com/20180930/7a6c1df1090c7f312fd4fe2eacd4baf8.jpg)

Title: Re: RTB mode
Post by: startrek66 on October 02, 2018, 08:26:17 am
link video

https://www.youtube.com/watch?v=G5IzKQBZ52c&app=desktop&persist_app=1
Title: Re: RTB mode
Post by: TheOtherCliff on October 02, 2018, 03:52:19 pm
I don't see a problem there.  Is it visible in FPV view maybe?
Title: Re: RTB mode
Post by: startrek66 on October 02, 2018, 04:20:20 pm
I don't see a problem there.  Is it visible in FPV view maybe?
Probably if you look at the video on smartphone the oscillations are not seen very much. however, I also have the footage in FPV that I will send.
Thank you
Title: Re: RTB mode
Post by: TheOtherCliff on October 02, 2018, 05:56:47 pm
How long per cycle of the oscillation?  One version of the east-west oscillation is a position oscillation that happens every 4 seconds or so.  The other version is an attitude oscillation that happens quicker than once a second.

Do you have your high current wire pairs all twisted properly?  I can imagine a reason this happens that is related to PDB to ESC wire pair not being twisted into a cable.

To know more about the problem, it would be good to test VR-hover and RTB-hover on the same day at roughly the same place on the same flight, and rotate while hovering to see if it is worse in some directions.  Maybe RTB to hover, rotate in RTB hover, throttle stick in center, switch to VR, rotate in VR hover.

- same day same place same flight in case it is related to wind or battery wiring twists for that flight
- rotating to see if it is different when pointing in some directions because I have seen different versions of the east-west oscillation that also happen with OP GPSv9

Wire sets to twist:
- battery to connector
- connector to PDB
- PDB to ESC
- ESC to motor

All this because I know that PH hover and VR hover use the same code and must act the same way.  I suspect that RTB hover also uses the same code and if it does, it should act the same as VR hover.
Title: Re: RTB mode
Post by: startrek66 on October 03, 2018, 12:15:09 am
This is the video.
Start con VR mode then engage RTB (at 00:07). At 00:47 start oscillations (sud-nord+ west-east)over the base. Disengage RTB, engage VR and Landing.
VR mode is asoldly without oscillations when I leave the power stick at 50%. I do not understand, if as you say RTB hold uses the same code of VR, the reason for the oscillations. I just twisted the ESC cables. It should not be necessary to twist other cables if until today the mode hold position with GPS works well and without oscillations

https://www.youtube.com/watch?v=hrq_KlBsGgg
Title: Re: RTB mode
Post by: TheOtherCliff on October 03, 2018, 04:29:42 am
Sorry.  I still don't see a problem.  You immediately went from RTB hover into VR landing.

It will do something that looks like an oscillation in order to come to a stop.  It is flying along, and to stop it must bank in a direction to apply the brakes.  Then when stopped, it removes the bank and becomes level.  That is the minimum that it must do to stop.  Depending on your tuning and other settings, this stopping procedure can be anything from slow and smooth to quick and jerky.  There might be some ringing too (decreasing oscillation that goes away) if something like PIDs are too high.

If you have RTB configured to go into a hover when it gets to base and you just let it sit there and hover, does it continue to oscillate or does it smooth out?  Does it do the same thing if you travel in VR and then suddenly stop?  I am guessing at this point that your Stabilization PIDs may be too high or that your control rates (like Stabilization->Advanced->MaxRateLimit is too high or one of the VtolPathFollowerSettings PID settings has been set too high.
Title: Re: RTB mode
Post by: startrek66 on October 03, 2018, 08:27:59 pm
Sorry.  I still don't see a problem.  You immediately went from RTB hover into VR landing.

It will do something that looks like an oscillation in order to come to a stop.  It is flying along, and to stop it must bank in a direction to apply the brakes.  Then when stopped, it removes the bank and becomes level.  That is the minimum that it must do to stop.  Depending on your tuning and other settings, this stopping procedure can be anything from slow and smooth to quick and jerky.  There might be some ringing too (decreasing oscillation that goes away) if something like PIDs are too high.

If you have RTB configured to go into a hover when it gets to base and you just let it sit there and hover, does it continue to oscillate or does it smooth out?  Does it do the same thing if you travel in VR and then suddenly stop?  I am guessing at this point that your Stabilization PIDs may be too high or that your control rates (like Stabilization->Advanced->MaxRateLimit is too high or one of the VtolPathFollowerSettings PID settings has been set too high.
Thanks for the reply. I answer you questions

Q. If you have RTB configured to go into a hover when it gets to base and you just let it sit there and hover, does it continue to oscillate or does it smooth out? 

A. Yes. continue without diminishing


Q. Does it do the same thing if you travel in VR and then suddenly stop?

A. No. in VR mode if I stop the quad it stabilizes immediately and I able to make stable movies.

Do you think it's a Pid regulation problem?


Title: Re: RTB mode
Post by: TheOtherCliff on October 04, 2018, 01:58:28 am
It may be one of the VtolPathFollowerSettings PIDs in System->Settings.  I would play around with settings in VtolPathFollowerSettings.  Press red up arrow "Save" at top of page to make your changes permanent.
Title: Re: RTB mode
Post by: startrek66 on October 06, 2018, 11:30:45 am
It may be one of the VtolPathFollowerSettings PIDs in System->Settings.  I would play around with settings in VtolPathFollowerSettings.  Press red up arrow "Save" at top of page to make your changes permanent.
I do not have much experience with these parameters and therefore not knowing the meaning I do not know where to focus my attention. Are there any examples of adjusting these pid or an explanation of their meaning? Moreover, according to you it might be a good choice to see what happens if instead of stopping the quadcopter on the vertical of the base program it for an automatic landing?
Title: Re: RTB mode
Post by: TheOtherCliff on October 06, 2018, 06:07:33 pm
The reason I didn't give an exact thing to adjust is that I don't know which and would have to play with it myself if I were having this problem.

I am guessing that the oscillation is in the horizontal direction, so anything that can influence that:
HorizontalPosP
HorizontalVelPID.Kp,Ki,Kd
VelocityFeedForward
BrakeHorizontalVelPID.Kp,Ki,Kd

I would try cutting each each one in half, only one setting at a time.  Put each back to default before trying another.  VelocityFeedForward I would try both doubling and halving.  I didn't research whether BrakeHorizontalVelPID is active or not in this case.  I rather doubt it.

Notice that there is a separate PID for VelocityRoam mode.  The P term is higher in VR mode.  VR is what works for you, but using that higher P term in other modes would make oscillation worse.  The fact that there is a separate PID for VR and it is higher makes me want to try lowering HorizontalVelPID.Kp even further as the first thing to try.  I would try lowering HorizontalPosP as the second thing to try.
Title: Re: RTB mode
Post by: startrek66 on October 08, 2018, 07:49:49 am
I did some tests again and uploaded two new videos showing the problem. I lowered the kp from 0.15 to 0.10 and the oscillation seems sweeter. I intervened on the parameter you indicated to change first.


https://www.youtube.com/watch?v=JEmTaIdc7qs

https://www.youtube.com/watch?v=STlxpEYN7IA&t=37s

I also tried to change the phase from hold to land and everything works perfectly. there are absolutely no oscillations. One hypothesis is that the definition of the code has remained incomplete?

Title: Re: RTB mode
Post by: TheOtherCliff on October 08, 2018, 05:37:26 pm
It does not happen in VR mode.  I find that puzzling.  Did you say that it used to work OK?

One more thing that I should have said sooner, is that I would recalibrate the mag sensor.  Be aware that the calibration is always gathering data, not just when you press the button 6 times.

I would also look for loose or cracked components (motor, arm).

For mag calibration:
- be far away from large things and metal things like car, LP gas tank, tall buildings, maybe even a watch
- it is best to use telemetry, not USB cable
- once calibration is started, do not put the model on the ground
- don't rotate it very fast

I see that you are using a standard PixHawk GPS/mag  Do you have Aux Mag Usage set to Aux Only (this is not default)?  (You should.)

You should also be using the default GPS protocol of Ublox (not NMEA).

I am guessing that RTB hover still lets you control yaw.  Maybe next time you could try slowly rotating yaw around 360 degrees while in RTB hover.

Here is a link to a fast east west oscillation that we never really did figure out.
https://forum.librepilot.org/index.php?topic=382.0
Title: Re: RTB mode
Post by: startrek66 on October 08, 2018, 11:11:58 pm
It does not happen in VR mode.  I find that puzzling.  Did you say that it used to work OK?

One more thing that I should have said sooner, is that I would recalibrate the mag sensor.  Be aware that the calibration is always gathering data, not just when you press the button 6 times.

I would also look for loose or cracked components (motor, arm).

For mag calibration:
- be far away from large things and metal things like car, LP gas tank, tall buildings, maybe even a watch
- it is best to use telemetry, not USB cable
- once calibration is started, do not put the model on the ground
- don't rotate it very fast

I see that you are using a standard PixHawk GPS/mag  Do you have Aux Mag Usage set to Aux Only (this is not default)?  (You should.)

You should also be using the default GPS protocol of Ublox (not NMEA).

I am guessing that RTB hover still lets you control yaw.  Maybe next time you could try slowly rotating yaw around 360 degrees while in RTB hover.

Here is a link to a fast east west oscillation that we never really did figure out.
https://forum.librepilot.org/index.php?topic=382.0

Q. Did you say that it used to work OK?
A. I did not understand,

Q. I would also look for loose or cracked components (motor, arm).
A. No component is broken

Q. I see that you are using a standard PixHawk GPS/mag  Do you have Aux Mag Usage set to Aux Only (this is not default)?  (You should.)
A. MAG is Aux Only


Q. You should also be using the default GPS protocol of Ublox (not NMEA).
A. Ublox

I will recalibrating the mag. Should I recalibrate it with what frequency?
Title: Re: RTB mode
Post by: TheOtherCliff on October 08, 2018, 11:44:16 pm
Quote
I will recalibrating the mag. Should I recalibrate it with what frequency?
Long ago I heard it said that the mag should be recalibrated frequently.  Even as often as at the beginning of each flying day.  I only recalibrate it if I have problems, which is basically never.  I have flown the same calibration for over a year, at sites 50km apart.  For me, a good calibration does not seem to need to be redone if you don't travel far.  If I flew at a site a long way away or a lot different (plains to mountains or central to ocean coast), I would recalibrate.

Q. Did you say that it used to work OK?
A. I did not understand,
Just trying to be certain whether it ever worked correctly for you.
... I saw these fluctuations today for the first time. With the VR mode there are absolutely no. these oscillations have appeared with RTB mode. I made a video

Next time I have my favorite GPS quad flying, I will try to remember to test RTB-hover again.  I guess I maybe have tested it once or twice because I forgot to change RTBNextCommand to Land.
Title: Re: RTB mode
Post by: startrek66 on October 09, 2018, 12:15:04 am
Quote
I will recalibrating the mag. Should I recalibrate it with what frequency?
Long ago I heard it said that the mag should be recalibrated frequently.  Even as often as at the beginning of each flying day.  I only recalibrate it if I have problems, which is basically never.  I have flown the same calibration for over a year, at sites 50km apart.  For me, a good calibration does not seem to need to be redone if you don't travel far.  If I flew at a site a long way away or a lot different (plains to mountains or central to ocean coast), I would recalibrate.

Q. Did you say that it used to work OK?
A. I did not understand,
Just trying to be certain whether it ever worked correctly for you.

... I saw these fluctuations today for the first time. With the VR mode there are absolutely no. these oscillations have appeared with RTB mode. I made a video

Next time I have my favorite GPS quad flying, I will try to remember to test RTB-hover again.  I guess I maybe have tested it once or twice because I forgot to change RTBNextCommand to Land.

Q. Did you say that it used to work OK?
A. I did not understand,[/quote]
Just trying to be certain whether it ever worked correctly for you.

Ok. The fact that I don't explain is why these oscillations only appear when the quadricopter stops in hovering waiting over the takeoff Point. If the setting is RTB + Land There are no problems and the Quadricopter lands in a stable way.
Title: Re: RTB mode
Post by: TheOtherCliff on October 16, 2018, 05:59:03 pm
Here is another user / thread with the same problem: oscillation in RTB hover.
https://forum.librepilot.org/index.php?topic=4466.0
Title: Re: RTB mode
Post by: startrek66 on October 16, 2018, 11:45:46 pm
Here is another user / thread with the same problem: oscillation in RTB hover.
https://forum.librepilot.org/index.php?topic=4466.0


Well, let's put our experiences together. Can we create a single discussion?