nit
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
import enum
|
import enum
|
||||||
|
import sys
|
||||||
import time
|
import time
|
||||||
|
import traceback
|
||||||
from copy import deepcopy
|
from copy import deepcopy
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
@@ -278,8 +280,15 @@ class DynamixelMotorsBus:
|
|||||||
self.port_handler = PortHandler(self.port)
|
self.port_handler = PortHandler(self.port)
|
||||||
self.packet_handler = PacketHandler(PROTOCOL_VERSION)
|
self.packet_handler = PacketHandler(PROTOCOL_VERSION)
|
||||||
|
|
||||||
if not self.port_handler.openPort():
|
try:
|
||||||
raise OSError(f"Failed to open port {self.port}")
|
if not self.port_handler.openPort():
|
||||||
|
raise OSError(f"Failed to open port '{self.port}'.")
|
||||||
|
except Exception:
|
||||||
|
traceback.print_exc()
|
||||||
|
print(
|
||||||
|
"\nTry running `python lerobot/common/robot_devices/motors/dynamixel.py` to make sure you use the correct port."
|
||||||
|
)
|
||||||
|
sys.exit(1)
|
||||||
|
|
||||||
self.port_handler.setBaudRate(BAUD_RATE)
|
self.port_handler.setBaudRate(BAUD_RATE)
|
||||||
self.port_handler.setPacketTimeoutMillis(TIMEOUT_MS)
|
self.port_handler.setPacketTimeoutMillis(TIMEOUT_MS)
|
||||||
|
|||||||
@@ -420,6 +420,7 @@ class KochRobot:
|
|||||||
if not record_data:
|
if not record_data:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# TODO(rcadene): Add velocity and other info
|
||||||
# Read follower position
|
# Read follower position
|
||||||
follower_pos = {}
|
follower_pos = {}
|
||||||
for name in self.follower_arms:
|
for name in self.follower_arms:
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ def log_control_info(robot, dt_s, episode_index=None, frame_index=None):
|
|||||||
|
|
||||||
def log_dt(shortname, dt_val_s):
|
def log_dt(shortname, dt_val_s):
|
||||||
nonlocal log_items
|
nonlocal log_items
|
||||||
log_items += [f"{shortname}:{dt_val_s * 1000:5.2f}={1/ dt_val_s:3.1f}hz"]
|
log_items += [f"{shortname}:{dt_val_s * 1000:5.2f} ({1/ dt_val_s:3.1f}hz)"]
|
||||||
|
|
||||||
# total step time displayed in milliseconds and its frequency
|
# total step time displayed in milliseconds and its frequency
|
||||||
log_dt("dt", dt_s)
|
log_dt("dt", dt_s)
|
||||||
@@ -149,11 +149,7 @@ def log_control_info(robot, dt_s, episode_index=None, frame_index=None):
|
|||||||
for name in robot.cameras:
|
for name in robot.cameras:
|
||||||
key = f"read_camera_{name}_dt_s"
|
key = f"read_camera_{name}_dt_s"
|
||||||
if key in robot.logs:
|
if key in robot.logs:
|
||||||
log_dt("dtRcam", robot.logs[key])
|
log_dt(f"dtR{name}", robot.logs[key])
|
||||||
|
|
||||||
key = f"async_read_camera_{name}_dt_s"
|
|
||||||
if key in robot.logs:
|
|
||||||
log_dt("dtARcam", robot.logs[key])
|
|
||||||
|
|
||||||
logging.info(" ".join(log_items))
|
logging.info(" ".join(log_items))
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user