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

Discover the limitless potential of robot programming with Synthiam ARC Pro – where innovation and creativity meet seamlessly.

#1  

Do you mean a cliff detector?  I use an Sharp IR sensor and a script to detect cliff edges.

Alan

PRO
USA
#2  

do you have the Arduino code for that

#3  

No, I did it in Synthiam ARC with an EZ-B V4/2.

It is in the MyRoli MKII project under my name.  I believe the script and object are named Edge Detector (I am at work and can't open the project from here).

Alan

PRO
USA
#4  

ok talk later, thanks

#5  

This has come up a few times lately.  When I have a few minutes either tonight or maybe Wednesday I'll make a project without all the extra stuff just to demonstrate how this works.  Maybe even create a tutorial, although I never have enough free time for that lately.

Alan

#6  

I just posted a cliff detection sample project: https://synthiam.com/Community/Apps/cliff-detection-sample-18442

This uses an H-Bridge movement panel, and a Sharp IR sensor plugged into the ADC7 port.  The read-ADC control reads the value, and has a multiplier to adjust the sensitivity range.  The script waits for a change, and if the value is high enough that the robot would fall, it stops and backs up, then waits for further instructions.   You need to start the cliff detection script (in a real robot, you would probably call it from your init script) before driving the robot.

I believe I used a 5cm-30cm Sharp IR sensor, but I don't recall for sure.  You want one with a short enough range that it can detect drops when facing down from a mount point on the robot.

This could easily be adapted to use multiple sensors to detect cliffs on the sides and back and have different actions depending on which sensor triggered.

Alan

PRO
USA
#7  

Thanks for the info and the link, I will try later,

PRO
USA
#8  

I used my Arduino, com3 on ARC

sharp sensor:

used port ADC3

sharp IR radar

ADC graph

ADC  meter

ADC read

All went well