class RobotsCommand(commands.Command): def run(self, options, arguments): self.robots = Robots() self.robots.loadYaml('config.yml') if not arguments: for name, robot in self.robots.robots.items(): self.executeFor(robot, options) else: for name in arguments: if name in self.robots.robots: self.executeFor(self.robots.robots[name], options) else: print('Robot %s not found' % name) return def executeFor(self, robot, options): pass def stop(self): if self.robots: self.robots.stop()
def run(self, options, arguments): self.robots = Robots() self.robots.loadYaml('config.yml') if not arguments: for name, robot in self.robots.robots.items(): self.executeFor(robot, options) else: for name in arguments: if name in self.robots.robots: self.executeFor(self.robots.robots[name], options) else: print('Robot %s not found' % name) return
class RobotCommand(commands.Command): def run(self, options, arguments): if not arguments: print('You must specify a robot name') return robotName = arguments[0] arguments = arguments[1:] self.robots = Robots() self.robots.loadYaml('config.yml') if robotName not in self.robots: print('Robot %s not found' % robotName) return self.execute(self.robots[robotName], options, arguments) def execute(self, robot, options, arguments): pass def stop(self): if self.robots: self.robots.stop()
def run(self, options, arguments): if not arguments: print('You must specify a robot name') return robotName = arguments[0] arguments = arguments[1:] self.robots = Robots() self.robots.loadYaml('config.yml') if robotName not in self.robots: print('Robot %s not found' % robotName) return self.execute(self.robots[robotName], options, arguments)
#!/usr/bin/env python # -*- coding: utf-8 -*- import time, math from rhoban.robot import Robots robots = Robots() robots.loadYaml('config.yml') sigmaban = robots['sigmaban'] sigmaban.motors.start(50) t = 0 sigmaban.motors.allHard() while True: t = t + 0.01 sigmaban.motors['Coude D'].setAngle(math.sin(t)*40) time.sleep(0.01) robots.stop()