def init_motion(self):
        dm.initMotionManager()
        dm.playMotion(1)

        dm.headMoveToHome()
        print("Dx:", dx)
        print("Dy:", dy)

        # Calculate average dx and dy with moving average parameters
        self.avg_dx = (self.alpha * dx) + (self.beta * self.avg_dx)
        self.avg_dy = (self.alpha * dy) + (self.beta * self.avg_dy)

        self.ticks += 1


# Load tracker with .json color from command line
tracker = JHT(sys.argv[1])

# Load motion manager with archery walking offsets

dm.initMotionManager(WALKING_INI)

state = States.INIT
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.
import darwin_motions as dm
from time import sleep
from head_tracker import JuarezHeadTracker as JHT

MAX_P = 15
MAX_X_SPEED = 15  # Max linear velocity
UPDATE_RATE = 3  # Number of ticks
UPDATE_STEP = 0.5  # Increment in speed each update

tracker = JHT()

dm.initMotionManager()

# Walk ready pose
dm.playMotion(51)

dm.headMoveToHome()
dm.headMoveByAngle(0.0, 105.0)
dm.walkSetPeriodTime(580.0)
initial_xOffset = -8.0
dm.walkSetXOffset(initial_xOffset)

sleep(5)

dm.walkPrintParams()


def updateLinearSpeed(cur_speed):
    if cur_speed >= MAX_X_SPEED:
        return MAX_X_SPEED
    else:
Example #4
0
import pygame
import sys
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:
    def _init_motion(self):
        dm.initMotionManager(DEFAULT_CONFIG)
        dm.playMotion(52)

        dm.headMoveToHome()