Ejemplo n.º 1
0
	def execute(self):
		if "l" in self.modifiers or "left" in self.modifiers:
			self.pid = BasicMotion.closeLeftHand()
		elif "r" in self.modifiers or "right" in self.modifiers:
			self.pid = BasicMotion.closeRightHand()
		else:
			raise ParseError, "right/left expected"
Ejemplo n.º 2
0
	def execute(self):
		if "l" in self.command:
			self.pid = BasicMotion.openLeftHand()
		elif "r" in self.command:
			self.pid = BasicMotion.openRightHand()
		else:
			raise ParseError, "right/left expected"
Ejemplo n.º 3
0
	def execute(self):
		modifiers = self.command[len(Util.StringTokenizer(self.command).nextToken()):]
		if "l" in modifiers:
			self.pid = BasicMotion.unflexLeftArm()
		elif "r" in modifiers:
			self.pid = BasicMotion.unflexRightArm()
		else:
			raise ParseError, "right/left expected"
Ejemplo n.º 4
0
	def execute(self): # TODO: Fix.
		if len(self.modifiers) < 1:
			raise ParseError, "distance expected"
		distance = float(self.modifiers[0])
		if len(self.modifiers) == 1:
			self.pid = BasicMotion.slowStraightWalk(distance)
		else:
			gait = self.modifiers[1]
			if gait in ["slow", "slowly", "s"]:
				self.pid = BasicMotion.slowStraightWalk(distance)
			elif gait in ["fast", "f", "quick", "quickly", "q"]:
				self.pid = BasicMotion.fastStraightWalk(distance)
			else:
				print "Unsupport gait. Choose either slow, fast, or leave empty to default to slow."
Ejemplo n.º 5
0
 def trigger(clazz, joystickStatus):
     global robotStatus
     if robotStatus == "turning left":
         BasicMotion.addTurn(1.0)
     else:
         if "walking" in robotStatus or "turning" in robotStatus:
             BasicMotion.stopWalking()
         BasicMotion.turn(1.0)
     robotStatus = "turning left"
Ejemplo n.º 6
0
 def trigger(clazz, joystickStatus):
     global robotStatus
     if robotStatus == "walking backwards":
         BasicMotion.addWalkStraight(-0.1, 60)
     else:
         if "walking" in robotStatus or "turning" in robotStatus:
             BasicMotion.stopWalking()
         BasicMotion.slowStraightWalk(-1.0)
     robotStatus = "walking backwards"
Ejemplo n.º 7
0
	def execute(self):
		if len(self.modifiers) == 0:
			BasicMotion.getUp()
		elif self.modifiers[0] == "front":
			BasicMotion.getUpFromFront()
		elif self.modifiers[0] == "back":
			BasicMotion.getUpFromBack()
		else:
			raise ParseError, self.command + " accepts the following modifiers: front/back."
Ejemplo n.º 8
0
	def execute(self):
		self.pid = BasicMotion.initPosition()
Ejemplo n.º 9
0
	def execute(self):
		if len(self.modifiers) < 1:
			raise ParseError, "how much should I turn?"
		self.pid = BasicMotion.turn(self.modifiers[0])
Ejemplo n.º 10
0
	def wait(self):
		BasicMotion.wait(self.pid)
Ejemplo n.º 11
0
	def execute(self):
		BasicMotion.stopWalking()
Ejemplo n.º 12
0
	def execute(self):
		BasicMotion.killAllTasks()
Ejemplo n.º 13
0
    def trigger(clazz, joystickStatus):
        global robotStatus
#        BasicMotion.clearPendingTasks()

        BasicMotion.getUp()
        robotStatus = "getting up"
Ejemplo n.º 14
0
	def execute(self):
		self.pid = BasicMotion.setStiffness(0.0)
Ejemplo n.º 15
0
 def trigger(clazz, joystickStatus):
     global robotStatus
     if "walking" in robotStatus or "turning" in robotStatus:
         BasicMotion.stopWalking()
     robotStatus = "at rest"
Ejemplo n.º 16
0
	def execute(self):
		if len(self.modifiers) < 2:
			raise ParseError, "coordinates expected"
		x = self.modifiers[0]
		y = self.modifiers[1]
		self.pid = BasicMotion.moveHead(x, y)
Ejemplo n.º 17
0
	def execute(self):
		self.pid = BasicMotion.zeroPosition()
Ejemplo n.º 18
0
from burst import burst_exceptions
from burst.burst_exceptions import *
#import Util

# TODO: If running on the robot, user 127.0.0.1 as the address?

burst.init()
print "Controlling the robot at " + burst.ip + ":" + str(burst.port)

import BasicMotion

# Let the user choose an action, perform that action, repeat.
import Commands
from Commands import *

BasicMotion.headStiffnessOff()

try:
	while True:
		selection = raw_input("> ")
		try:
			x = Commands.CommandParser.parse(selection)
			x.execute()
		except UnsupportedCommand, e:
			print "Error: Unsupported command (" + str(e) + ")."
		except ParseError, e:
			print "Error: Could not parse the command (" + str(e) + ")."
		except NotLyingDownException, e:
			print "Not lying down."
		except UnsafeToGetUpException, e:
			print "It's not safe to get up - the robot is probably lying on its side."
Ejemplo n.º 19
0
 def trigger(clazz, joystickStatus):
     global robotStatus
     if "walking" in robotStatus or "turning" in robotStatus:
         BasicMotion.stopWalking()
     robotStatus = "exiting"
     raise QuitException