JackBord Mars Rover Demo

Program


---

Mars Rover Program

---


prog_vars =

d/apr_dist 50

prog_vars.


prog_start =

pclear

print "Program Start"

i2con

-- Setup the Radar

uradar c1 c2

-- Forward

pb 125 60 ^p=bms 50|d250|stop^n=Fwd 2^

pb 125 95 ^p=bms 50|d500|stop^n=Fwd 5^

-- Back

pb 200 60 ^p=bms -50|d250|stop^n=Rev 2^

pb 200 95 ^p=bms -50|d500|stop^n=Rev 5^

-- Speed slider

psl 65 120 200 ^id=150^var=150^min=-100^max=100^ "/150"

-- Turns

-- LEFT

pb 35 60 ^p=sbms -65 65|d100|stop^n=L 10^

pb 35 95 ^p=sbms -65 65|d500|stop^n=L 90^


-- RIGHT

pb 300 60 ^p=sbms 65 -65|d100|stop^n=R 10^

pb 300 95 ^p=sbms 65 -65|d500|stop^n=R 90^

-- Claw

pb 250 155 ^p=svp a1 90^n=O^

pb 300 155 ^p=svp a1 180^n=C^

-- Approach

pb 50 250 ^p=approach^n=Approach^

-- STOP

pb 350 20 ^p=stop^n=STOP^fc=red^

-- Approach Slider

psl 50 275 200 ^id=apr^var=apr_dist^min=0^max=100^ "/apr_dist"

prog_start.


prog_loop =

-- main program loop

d100

ptl 10 0 ^tf=courier^ts=25^ "Radar /35"

prog_loop.



approach =

-- Get 25cm from an object with radar.

ptl 10 300 ^id=arvb^tc=black^ "apr /apr_dist cm"



bms 50

repeat 5000 ->

d100

ptl 10 0 "Radar /35"


any /35 <= /apr_dist ->

stop

ptl 10 300 ^id=arvb^tc=red^ "Arrived /35"

skipout

enda.

repeat.


"Ext Approach"


approach.

prog_stop =

print "Bye"

stop

prog_stop.