Home | Trees | Indices | Help |
---|
|
List of available commands:
Gripper and Head:
Moving the arm joints one at a time, or together:
Moving the whole robot (the base):
Reading joint values:
Checking approximate joint value (when setting a joint to 0, it's often something like 0.0000134; aboutEq() does an approximate compare)
Raising/lowering the torso:
Temporarily pausing execution (but already initiated robot motions continue):
More examples:
ADVANCED USE: Simulated events impacting your script:
from event_simulator import EventSimulator # Callback invoked at specified times. Keep this # callback short. It runs in a different thread, # which should be free to generate further events. # For more sophisticated use, see next section # 'Even more advanced use.' def printWord(word): print(word) schedule = OrderedDict() schedule[2.0] = 'This' schedule[5.0] = 'is' schedule[6.0] = 'a' schedule[7.2] = 'test' EventSimulator().start(schedule, printWord)
EVEN MORE ADVANCED USE:
The following code creates a callback that upper-cases every word it receives. These results are queued for the application to pick from a queue:
# Callback function that returns a value: def timeToDoSomething(word): return word.upper() mySimulator = EventSimulator() eventSimulator.start(schedule, timeToDoSomething); eventQueue = eventSimulator.getEventQueue() while (True): try: event = eventQueue.get(block=True, timeout=4.0); except Empty: print("Queue empty for more than 4 seconds. Quitting.") sys.exit(); print event;
The many 'if' statements below just ensure that the robot will do something different each time you run this file.
|
|||
|
|||
|
Home | Trees | Indices | Help |
---|
Generated by Epydoc 3.0.1 on Thu May 2 16:55:57 2013 | http://epydoc.sourceforge.net |