Пример #1
0
    INIT = -1
    READY = 0
    TRACK_TARGET = 1
    AIM_TARGET = 2
    SHOOT = 3
    FINISH = 4


class Button:
    START = 2
    RESET = 1
    NONE = 0


# Load tracker with .json color from command line
tracker = JHT(mode='single', 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
Пример #2
0
        self.last_x = x
        self.last_y = y

        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
Пример #3
0
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:
Пример #4
0
        self.lowest_tick = lowest_tick
        self.lowest_pos = lowest_pos
        self.highest_tick = highest_tick
        self.highest_pos = highest_pos
        self.leftmost_pos = leftmost_pos
        self.leftmost_tick = leftmost_tick
        self.rightmost_pos = rightmost_pos
        self.rightmost_tick = rightmost_tick

        self.x_amplitude = highest_X - lowest_X
        self.y_amplitude = highest_Y - lowest_Y


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

# 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
Пример #5
0
class States:
    INIT = -1
    READY = 0
    RUNNING_FORWARD = 1
    RUNNING_BACKWARDS = 2
    BACKWARDS_RECENTER = 3
    FINISHED = 4


class Button:
    START = 2
    RESET = 1
    NONE = 0


tracker = JHT(sys.argv[1], mode="sprint")

dm.initMotionManager(CONFIG_INI)


def updateLinearSpeed(cur_speed):
    if cur_speed >= MAX_X_SPEED:
        return MAX_X_SPEED
    else:
        return cur_speed + UPDATE_STEP


state = States.INIT
while True:
    btn = dm.getButton()
    if btn == Button.START: state = States.INIT
Пример #6
0
CONFIG_INI = os.path.abspath("sprint.ini")

class States:
    INIT = -1
    READY = 0
    RUNNING_FORWARD = 1
    RUNNING_BACKWARDS = 2
    BACKWARDS_RECENTER = 3
    FINISHED = 4

class Button:
    START = 2
    RESET = 1
    NONE = 0

tracker = JHT(sys.argv[1], mode="single")

dm.initMotionManager(CONFIG_INI)

def updateLinearSpeed(cur_speed):
    if cur_speed >= MAX_X_SPEED:
        return MAX_X_SPEED
    else:
        return cur_speed + UPDATE_STEP

state = States.INIT
while True:
    btn = dm.getButton()
    if btn == Button.RESET: state = States.INIT

    if state == States.INIT:
Пример #7
0
        self.lowest_tick = lowest_tick
        self.lowest_pos = lowest_pos
        self.highest_tick = highest_tick
        self.highest_pos = highest_pos
        self.leftmost_pos = leftmost_pos
        self.leftmost_tick = leftmost_tick
        self.rightmost_pos = rightmost_pos
        self.rightmost_tick = rightmost_tick

        self.x_amplitude = highest_X - lowest_X
        self.y_amplitude = highest_Y - lowest_Y


# Load tracker with .json color from command line
tracker = JHT(sys.argv[1], step_size=0.01, mode='single')

# Load motion manager with archery walking offsets

dm.initMotionManager(WALKING_INI)

debug_ticks = 0
state = States.INIT
while True:
    # Get button states
    btn = dm.getButton()
    debug_ticks += 1
    print(btn, debug_ticks)

    debug_ticks += 1