I did some tests of obstacle avoidance with a forward facing rangefinder (TeraRanger one) on a quadcopter with a pixhawk 2 running copter 3.5 rc7
In loiter mode it work realy fine and i can fly normaly.
but in althold i have a issue, when avoidace is on (switch on channel 7) the pitch angle change to 10° whatever the distance and with no obstacle forward.
like if copter always detecing a obstacle.
Did i miss somthing ?
I think i found a part off the probleme
param AVOID_DIST_MAX is 10m by defaut,
it’s a to hight value for the teraranger one who have 5 meter max detection in my config, so perhaps avoidance stay active all the time.
Thanks very much for the report.
I think you’re right and the problem is likely here: https://github.com/ArduPilot/ardupilot/blob/master/libraries/AP_Proximity/AP_Proximity_RangeFinder.cpp#L48
We are always treating the distance from the range finder is “valid” but we should actually only be using it if it’s between the range finder’s minimum and maximum distances. I’ll make a fix shortly and maybe you can retest it for me?
Which flight controller are you using by the way? Pixhawk compatible? Pixracer?
I’ve put this fix into master and I’ll also pull it into the next release candidate.
I’m a bit keen for you to test it before the -rc goes out though.
Ok i see the issue.
I planning flight tests today ( test changing the range finders minimum and maximum distances compared to the avoidance distance) but if you have a fix i can test it no prob.
I use a pixhawk 2.
I made new tests with the same version of the code.
The issue is always present even when the avoidance distance is between the min and max of the range finder detection distance.
very strange, but like i said perhaps i missed something.
Otherwise if you have a compiled version with fix i can test it.
Hello, Randy isn’t here today.
I compile the version with the fix for you, https://volumen.univ-ubs.fr/dr9stnn
Thanks for testing this !
I did a quick test yesterday.
now avoidance works fine in althold !
I planned more advanceds tests but the weather does not allow to fly at this time.
Nice, thank you for testing !
thanks for stepping in and helping out!
After complementary flights tests the obstacle avoidance work very well in both althold and loiter mode.
No issue when the avoidance distance is superior to the max reading distance of the rangefinder.
I did some tests changing random param in AVOID_ (distance, angle…) all works
Dear all, I just joined the community and here is my very first post. Please forgive my poor English as I am not a native speaker.
I recently bought a Lidar Lite V3 and installed on my quad. It works like a charm as a ranger finder for terrain following. This encouraged me to go further to try object avoidance.
I was so excited when I saw the radar (radius) window after configuring all required parameters according to the instruction here - http://ardupilot.org/copter/docs/common-rangefinder-objectavoidance.html#common-rangefinder-objectavoidance . It actually worked! But unfortunately, all of the excitement and joy stop here.
After rebooting the autopilot (PixRaptor), not only the radar window disappeared, the sonarrange also stop working. It simply does not work anymore no matter how many times I reboot the FC and reload Mission Planner. And yes, I even tried to install the 3.5.4-rc2.
It got to the point where I thought there should be something wrong with the Lidar, and the best way to verify my assumption was to restore all the parameters and brought the Lidar back as a pure ranger finder. Guess what? The Lidar was alive and I got the sonarrange reading back! Now that I confirmed the Lidar was working, I tried to set all required parameters for object avoidance accordingly, and the sonarrange freezed again!
I decided to figure out the root cause of this problem by changing those parameters one at a time and found out the problem comes from the RNGFND_ORIENT. As long as the RNGFND_ORIENT set to 25 (down), I can get the sonarrange reading correctly regardless other parameters settings. If the RNGFND_ORIENT set to any value other than 25, the sonarrange reading freezed even it is configured as a pure range finder!
Not sure if this is only me, and I would really appreciate some help.
Sorry to bother you. I encountered some weird problems when setting up the obstacle avoidance. I left a message few days ago but have not seen any comment so far. Just wondering if I asked the wrong question or maybe I should bring the question to other thread?
Thanks and Regards,
If it’s any consolation, I have the same problem with my LidarLite v3 - only works when RNGFND_ORIENT is set to 25 (down). Connected to a Pixhawk px4v2 via PWM and has been operating as downward facing LIDAR for several months. Currently using Mission Planner (latest) v1.3.52 and Copter v3.5.4. Waiting on a capacitor and cable set to try connecting via I2C but it will be several more weeks before the parts arrive
@Steven_Yen , @Alan_Winlaw
On Mission Planner, there is a ‘‘Hidden Window’’ you can invoke with CTRL-F,
You will see a box to enable proximity -RADAR- screen
Thanks Patrick. Proximity-Radar-Screen verifies that the LIDARLite is working in Forward orientation (0). Mission Planner flight details (status tab) shows sonarrange 0 and sonarvoltage 0.
Would be ideal to have MP HUD showing sonar values, but this gives me enough confidence to fly a test.
Thanks for sharing your setup and problem. For your reference, my LidarLite V3 is connected via I2C from the beginning with required capacitor.
So yours is working now with tips from Patrick?
Following advice from Patrick, I opened the Radar Screen. This didn’t “fix” anything but opened a small black window showing a quadcopter icon and distance measurements from the quad to the nearest obstacle.
When moving my quad around the room these distances changed. I measured the actual distances and compared these with the distances displayed on the radar screen. The two sets of measurements agreed and I concluded that the LIDARLite was working in the FORWARD orientation. IT ALWAYS HAD BEEN. I had been fooled by the zero readings of sonarvoltage and sonarrange in Mission Planner - Flight Details - Status Tab into believing that the LIDARLite was not working.
I don’t know why the sonar voltage and range show zero values in the FORWARD orientation. Don’t know why the Radar Screen doesn’t just pop-up when MP is launched. Waiting for a break in the rain to do a test flight and see if OBJECT AVOIDANCE is working for the FORWARD orientation. It did work when the LIDARLite was mounted in DOWN orientation.
Hope this helps.
Thanks for your information, Alan. As I mentioned in my question about a month ago – the Radar window automatically pop-up when I setup the avoidance the first time. But never showed up again thereafter. So I was miss-leaded by the sonar readings same as you.
@ppoirier Thank you so much, Patrick. Same as Alan, my problem has been solved based on your tips. May I have one more question if it is not too much trouble? If I have two ranger finders (one mounted forward and one facing down) , how I can configure the parameters so the forward one will be used as obstacle avoidance and the one facing down will be performing terrain following?
Again, thank you all for your great help!