1.增加xbox控制器和飞行手柄控制器
2.增加多臂多控制器模式 3.末端姿态由欧拉角控制切换到四元数控制 4.增加vr手柄控制器 Signed-off-by: 1002142102@qq.com <1002142102@qq.com>
This commit is contained in:
64
robot_client/teleoperators/mix/mix.py
Normal file
64
robot_client/teleoperators/mix/mix.py
Normal file
@@ -0,0 +1,64 @@
|
||||
import queue
|
||||
import threading
|
||||
import pygame
|
||||
import time
|
||||
import sys
|
||||
from lerobot.teleoperators import Teleoperator,make_teleoperator_from_config
|
||||
from .config import MixConfig
|
||||
"""
|
||||
混合控制器。
|
||||
"""
|
||||
class Mix(Teleoperator):
|
||||
config_class = MixConfig
|
||||
name = "mix"
|
||||
def __init__(self, config: MixConfig):
|
||||
self.config = config
|
||||
self.teleopList = {}
|
||||
for name,teleop in self.config.teleopList.items():
|
||||
self.teleopList[name] = make_teleoperator_from_config(teleop)
|
||||
@property
|
||||
def action_features(self):
|
||||
action_features = {}
|
||||
for name,teleop in self.teleopList.items():
|
||||
for i,item in enumerate(teleop.action_features()["names"].keys()):
|
||||
action_features[f"{name}.{item}"] = i
|
||||
return {
|
||||
"dtype": "float32",
|
||||
"shape": (len(action_features),),
|
||||
"names": action_features,
|
||||
}
|
||||
|
||||
@property
|
||||
def feedback_features(self):
|
||||
return {}
|
||||
|
||||
@property
|
||||
def is_connected(self):
|
||||
return all([teleop.is_connected for teleop in self.teleopList.values()])
|
||||
|
||||
def connect(self, calibrate = True):
|
||||
for teleop in self.teleopList.values():
|
||||
teleop.connect(calibrate)
|
||||
@property
|
||||
def is_calibrated(self):
|
||||
return True
|
||||
|
||||
def calibrate(self):
|
||||
return all([teleop.calibrate() for teleop in self.teleopList.values()])
|
||||
|
||||
def configure(self):
|
||||
pass
|
||||
|
||||
def get_action(self):
|
||||
data = {}
|
||||
for index,teleop in self.teleopList.items():
|
||||
for key,item in teleop.get_action().items():
|
||||
data[f"{index}.{key}"] = item
|
||||
return data
|
||||
|
||||
def send_feedback(self, feedback):
|
||||
pass
|
||||
|
||||
def disconnect(self):
|
||||
for teleop in self.teleopList.values():
|
||||
teleop.disconnect()
|
||||
Reference in New Issue
Block a user