예제 #1
0
    def step(self, action):
        larm = action[0]
        rarm = action[1]
        lleg = action[2]
        rleg = action[3]

        servo = ServoMotorData()
        servo.arm.left = (larm / 2 + 0.5)
        servo.arm.right = (rarm / 2 + 0.5)
        self.client.move_servo_motor(servo)

        dc = DcMotorData()
        dc.wheel.left = lleg * 100
        dc.wheel.right = rleg * 100
        self.client.move_dc_motor(dc)

        observation = {
            'image': self.image,
            'pose': self.pose,
        }
        reward = 1
        done = None
        info = None

        return observation, reward, done, info
예제 #2
0
    def deactivate(self):
        # Called when action deactivated
        super().deactivate()

        smdata = ServoMotorData()
        smdata.arm.right = 0.0
        self.m.move_servo_motor(smdata)
예제 #3
0
    def activate(self):
        # Called when action activated
        super().activate()

        smdata = ServoMotorData()
        smdata.arm.left = 1.0
        self.m.move_servo_motor(smdata)
예제 #4
0
    def update(self):
        # Called every frame while action is activated
        super().update()

        if (random.random() < 0.005):
            smdata = ServoMotorData()
            smdata.arm.left = random.random()
            smdata.arm.right = random.random()
            self.m.move_servo_motor(smdata)
예제 #5
0
파일: minidora.py 프로젝트: ktnyt/SeedWBA
    def step(self, action):
        servo = ServoMotorData()
        if "armleft" in action: servo.arm.left = (action["armleft"] / 2 + 0.5)
        if "armright" in action:
            servo.arm.right = (action["armright"] / 2 + 0.5)
        if "headroll" in action: servo.head.roll = action["headroll"]
        if "headpitch" in action: servo.head.pitch = action["headpitch"]
        if "headyaw" in action: servo.head.yaw = action["headyaw"]
        self.client.move_servo_motor(servo)

        dc = DcMotorData()
        if "wheelleft" in action: dc.wheel.left = action["wheelleft"] * 100
        if "wheelright" in action: dc.wheel.right = action["wheelright"] * 100
        self.client.move_dc_motor(dc)

        observation = {
            'image': self.image,
            'pose': self.pose,
        }
        reward = 1
        done = None
        info = None

        return observation, reward, done, info
예제 #6
0
import cv2
import time
import random
from minidora import Minidora
from minidora.servo_motor import ServoMotorData

m = Minidora(self_host='0.0.0.0', minidora_host='minidora-v0-yayoi.local')

if __name__ == "__main__":
    while (True):
        smdata = ServoMotorData()
        smdata.arm.left = 1.0
        smdata.arm.right = 1.0
        smdata.head.roll = 0.0
        m.move_servo_motor(smdata)
        time.sleep(10.0)