Esempio n. 1
0
import player_init
from burst_util import DeferredList
from burst.behavior import InitialBehavior
from burst_events import *
from burst_consts import *
import burst.moves as moves
from burst.walkparameters import WalkParameters
from burst.moves.walks import Walk
import sys

class EventsTester(InitialBehavior):

    def __init__(self, actions):
        InitialBehavior.__init__(self, actions=actions, name=self.__class__.__name__)

    def _start(self, firstTime=False):
        super(EventsTester, self).onStart()
        for attribute in dir(burst_events):
#        for attribute in ['EVENT_YGRP_POSITION_CHANGED', 'EVENT_YGLP_POSITION_CHANGED']:
            if attribute[:5] == "EVENT" and not attribute in ['EVENT_TIME_EVENT', 'EVENT_STEP']:
                self._eventmanager.register(lambda attribute=attribute: sys.stdout.write(attribute[:]+"\n"), getattr(burst_events, attribute[:]))



if __name__ == '__main__':
    import burst
    from burst.eventmanager import MainLoop
    mainloop = MainLoop(EventsTester)
    mainloop.run()
Esempio n. 2
0
        d = DeferredList([world.getRemainingFootstepCount(),
            world._memory.getData('Device/SubDeviceList/Battery/Charge/Sensor/Value',0)])
        d.addCallback(onResults)
    return d

if __name__ == '__main__':
#    time.sleep(3)
    import burst
    from burst.eventmanager import MainLoop
    #import atexit; atexit.register(moduleCleanup) # Make sure the file is closed down (and thus also flushed) when the program finishes.
    from sys import argv
    OUTPUT_FILE_NAME = os.environ['HOME']+'/src/burst/data/calibration/results_of_personalization_tests.csv'
    #OUTPUT_FILE_NAME = './testme.txt'
    outputFile = open(OUTPUT_FILE_NAME, 'a')

    # Determine the name of the robot you're running on. A bit sideways, I'll admit. Nevertheless:
    robotName = None
    for potentialRobotName in ['hagi', 'messi', 'gerrard', 'raul', 'maldini', 'cech']:
        if potentialRobotName in argv:
            robotName = potentialRobotName
            break
    else:
        print 'Please provide the robot\'s name, so that we can log the test\'s results.'
        exit()

    mainloop = MainLoop(PersonalWalkManualTweaker)
    mainloop.setCtrlCCallback(moduleCleanup)
    mainloop.run()
    #burst.getMotionProxy().getRemainingFootStepCount()