Bugfixes.

This commit is contained in:
Kevin Zakka 2024-04-04 16:27:32 -07:00
parent e6a660da6d
commit 7001842e7a
7 changed files with 18 additions and 17 deletions

View file

@ -106,7 +106,8 @@ def main(args):
if args.agent == "gello":
gello_port = args.gello_port
if gello_port is None:
usb_ports = glob.glob("/dev/serial/by-id/*")
# usb_ports = glob.glob("/dev/serial/by-id/*")
usb_ports = glob.glob("/dev/cu.usbserial*")
print(f"Found {len(usb_ports)} ports")
if len(usb_ports) > 0:
gello_port = usb_ports[0]

View file

@ -90,7 +90,7 @@ PORT_CONFIG_MAP: Dict[str, DynamixelRobotConfig] = {
gripper_config=(7, 20, -22),
),
# Right UR
"/dev/serial/by-id/usb-FTDI_USB__-__Serial_Converter_FT7WBG6A-if00-port0": DynamixelRobotConfig(
"/dev/cu.usbserial-FT7WBG6A": DynamixelRobotConfig(
joint_ids=(1, 2, 3, 4, 5, 6),
joint_offsets=(
np.pi + 0 * np.pi,

View file

@ -225,5 +225,5 @@ class ArmObservables(composer.Observables):
self.flange_position,
# self.flange_orientation,
# self.flange_velocity,
self.flange_angular_velocity,
# self.flange_angular_velocity,
] + self._collect_from_attachments("proprioception")

View file

@ -237,8 +237,8 @@ class DynamixelDriver(DynamixelDriverProtocol):
# Return a copy of the joint_angles array to avoid race conditions
while self._joint_angles is None:
time.sleep(0.1)
with self._lock:
_j = self._joint_angles.copy()
# with self._lock:
_j = self._joint_angles.copy()
return _j / 2048.0 * np.pi
def close(self):

View file

@ -86,11 +86,11 @@ class DynamixelRobot(Robot):
if gripper_config is not None:
current_joints = current_joints[:-1]
start_joints = start_joints[:-1]
for c_joint, s_joint, joint_offset in zip(
for idx, (c_joint, s_joint, joint_offset) in enumerate(zip(
current_joints, start_joints, self._joint_offsets
):
)):
new_joint_offsets.append(
np.pi * 2 * np.round((s_joint - c_joint) / (2 * np.pi))
np.pi * 2 * np.round((-s_joint + c_joint) / (2 * np.pi)) * self._joint_signs[idx]
+ joint_offset
)
if gripper_config is not None:

View file

@ -5,7 +5,7 @@ pygame
pyspacemouse
PyQt6
pyquaternion
pyrealsense2
# pyrealsense2
pure-python-adb
quaternion
tyro

View file

@ -18,15 +18,15 @@ class Args:
config = DynamixelRobotConfig(
joint_ids=(1, 2, 3, 4, 5, 6),
joint_offsets=(
-np.pi / 2,
1 * np.pi / 2 + np.pi,
np.pi / 2 + 0 * np.pi,
0 * np.pi + np.pi / 2,
np.pi - 2 * np.pi / 2,
-1 * np.pi / 2 + 2 * np.pi,
np.pi + 0 * np.pi,
2 * np.pi + np.pi / 2,
2 * np.pi + np.pi / 2,
2 * np.pi + np.pi / 2,
1 * np.pi,
3 * np.pi / 2,
),
joint_signs=(1, 1, -1, 1, 1, 1),
gripper_config=(7, 20, -22),
gripper_config=(7, 286, 248),
)
@ -40,7 +40,7 @@ def main(args: Args) -> None:
action_space = env.action_spec()
if args.use_gello:
gello = config.make_robot(
port="/dev/cu.usbserial-FT7WBEIA", start_joints=reset_joints_left
port="/dev/cu.usbserial-FT7WBG6A", start_joints=reset_joints_left
)
def policy(timestep) -> np.ndarray: