-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
RTH Trackback #7988
RTH Trackback #7988
Conversation
Only thing that I would question is the altitude. Once it reaches the end of the track back, shouldn't it also use the standard RTH altitude settings? |
When it reaches the end of the track back it switches to the full normal RTH procedure so all the normal RTH settings including altitude apply. |
@breadoven it would be amazing to have this this as an option for RTH too, not only failsafe |
and BTW, I love this thing! |
Awesome. Thanks for confirming that. |
@breadoven. Firstly, thanks for the time you have put in to writing this feature. 👍 Its great! I got the chance to test it out on a fixed wing today. The HDOP was at 0.9, with 22 Sats. It was a little windy, which did effect a mission I later loaded the WP's for. If my F765-WSE data logger would work correctly I would give you logs... but alas it doesn't. |
Yeah, I tested it last night and it did the same. I was almost expecting it given RTH only uses loiter waypoints (spiral climb position and Home) but I was more interested in seeing how well it recorded track points than actually used them. I've fixed the reason it just loiters at the first trackpoint and also changed the trackpoint arrival detection so it's the same as WP Missions so hopefully it should actually try and follow the track next time I test. |
@DzikuVx @stronnag There's an issue bumping up the Nav Config template version from 15 to 16. Seems to be a Bits issue causing an overflow error. Any solution ? inav/src/main/navigation/navigation.c Line 103 in 885d643
|
Start again at zero, it's a 0-0xf bitfield (4bit, nibble). |
This is what I was thinking as well, having at least a CLI option/checkbox in Configurator that tells it to activate trackback on regular RTH as well as a real failsafe. I could see that bailing myself out of hairy situations quite often, since I tend to lose video well before I lose the RC link, so most of my returns are from me manually activating RTH mode after I determine I'm likely not getting video back. |
+1 for also having this as an option on regular RTH. |
I've already added normal RTH with ability to cancel the trackback using the ROLL stick RTH override so it reverts to normal RTH mode. Currently trying to improve track point logging so it only records points when it needs to rather than based on fixed distance increments which results in too many points when not required. Plane tends to roll around like a drunken sailor trying to tag all the points which works but not very efficient. Only really needs to log points when you're changing course or altitude. Course changes are easy enough on a plane, not so much on a multirotor when flying slowly. |
I tried it once.. It was certainly not fluid or rounded. Based on my experiences of fixedwing WP navigation, under various wind conditions, and short distances between points. Still, great work mate 👍 |
As this seems to be super useful killer feature, and also quite massive, let's plan it for 6.0. WDYT @breadoven ? |
Well it's been tested on FW and MR and seems to work as expected so could be 5.0 if due by end May. Needs a bit more testing just to double check things. Maybe @Jetrell can give it a try. One question is whether it's worth logging trackback at low speed below 3 m/s when the GPS course is unreliable. I've changed it to just revert to distance based logging every 20m from the last point at low speed but you could just not bother logging points at all (changes not committed yet). Probably just leave it like this since it only really affects MRs which probably wouldn't use Trackback anyway unless going longer distances in which case they'd be flying fast enough for a reliable course. |
Updated to default to distance based trackpoint logging when speed below 3 m/s. So course changes only considered at higher speeds when GPS course is reliable. |
The tests today were in windy conditions. Which I believe is good, because it shows the inadequacies of the navigation code, especially for fixed wing use. Which I will state.. Is no reflection on @breadovens work in this PR... Its been like this from the beginning. I tested both a multicopter and a fixedwing. This image was typical of all the MC course trackback tests, which I was very impressed by. The quads average speed was 30km/h, with equivalent gusty winds. While FW performance was as average as I expected... All this being based on how poorly @breadoven Somethings I noticed.
My view on this feature.. Besides the above mentioned things. I think it works as well as it can, with all things considered. |
It worked last time I tried it and I haven't changed anything affecting it since so it should have worked. It's Right Roll to exit to normal RTH.
Not sure how it could do that. I assume when you say exited Trackback you mean you turned RTH off (normal RTH not FS RTH) ? Trackback can only remain active if RTH is active. I'll check it though next test. The issue of wandering WP directional control on FW is something that needs looking at separately. Might just try big changes to the XY position PIDS to see if that helps. I made changes before which did result in straighter tracks between WPs but it still takes too long to settle down after turns, weaving back and fore side to side. When the WPs are closer together you're permanently in the weaving phase resulting in snaking tracks. I did realise there is something I missed which is RTH at the end of a WP mission. With Trackback enabled it will try and back track rather than head directly home, i.e. run the mission in reverse. I've fixed this now, but something to be aware of until I commit the changes. |
Yes, turned off RTH switch, - Once the weather gets better. I can go out and re-test some things. Just in case I didn't hold Right Roll long enough to exit trackback. Over the years I've tried many changes to the navigation settings in flight. I've made alterations to While I haven't found |
This is an awesome feature. Thank you @breadoven for working on this, and @Jetrell for the testing. |
One of the public test pilots had an Idea that could maybe be an option for scenario 3. Could you make the Trackback respect nav_rth_alt_control_override? |
Trackback can already be overridden using |
Is it possible to write/read a track on a microsd? To increase the number of points. |
@kasatka60 not possible currently with the existing implementation of the SD file systems AFAIK. Maybe in the future. Isn't 2000m trackback enough to regain control? |
Suddenly 2 megabytes will soon become small. |
@kasatka60 It's 2km of backtrack distance, not 2mb |
This is a great feature. I have 2 suggestions though:
|
@breadoven Today I went to test the feature and had some unexpected results - my quad disarmed mid-flight during RTH Trackback. Not sure it's related to Traceback since the Also I wonder if Blackbox log and last 10 seconds of DVR are attached. LOG00025.zip |
|
This tells us about bad compass calibration and/or magnetic interference? PosHold seems to work fine and I had no problems with normal RTH before (though in INAV 5.1).
Yeah... I wonder how it decided to do that and how landing detection came to conclusion that we've landed :) |
|
Hmm... How can I check that this actually kicked in? I have a few doubts:
|
mwp has a naive compass anomaly detector, which kicks in a few times (from the mwp replay log)
Where the 3 numbers are mag heading, CoG and (AFAIK) duration since armed in seconds, and a mag anomaly is declared if heading / Cog differ by 45⁰ over 3s. PH is not a great test, as it may not stress the power train, OTOH the observed 7A is pretty conservative. |
Ah, sorry to hear that. Looking at the log it appears it did indeed think it had landed, hence the disarm. When in failsafe it's always trying to detect a landing. In these circumstances it looks for rotational and translational movement to decide if it has landed. It seems to have gone into a stable hover with almost no vertical or horizontal velocity and little rotational movement, stable enough in fact to have triggered a landing. Not sure why it would have hovered in Trackback. Was it hesitating and hovering at each turn point ? There was a change made to make landing detection more reliable/faster but that may have increased the probability of a false trigger. It's a bit of a trade off. Either way landing detection during Failsafe needs rechecking to see what can be done to avoid this problem. |
Yes, it seemed that way. I can upload longer DVR somewhere. But essentially when it reaches some waypoint it breaks quite hard to 0kph, loiters for around 10sec and then moves forward. Then the same scenario on the next point. On some waypoints it spent almost zero time and moved to next one instantly.
Yeah, I've read that in release notes and now noted to decrease the sensitivity of landing detection. I wonder if that can be disabled completely somehow...
Yes, the current is rather low and mag is moved back quite, never had real problems with it in ~2 years. So I'd guess even if it's wrong then it's not that critical. RTH always brought it home. |
Note: This is really Anyway. Perhaps interesting (a) the way the RTH 'pauses' a few times, like "is this really right' and (b) it follows the predominant flight path rather than just going home. Almost like it runs out of trackback points and thinks "wtf, I'd better stop here". But I speculate. Wayfarer_2023-02-20_200850.mp4 |
I rather think this is trackback problem rather than mag v. CoG. |
Looking at the log it's hesitating at some waypoints because it didn't get close enough to tag the waypoint on arrival so it stops and hovers toward the waypoint until it is within the I think the issue here is probably to do with the fact that when in Failsafe there's a risk that if the MR hovers at a waypoint it may be stable enough to cause a false landing trigger. Trackback is tracking numerous waypoints whereas normal RTH only has to track 1 waypoint, the home point, so the risk of this happening during Trackback is increased although it could also happen at the home point if the MR hovers to move within the Either way this needs a fix. looking at the landing detection method again it seems that throttle position is not taken into account during Failsafe landing detection which might be a mistake. I think it was done this way to try and ensure landing detection would still work after a crash landing during Failsafe when the throttle position is unknown (controlled by Failsafe) so there was at least some chance the motors could be disarmed. It might be better to only detect a landing if the throttle is low or at least some margin below hover throttle. That would have prevented this accident happening at least. I guess the other option is to provide a setting to allow the user to decide what level of landing detection is required, only RTH final landing or also during manual/Failsafe control. |
Detecting a crash in failsafe and disarming the FC/ESC's if a motor is stalled, to prevent the craft catching on fire, or setting a field on fire. Was one of the landing detectors major advantages IMO.. I've seen this happen once. FYI Back when I did the original testing of Trackback on multi rotors. These were my settings on the quads. Also, the landing detector wasn't as sensitive back then. |
That's exactly what I wondered - why do we have a landing detection mid-flight? When the craft didn't reach the landing area yet. That should be two different protocols:
Will try larger waypoints and disabling slowdown to see if that helps. At least now I'll know that if it hovers during failsafe - it's dangerous and it's time to take control.
Not really big. It's Chimera 7" frame with 7.5" props. |
I need to check
The gyro average movement threshold was changed in #8427 from 2 to 4 deg/s to reduce sensitivity to "Airmode ground jitter". The quad in this case had average gyro rates around 2 deg/s when hovering at the 6th or so Trackback point. With the old gyro threshold it probably wouldn't have triggered a landing, but with 4 deg/s it did.
Landing detection works during Autonomous flight and also Manual flight. Detection during Autonomous flight it is only active during landing phases. During Manual flight detection is only active when the throttle is fully low. The only exception to this is Failsafe when landing detection is always active except during WP mode (to avoid false triggers during hold/hover WPs). You could also make it inactive during Trackback but Trackback doesn't guarantee you won't fly into things unlike WP missions where this shouldn't happen if planned properly. I did think about adding a crash G detection level to #8744. Just a question of deciding what G limit to use, i.e. how big an impact should it detect. The other thing that needs to be mentioned here is ... don't use Failsafe mode to trigger a RTH. That's not what Failsafe mode is for. It's really only intended to be used to test the Failsafe setup after which it shouldn't be used because it changes the behaviour of functions/modes including RTH in unexpected ways. RTH mode itself should always be used to initiate a RTH. This is covered in the Failsafe Wiki https://github.com/iNavFlight/inav/wiki/Failsafe. |
Having checked |
Hmm I wonder why it disarmed on me then when it was hovering and was still in autonomous phase?
Well.. thing is that the Trackback is really useful exactly during a failsafe event to get back the control of the drone and not hitting e.g. a mountain. That's why I'm using a failsafe switch to test it. I'm occasionally having these blackouts during mountain surfing when I lose the video so I quickly flip FAILSAFE and wait for it to get back to a line of sight. I can of course flip an RTH mode, but I want the drone to behave the same even when I lose the RC link. And if the behaviour in RTH-mode-initiated and Failsafe initiated is different - testing in RTH-mode is not what I want I guess. |
I went through many multicopter and fixed wing logs. To analyze the max G-forces encountered. While on a fixed wing, it was typical to see between 8G and 9.5G on the Z and X axis, during a hard stop, belly-flop landing. Besides the deceleration G-forces applied in a crash.. I imagine its highly likely that the craft would also experience a high rate of gyroscopic motion, as energy is transferred from one axis to the next as it tumbles or crumbles. |
Would having |
It won't disarm but it will reset PID accumulators. Not entirely sure what affect that has, never tried it. I'm assuming it will become less stable but continue to fly @DzikuVx ?. |
Adds option to back track on arrival route when RTH is triggered. Improves likelihood of recovering Rx signal if loss caused by line of sight obstruction whilst reducing the risk of flying into the obstruction compared to normal RTH heading directly back home.
When triggered the craft returns along the trackback route until the end is reached at which point it reverts to normal RTH heading directly home. It doesn't perform the RTH climb phase but instead uses the track point altitude but with altitude never allowed below the altitude of the start point so it can climb but never descend below the start point.
Currently allows 50 trackback points with a maximum trackback distance of 2000m. Distance can be set by user. Also includes a usage mode setting, OFF, ON and FS. ON works for normal and failsafe RTH, FS is for Failsafe RTH only.
Trackback points are recorded based on distance, altitude and course change from the last point. Course change points are logged at 45 degrees increments with a minimum distance of 10m between points. Altitude points are logged at 10m increments. Distance based points are logged at 100m increments if no course or altitude points have been logged within that distance. If no reliable course is available due to low ground speed only altitude and distance based points are logged with the distance increment reduced to 20m. Currently recording only starts when > 50m from home. Once the trackback points array is full new points cyclically overwrite from the start of the array. Should be noted the desired distance is only approximate since it's affected by the number of points recorded due to altitude and course changes. The more altitude/course change points recorded the lower the actual trackback distance will be, possibly by up to 10 - 20% (needs testing).
PR also includes change to Safehomes to "fix" issue noticed during testing which caused RTH to fly to Safehome if RTH triggered when less than
nav_min_rth_distance
from home. Not sure this as intended/desirable ? Change can be removed if it is.Ground and flight tested on a fixed wing and multirotor, recording and tracking back as expected. Also tested by analysing flight log tracks and applying the recording criteria above to produce a trackback track. The 2 tracks compare well when overlaid even with tight manoeuvring which is where most accuracy is lost.
Related to #7930.