dora-idefics2 / operators /robot_minimize.py
haixuantao's picture
fix minimized demo
1646f18
raw
history blame
917 Bytes
from robomaster import robot
from time import sleep
def wait(event):
if event is not None and not (event._event.isSet() and event.is_completed):
sleep(1)
ep_robot = robot.Robot()
assert ep_robot.initialize(conn_type="ap"), "Could not initialize ep_robot"
assert ep_robot.camera.start_video_stream(display=False), "Could not start video stream"
ep_robot.gimbal.recenter().wait_for_completed()
from dora import Node
node = Node()
for dora_event in node:
if dora_event["type"] == "INPUT":
[x, y, z, xy_speed, z_speed, pitch, yaw] = dora_event["value"].to_numpy()
print(dora_event["value"].to_numpy())
event = ep_robot.gimbal.moveto(
pitch=pitch, yaw=yaw, pitch_speed=50.0, yaw_speed=50.0
)
wait(event)
sleep(4)
event = ep_robot.chassis.move(x=x, y=y, z=z, xy_speed=xy_speed, z_speed=z_speed)
wait(event)
sleep(6)