Asked — Edited

Can Someone Help Part 2?

What I want the robot to do is move forward 3 seconds as long as nothing is detected in its path using adc5 or adc6, ir sensors. Sensors work fine. Have tried several iterations of scripting. No matter what I try the sensors do see above 60 but the robot never stops. Posting my scripts.

Check distance script with forward movement

:MonitorDistances $leftsensor = getadc(adc5) $topsensor = getadc(adc7) $rightsensor = getadc(adc6)

if ($leftsensor 60)or ($rightsensor >60) ControlCommand("Script Manager ", ScriptStart, "Emergency_Stop") EndIf


In this particular instance I called my emergency stop script which follows...

ControlCommand("Script Manager ", ScriptStopAll) SendSerial(D0,38400,64) SendSerial(D0,38400,192)

Again robot continues to go forward without stopping. Thanks guys! Chris

Skip to comments


Upgrade to ARC Pro

Don't limit your robot's potential – subscribe to ARC Pro and transform it into a dynamic, intelligent machine.


dang it

:MonitorDistances $leftsensor = getadc(adc5) $topsensor = getadc(adc7) $rightsensor = getadc(adc6)

if ($leftsensor <60)And ($rightsensor <60) ControlCommand("Script Manager ", ScriptStart, "forward_3_Seconds") ElseIf ($leftsensor >60)or ($rightsensor >60) ControlCommand("Script Manager ", ScriptStart, "Emergency_Stop") EndIf



don't know why my first post loses half of the script?


Use the code /code tags when posting scripts and it will stop doing that (and stop putting smilies at the end if some lines)



I may be able to help with the script too, but not until tomorrow morning because I am working a late shift today. Hopefully someone else will figure it out. I have a similar one doing edge detection, but only a single sensor and slightly different actions, so would need to poke a bit to see what is wrong here.



Without fully testing the logic....

You need a sleep statement in your loop. Can be as little as 50ms, but you can't just continuously loop on ADC sensor readings 10's of thousands of times per second, which is what your script is doing now. Probably not working because the ARC is on the verge of locking up.

I think your logic is otherwise correct, but again, I don't really have time to look in detail until tomorrow.



Guys I finally got it!

:MonitorDistances $leftsensor = getadc(adc5) $topsensor = getadc(adc7) $rightsensor = getadc(adc6)

ControlCommand("Script Manager ", ScriptStart, "Head Down") sleep(1200) ControlCommand("Script Manager ", ScriptStart, "Head Sweep") Sleep(2200)

if ($leftsensor <60)And ($rightsensor <60) ControlCommand("Script Manager ", ScriptStart, "forward_3_Seconds") ElseIf ($leftsensor >60)or ($rightsensor >60)

ControlCommand("Script Manager ", ScriptStart, "Stop")

EndIf Sleep(100) ) goto(MonitorDistances)