I have been trying to implement a collision avoidance system on my boat to avoid obstacles above the surface of the water, such as a dock using a LIDAR-Lite v2 via PWM. I have configured everything consistently with the Wiki and I get proper distance readings from the LIDAR-Lite when obstacles are in range. I took the boat out to test and when it is switched to AUTO mode and not near any obstacles it just drives around in circles endlessly instead of going to the waypoint. After disabling the rangefinder and trying again, the boat navigated to the waypoint without issues.
I noticed that when the boat is not near any obstacles the LIDAR-Lite returns a value of 0 and so this could be causing it to constantly be avoiding a non-existant obstacle? Note that I do have RNGFND_MIN_CM = 20 cm, running on 3.11 Rover.
Can you please get the log file off the SD card and I’ll have a look. Note I only want ONE log file of when the issue occurs.
Here is the link to it: https://drive.google.com/open?id=0B4W366DVMiBKOXpPMWluNFA5ckU
The boat was driven out to a safe area in MANUAL mode and then switched to AUTO and that is when the issue occurred.
Defaults are on the left, your settings are on the right. Why is your throttle_max so low - super powerful boat?
THR_MAX 100.0000 45.0000
Your steer2srv_p is far far far too low. How did you get these values for your PIDs? This is why your boat drives in circles. Set them back to defaults and test again.
STEER2SRV_D 0.0050 0.1700
STEER2SRV_I 0.2000 0.2500
STEER2SRV_IMAX 1500.0000 500.0000
STEER2SRV_MINSPD 1.0000 0.5000
STEER2SRV_P 1.8000 0.0650
SPEED2THR_D 0.2000 0.1850
SPEED2THR_I 0.2000 0.5500
SPEED2THR_P 0.7000 0.1200
Your arming_check is set to 72 so your only checking GPS lock and RCFailsafe. Plus because ARMING_REQUIRE is off (set to 0) its just going to arm anyway. So if any of your other sensors are busted your not going to know. Is there a good reason for this? I STRONGLY recommend setting the arming_check back to the default of 1 and putting ARMING_REQUIRE to 1. If you can’t arm as a result of this is means something is wrong and it should be fixed - not that arming checks should be turned off.
ARMING_CHECK 1.0000 72.0000
ARMING_REQUIRE 1.0000 0.0000
Note that your FS_THR_VALUE is lower then your min throttle (RC3_MIN 983) so if you put the boat into AUTO and you throttle down you will go into failsafe and the action you have set is RTL. What this means is you have to put some throttle input on to keep the boat in AUTO mode.
FS_ACTION 2.0000 1.0000
FS_THR_VALUE 910.0000 1093.0000
However, in spite of the parameter settings something isn’t right. I haven’t finished investigating but there could be a bug. For some reason your obstacle detected count goes through the roof immediately. If the LIDAR doesn’t detect anything then the value should be maxed out at 40m but yours appears to go to 0. You haven’t got something on the front of the LIDAR like a blob of water or something? I assume its protected in some way from wav splash etc.
Can I see a photo of the setup?
I’ve confirmed its a bug. When a sound sonar goes out of range (pointed at the sky) it just reads maximum value. When the PulsedLight lidar goes out of range it reads 0. The obstacle avoidance code was originally only written for sonars when we didn’t have lidar back in the day. I have fixed it. It will be in the next Rover beta if your happy to test with that? Let me know.
Thank you for the comments regarding our parameters. I will look into the why the ARMING_CHECK has been cut down to so few checks and why the ARMING_REQUIRE is off. As you say, they should be on so I am thinking they were turned off during a testing session and haven’t been re-instated.
With regards to the throttle_max, we were having some trouble with our motors and had to cut them to half-power to keep them from burning out. We are getting some upgraded parts that once installed should allow us to operate at full power.
The boat actually drive relatively straight in auto - images below. It does seem to overshoot the corners so maybe this increasing the STEER2SRV_P would help with this? It also seems to be slightly off the desired transect course(Second Image) - any idea what would cause that?
The second image shows the survey transect as well as the actual path taken by the vessel. A few of the larger course deviations are from manual override to avoid obstacles
Thank you for your help.
Thanks for the fix! I’ll let keep you posted on how testing with the beta goes when it comes out.
Reduce your NAVL1_PERIOD to turn sharper corners.
I’d say its GPS affecting you in the second image. I can’t tell the difference between where the boat went and the lane but if its within a few meters that’s about as good as your going to get.
Did you have an article about how to use the lidar sensor to avoidance obstacles in auto mode for survey boats?