def init_motion(self): dm.initMotionManager() dm.playMotion(1) dm.headMoveToHome()
while True: # Get button states btn = dm.getButton() # If reset button is pressed change state back to init state if btn == Button.RESET: dm.walkStop() dm.motionLoadINI(WALKING_INI) state = States.INIT if state == States.INIT: print("Init.") sleep(2) # Sets up robot initial robot. This state is run only once. dm.walkLoadINI(WALKING_INI) dm.playMotion(52) # Bow Walk ready motion dm.headMoveToHome() look_dir = 1 # This is used to change directions when looking for the target state = States.READY elif state == States.READY: print("Ready.") # Wait for the start button press if btn == Button.START: state = States.FIND_TARGET # Look for target elif state == States.FIND_TARGET: print("Find Target.") # Get obj info from tracker
from pygame.locals import * import darwin_motions as dm from time import sleep DELTA_VEL = 0.5 pygame.init() screen = pygame.display.set_mode((300, 300)) CONFIG_INI = "/home/juarez/Darwin-tools/Data/config.ini" # Sets up all the Action, Walking, Head and Motion Manager dm.initMotionManager(CONFIG_INI) # Stand up in a nice motion dm.playMotion(51) dm.headMoveToHome() dm.walkPrintParams() X_AMPLITUDE = 0.0 Y_AMPLITUDE = 0.0 A_AMPLITUDE = 0.0 while True: # Get current values of pan and tilt for event in pygame.event.get(): if event.type == QUIT: sys.exit(1) elif event.type == KEYDOWN: if event.key == K_SPACE: if dm.walkIsRunning():
while True: # Get button states btn = dm.getButton() # If reset button is pressed change state back to init state if btn == Button.RESET: dm.walkStop() dm.motionLoadINI(WALKING_INI) state = States.INIT if state == States.INIT: print("Init.") sleep(2) # Sets up robot initial robot. This state is run only once. dm.walkLoadINI(WALKING_INI) dm.playMotion(52) # Bow Walk ready motion dm.headMoveByAngle(70, 90) look_dir = 1 # This is used to change directions when looking for the target state = States.READY elif state == States.READY: print("Ready.") # Wait for the start button press if btn == Button.START: find_ticks = 0 # Used in FIND_TARGET STATE state = States.FIND_TARGET # Look for target elif state == States.FIND_TARGET:
import pygame import sys from pygame.locals import * import darwin_motions as dm from time import sleep pygame.init() screen = pygame.display.set_mode((300, 300)) CONFIG_INI = "/home/juarez/Darwin-tools/Data/config.ini" # Sets up all the Action, Walking, Head and Motion Manager dm.initMotionManager(CONFIG_INI) # Stand up in a nice motion dm.playMotion(16) dm.headMoveToHome() while True: # Get current values of pan and tilt cur_pan = dm.headGetPan() cur_tilt = dm.headGetTilt() for event in pygame.event.get(): if event.type == QUIT: sys.exit(1) keys = pygame.key.get_pressed() # Amount to increment in each angle
def _init_motion(self): dm.initMotionManager(DEFAULT_CONFIG) dm.playMotion(52) dm.headMoveToHome()