Hi! In the last period I messed up with the copter lidar terrain following in auto mode, but I couldn’t make it work, only if I switched EK3_SRC1_POSZ to 2, so it uses the rangefinder as primary vertical position source. I read that it is not recommended to do that, but that was the only thing that made my drone fly missions following the terrain height. In the mission planning, I settled the altitude frame as “TERRAIN”, and the value from the alt parameter was in my lidar range (I am planning mission between 4-8 meters, and my lidar can read 13 meters).
I need to mention that in altHold/PosHold, the quadcopter is flying by rangefinder value as height, as it should do in terrain following missions too.
In the first picture you can see that in the first part, the drone is flying a mission, where it is not respecting the rangefinder measurements, and then I put it in POSHOLD and I fly above some big ground denivelations, so I can see if the drone follows the ground (the last part of the mission is flying above that denivelations too, at a really low speed).
In the second picture you can see the drone flying a mission really close to the ground, and as you can see, it holds it height pretty good above the terrain (the mission altitude was set to 4 meters above the ground), but this is with ek3 Z soruce set to rangefinder.
This is the link with both log files from the attached pictures, so you guys can analize them too: WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free Parameters.param (20.9 KB)
Hi, I would like to correct the first comment you made. As long as WPNAV_RFND_USE is set to 1, and you have a valid downward-facing rangefinder reading and also a mission item with altitude frame as “terrain”, Copter will use the RangeFinder and not the terrain database (Irrespective of TERRAIN_ENABLE = 1). It will only use the terrain database if the rangefinder is not healthy (for eg. out of range)
Generally speaking, switching EK3_SRC1_POSZ to rangefinder is not what you want to do unless you can guarantee that the ground beneath you is entirely plain. Flying with that setting at a high altitude and uneven terrain below can, in fact, lead to (potentially fatal) problems in flight, and I would highly recommend you revert this parameter to the original.
I would suggest doing a terrain mission with rangefinder enabled and just posting a log of it in auto. That should be more than enough to figure out what the problem is…
The logs that I uploaded on wetransfer already are in auto with rangefinder enabled.
Log file 2023-01-12 16-48-57 is with EK3-SRC1_POSZ set to baro, and the other one is set to rangefinder.
Thanks for correcting it @rishabsingh3003! In some older versions of arducopter I have already run into some troubles having TERRAIN_ENABLE set to 1 while using rangefinder for terrain following in Auto Mode.
Sorry I did not see that log. I just had a look… Would it be possible for you to have a TLOG or even a mission file from that log?
I don’t think you are setting up your mission correctly (in the correct alt frame that you need)
I don’t have a mission file, but I cand provide you the TLOG from that day, but when I played it is showed nothing(this tlog is very long, but you can check it just for the previously given log file time).
If it is not usable for you too, I will do another test and I will provide all the data needed.
This is how I am setting up my missions:
@rishabsingh3003 Hi! Today I found some time to try another mission, but I still cannot see my tlogs (they are saving, but when I open them in mission planner, nothing happens). The mission was settled up at 8 meters with alt frame set to terrain, but it flew the mission way higher, and I got some random pitch oscilations (I only got them when I flew the mission at higher heights, at 4 meters it was ok. My lidar reading distance is 13 meters and I settled the angle_max to 40 degrees, so I think it gets out of the lidar range and does the flicks, but still I think that is not ok). I will attach the drone param file, the bin file and a youtube video, so you can see how badly it twitches on the pitch axis. Another thing that I cannot explain is why when it reaches waypoint 4, EKF3 lane switches to 0, and then some oscilations can be seen on the video? And when the drone was comming home, it got into battery failsafe (too cold outside), and then started to descend rapidly (as I saw in real life, about 5-8 meters), but on reported height in the OSD, it only descended 1 meter. parameters.param (20.9 KB) WeTransfer - Send Large Files & Share Photos Online - Up to 2GB Free (bin file) Arducopter Mission - YouTube
Screenshot with the mission setup: