Asked — Edited

Sharp IR On Car Robot, Table Top Robot Avoids Falling Off

anyone know how to write this code in java?

:loop adc_wait(adc0,lower,160) stop() reverse(200,500) sleep(50) left(255,500) stop() forward() sleep(50) goto(loop)

now it starts, avoids falling off table, turns left, keeps going - cheers! All figured out below, I solved it below with help of thetechguru

thanks


Related Hardware EZ-B v4
Related Control Indoor Positioning System

ARC Pro

Upgrade to ARC Pro

Experience the transformation – subscribe to Synthiam ARC Pro and watch your robot evolve into a marvel of innovation and intelligence.

PRO
USA
#9  

thetechguru,

I know this is an old thread, but I have a question.

Why do you use the H-Bridge Movement Panel in your app?

I use the servo Movement Panel for the wheels.

I am interested in table top robots that don't fall off the table  :-)  anymore info?

#10  

@EzAng I was using a Roli.  It has an HBridge and motors, so I needed the HBridge Movement Panel to make it work, but the example will work with any movement panel.  It just issues a stop, then a short back any time the IR detector discovers the distance increase.  I only put one on the front, but you would probably want them at each corner with approptiate scripts for a tabletop robot so it doesn't back or turn its way off the table when responding to one of hte sensors.  Maybe a script that just does a panic stop if 2 detectors trigger at once.

Alan

PRO
USA
#11   — Edited

any sensors better then the sharp IR for table top robots that don't fall off the table?

Does this need a left or right turn to avoid the edge while it is in reverse?

User-inserted image

#12  

I think the IR is pretty good for this use.  It is sensitive and fast.

As far as the script, it depends on how the robot is being driven.  This script is just a panic stop.  If you want it to continue moving, then yes, you probably want it to make a turn, and then pass control back to whatever you are using to drive it.  (When I wrote it, I was manually driving using the movement panel, so when it panic stopped, I took care turning and recovering...).

Alan

PRO
USA
#13  

I tried this

User-inserted image

works ok then stops, have to keep starting the robot

be back later for more, thanks

EzAng

#14  

Instead of the stop before the :loop, you will need to tell the script to return to what it was doing previously, whether that is a separate script or a control command, or just a forward()

Alan

PRO
USA
#15  

Hi, I made it back,

I will try what you said, thanks

PRO
Portugal
#16   — Edited

The Roomba and most vacuum robots use IR sensors for cliff detection.