def run(self,ang,gait): if self.s_run == 0: espeak.synth("I'm off for a run") self.s_run = 1 serial_out.setgait(gait) serial_out.state(0,1,1) nav.odo(1.5,ang) print ('run') serial_out.travel(ang,100,0)
def startup(): x = 0 while x < 10: serial_out.state(0,0,1) time.sleep(0.1) x +=1 Thread(target=play, args=("/home/hexy/git/JimBob2/Python/Sounds/r2d2.ogg",1)).start() p_servo.SetX(0) time.sleep(2) p_servo.SetX(180) time.sleep(2) p_servo.SetX(90) time.sleep(2) p_servo.SetY(60) time.sleep(2) p_servo.SetY(130) time.sleep(2) p_servo.SetY(90) time.sleep(2) reset() rise()
def walk(self,ang,gait): serial_out.setgait(gait) serial_out.state(0,0,1) serial_out.travel(ang,100,0) nav.odo(1,ang) print ('walk ', ang)
""" Startup """ startup() connected = lidar.connect(1) coords['i_CurPos'] = [10,1] nav.offset() susptime = time.time() haz = 0 temp = 0 espeak.synth("Hello, Jim Bob ready to go") c = 0 serial_out.setgait(0) serial_out.wait(25) serial_out.state(0,0,1) priorread = time.time()+2 lxpos = [2015,1915,1815,1715,1615,1515,1415,1315,1215] lypos = [[1578,2067],[1613,2070],[1648,2090],[1683,2101],[1718,2113]] espeak.synth("Clear the area") lc = 0 ld = 0 nav.offset() coords['i_CurPos'][0] = 10 coords['i_CurPos'][1] = 0 while(1): for x in xrange(0, 5): for y in xrange(0, 30): move.walk(0,x)