PRO
EzAng
USA
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 (view all EZB hardware)
EZ-B V4
by EZ-Robot
EZ-B v4/2 robot controller: dual Cortex ARM, Wi-Fi, audio/video, 24 servo/digital ports, I2C/UART, camera and Synthiam ARC control for custom robots
Wi-Fi / USB
Servos
24
Camera
Audio
UART
3
I2C
ADC
8
Digital
24
Related Robot Skill (view all robot skills)
Indoor Positioning System
by Synthiam
Infrared indoor positioning for ARC robots: dual-camera tracks IR beacon, shows real-time heading, path and EZ-Script navigation variables
Requires ARC
v16

Do you mean a cliff detector? I use an Sharp IR sensor and a script to detect cliff edges.
Alan
do you have the Arduino code for that
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
ok talk later, thanks
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
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
Thanks for the info and the link, I will try later,
I used my Arduino, com3 on ARC
sharp sensor:
used port ADC3
sharp IR radar
ADC graph
ADC meter
ADC read
All went well