An autonomous robot based on the RVR platform
To make the experience fit your profile, pick a username and tell us what interests you.
Previous versions of the DRVR code would predict a course, move, stop and repeat. The time taken to start and stop the robot for each move was substantial.
This update runs the robot at 25% speed continually and updates the course every second. This has improved the traversal time from 15-20 minutes to less than 7 minutes. The video above is a 10x time lapse of one loop.
The choice of 25% speed for 1 second, was to keep the move time approximately the same (We were running 50% speed for .5 seconds) and to give the computation time to run (.2 sec) I also improved the performance of a few routines by using numpy functions version python loops. The computation time was taking around 1 second, before I made those easy changes.
One of my frequent pieces of advice holds true: Make it work first, then optimize. Using python loops was easy and let me understand the algorithm before I replaced it with numpy routines. It didn't matter until I started pushing real-time processing.
In the video you can see some oversteer by the robot where it zigzags a bit towards the grass and then towards the middle of the path where it should be going mostly straight. That's because the prediction algorithm isn't matching as closely as it should, which causes the turn calculation to over correct. The prediction algorithm relies on some hard coded numbers rather than being calculated based on the speed, direction, and time. I think that'll be the next refinement and allow me to dynamically change the speed. To do that I'm going to need to collect some measurement data and add some math.
The path planning is also very simplistic. While it goes around the bench nicely in this video, it sometimes cuts it too close and catches a wheel on the bench. It's a bit hit or miss. I need to increase forward margin, so it starts turning sooner in a future update.
On other notes, I've started playing with ROS (Robot Operating System). It appears to include a lot of useful functionality. I'm still investigating, but once these changes are working I may move to that framework.
This is the updated design for the DRVR. We're still a bit overweight, but not much. The single 18650 cell can run the Raspberry Pi 4 and the Oak-D for about an hour, which is enough. The 3D printed parts are now very stable.
The path planning is improved in this version of the code improves the speed driving around the park to 15-20 minutes. Two big changes are included. First, by improving the stability of the camera we could remove the time the robot was spending waiting for everything to settle after each move.
The other change is that the previous code treated turning and distinct operations, and only knew how to turn left or right by a few degrees. It would:
The new version replaces step 3 and removes the delay in step 4
There's still a bit of a delay between each step it takes, so I need to dig into that a bit more and figure out where it is coming from. The path planning still needs more work. It caught a wheel on the bench (its nemesis) but managed to correct itself. It should give the bench a wider birth.
A quick update to the path planning code and DRVR can now make it around the park without human intervention. It's currently taking about 30 minutes to make a loop.
There were a couple improvements to the path planning algorithm to change the target line if we're not finding the path (like going uphill) and making sure there is a reasonable amount of path and not just a small section. This avoids the robot thinking it can sneak behind the bench near the grass which isn't nearly large enough.
There's a lot of room for improvement. The next ideas are:
We're not down to the 10 minute loop the previous version of the robot could do, but we're using tighter controls and I believe have potential to go much faster.
DRVR v2 is now making it around the park on its own (with just a few nudges from me). The loop is taking about an hour and luckily that's just about the limit of the power of the 3500mAh 18650 battery I'm using.
The video above (about 10x realtime) shows the camera image and a colorized version of the segmented image. The robot is trying to keep the grass at a consistent distance from the left edge about 3 feet in front of it.
The path planning is fairly simple at the moment. It tries to keep the left edge of the grass between the two vertical lines by turning left or right in small increments. When it is between the lines it goes straight.
There's a few interesting bits in the video:
At 0:39 DRVR approaches the bench.
At 0:41 The grass is at the right place, but the code notices the bench and turns right until it's in the valid range.
Starting at 1:06 the algorithm falls apart because we're going uphill and the target line is above the horizon. I should angle the camera down to avoid that and perhaps move the target line closer when the robot is on an incline. It got stuck and I had to manually give it a few instructions.
At 1:47 there's a different (similar) path planning problem. The left edge of the grass is no longer visible 3 feet in front of the robot. It's locking on to the grass on the far side of the path and spinning to the right. That is going to require some smarter rules to understand the geometry.
I'm moving the RVR base in small increments (3 degree turns, 1 foot movements). That seems to be difficult for the RVR. The Pi sometimes tells it to turn and nothing happens. It accumulates the desired heading and eventually the RVR makes a larger turn and catches up to the desired position. I believe I'd be better off if I calculated the correct heading from the image and told it to turn to that. That would consolidate several small turns into one larger one and avoid some of the static friction.
Overall I'd call this a successful run. It's way slower than the previous generation robot, mostly because it is trying to steer a tighter path and moves in 1 foot increments instead of 3 foot. The Oak-D should be able to process the data in real-time, but since it is taking pictures each frame (to make the video you saw above) there are delays to avoid camera shake and to write the images to the SD card. I'm sure I can improve the performance.
I ran into an unexpected issue with V2 of the DRVR.
If you look at the image I posted recently, DRVR v2 is comprised of the following:
When I tried to run the robot in that configuration it struggled to turn and move. After a brief period, the RVR Base started flashing yellow and orange which is an overheat warning. It then waits for a mandatory cool down period. Oops.
Doing a bit more research, the RVR Base has a maximum weight capacity of 250g. The current configuration is 550g. 300g for the battery and 250g for everything else.
Why do I have the extra battery? I knew that the Raspberry Pi and the Oak-D could consume a lot of power. Up to 5v at 3A. The battery has a 1A port and a 2A port so I could feed the Oak-D 1A and the Pi 2A.
The RVR has a USB port you can use for power, but that's limited to 2.1A. I tried running that to the Pi and powering the Oak-D from it. The RVR would run for a few steps and then eventually stop communicating with the Pi. I suspect a large power load from the base eventually caused a brown out of some sort.
To verify my software was working and to feel like I accomplished something, I ran the robot while holding the battery in my hand, and running a USB-C cable to the Pi 4 for power. Sure enough that worked really well. It did look like I was walking the robot with the USB cable acting as a leash.
I tried a smaller battery pack which was 200g. The robot worked better in that case. Still stalling a bit, but it would have a hard time with the hills in the park. 50/50 whether it would make it.
I've now got a small power supply that takes a single 18650 cell. That's down to 67g, I left that running the robot code in my office and it drained the cell in about 2 hours.
I think that will be light enough to remain on the robot and still provide enough power for the Pi 4 and Oak-D. We'll see in my next run.
I wanted some more power and smarter AI processing on my DRVR robot which led to V2. The Raspberry Pi has been upgraded from a 3 to a 4, but the real improvement is the Oak-D camera. This module has an Intel inference engine included in the camera itself. The new code is doing image segmentation to recognize the grass and the sidewalk on the camera, then does path planning to pick a route based on the segmented image on the raspberry pi.
The code has been updated in GitHub, but the path planning needs improvement and the UI needs to be updated to match. More reports coming soon.
Performance of the robot in driving only mode is about 3x better. The robot can drive itself around the park in about 30 minutes instead of 90. The vast majority of the time is now spent while RVR is executing motion commands. More details below.Read more »
Yesterday my autonomous robot successfully drove itself (*) around the park. 90 minutes to do a loop. There's more information on what I've done and my plans below.Read more »
The DRVR code base and robot can now be operated with a cell phone to collect training data, and the training results in a neural network that produces what I think are good results. The code is in the git repository.Read more »
Become a member to follow this project and never miss any updates