Asked — Edited

How To Declaration Of Multiple Variables.

hi, im modifying one of the ARC examples for custom object avoidance 2. my robot is avoiding most obsticles right now. but when he gets boxed in I just want it to backup when it detects the left,right, center at 255. I tried this

if($PingL,$PingR,$PingC < $MinDist)
  Goto(AllBad)
endif

how can I do this?

here is the code

# Set the servo left position
$PosL = 20

# Set the servo center position
$PosC = 50

# Set the servo right position
$PosR = 80

# Set the mininum distance
$MinDist = 60

# Begin moving
Forward()
PWM(d19,35)


:Loop

# Scan left
Servo(d3, $PosL)
Sleep(150)
$PingL = GetPing(d4, d5)
if ($PingL < $MinDist)
  Goto(LeftBad)
endif


# Scan Center
Servo(d3, $PosC)
Sleep(150)
$PingC = GetPing(d4, d5)
if ($PingC < $MinDist)
  Goto(CenterBad)
endif

# Scan Right
Servo(d3, $PosR)
Sleep(150)
$PingR = GetPing(d4, d5)
if ($PingR < $MinDist)
  Goto(RightBad)
endif


# Scan Center again
Servo(d3, $PosC)
Sleep(150)
$PingC = GetPing(d4, d5)
if ($PingC < $MinDist)
  Goto(CenterBad)
endif
   

Goto(Loop)
:AllBad
Reverse(100,1000)
Right(100,960)


:LeftBad
Right(100, 960)
Forward(100)
Return()

:CenterBad
right(100, 960)
Forward(100)
Return()

:RightBad
Left(100, 960)
Forward(100)


ARC Pro

Upgrade to ARC Pro

ARC Pro is your gateway to a community of like-minded robot enthusiasts and professionals, all united by a passion for advanced robot programming.

United Kingdom
#1  

If conditions can include and and or;


If($PingR < $MinDist and $PingL < $MinDist)
  Goto(AllBad)
EndIf

or for 3


If($PingR < $MinDist and $PingL < $MinDist and $PingC < $MinDist)
  Goto(AllBad)
EndIf

#2  

ok I see, thanks

works good now, thank you!

#3  

Hey Guys well for deceleration multiple variables must visit that url:

scala> val x, y, z = 1 x: Int = 1 y: Int = 1 z: Int = 1

PRO
Synthiam
#4  

@markspend01, sorry. I'm unsure what your post means. Is it a question or a statement? Please elaborate...