Browse Source

[upgrade] logging_mp, teleimager

main
孙昌贺 1 month ago
parent
commit
478248df33
  1. 2
      teleop/robot_control/hand_retargeting.py
  2. 2
      teleop/robot_control/robot_arm.py
  3. 2
      teleop/robot_control/robot_arm_ik.py
  4. 2
      teleop/robot_control/robot_hand_brainco.py
  5. 2
      teleop/robot_control/robot_hand_inspire.py
  6. 2
      teleop/robot_control/robot_hand_unitree.py
  7. 2
      teleop/teleimager
  8. 26
      teleop/teleop_hand_and_arm.py
  9. 2
      teleop/utils/episode_writer.py
  10. 2
      teleop/utils/ipc.py
  11. 2
      teleop/utils/rerun_visualizer.py
  12. 2
      teleop/utils/sim_state_topic.py

2
teleop/robot_control/hand_retargeting.py

@ -3,7 +3,7 @@ from pathlib import Path
import yaml
from enum import Enum
import logging_mp
logger_mp = logging_mp.get_logger(__name__)
logger_mp = logging_mp.getLogger(__name__)
class HandType(Enum):
INSPIRE_HAND = "../assets/inspire_hand/inspire_hand.yml"

2
teleop/robot_control/robot_arm.py

@ -12,7 +12,7 @@ from unitree_sdk2py.idl.unitree_go.msg.dds_ import ( LowCmd_ as go_LowCmd, LowS
from unitree_sdk2py.idl.default import unitree_go_msg_dds__LowCmd_
import logging_mp
logger_mp = logging_mp.get_logger(__name__)
logger_mp = logging_mp.getLogger(__name__)
kTopicLowCommand_Debug = "rt/lowcmd"
kTopicLowCommand_Motion = "rt/arm_sdk"

2
teleop/robot_control/robot_arm_ik.py

@ -9,7 +9,7 @@ import os
import sys
import pickle
import logging_mp
logger_mp = logging_mp.get_logger(__name__)
logger_mp = logging_mp.getLogger(__name__)
parent2_dir = os.path.dirname(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
sys.path.append(parent2_dir)

2
teleop/robot_control/robot_hand_brainco.py

@ -10,7 +10,7 @@ import time
from multiprocessing import Process, Array
import logging_mp
logger_mp = logging_mp.get_logger(__name__)
logger_mp = logging_mp.getLogger(__name__)
brainco_Num_Motors = 6
kTopicbraincoLeftCommand = "rt/brainco/left/cmd"

2
teleop/robot_control/robot_hand_inspire.py

@ -9,7 +9,7 @@ import time
from multiprocessing import Process, Array
import logging_mp
logger_mp = logging_mp.get_logger(__name__)
logger_mp = logging_mp.getLogger(__name__)
Inspire_Num_Motors = 6
kTopicInspireDFXCommand = "rt/inspire/cmd"

2
teleop/robot_control/robot_hand_unitree.py

@ -21,7 +21,7 @@ from teleop.robot_control.hand_retargeting import HandRetargeting, HandType
from teleop.utils.weighted_moving_filter import WeightedMovingFilter
import logging_mp
logger_mp = logging_mp.get_logger(__name__)
logger_mp = logging_mp.getLogger(__name__)
Dex3_Num_Motors = 7

2
teleop/teleimager

@ -1 +1 @@
Subproject commit 89d461330479ed0d71d642e092acea9e9fe71494
Subproject commit 2aab15d9601865ab6bee334ae26839e0306b0770

26
teleop/teleop_hand_and_arm.py

@ -3,8 +3,8 @@ import argparse
from multiprocessing import Value, Array, Lock
import threading
import logging_mp
logging_mp.basic_config(level=logging_mp.INFO)
logger_mp = logging_mp.get_logger(__name__)
logging_mp.basicConfig(level=logging_mp.INFO)
logger_mp = logging_mp.getLogger(__name__)
import os
import sys
@ -116,7 +116,7 @@ if __name__ == '__main__':
listen_keyboard_thread.start()
# image client
img_client = ImageClient(host=args.img_server_ip)
img_client = ImageClient(host=args.img_server_ip, request_bgr=True)
camera_config = img_client.get_cam_config()
logger_mp.debug(f"Camera config: {camera_config}")
xr_need_local_img = not (args.display_mode == 'pass-through' or camera_config['head_camera']['enable_webrtc'])
@ -251,7 +251,7 @@ if __name__ == '__main__':
while not START and not STOP: # wait for start or stop signal.
time.sleep(0.033)
if camera_config['head_camera']['enable_zmq'] and xr_need_local_img:
head_img, _ = img_client.get_head_frame()
head_img = img_client.get_head_frame()
tv_wrapper.render_to_xr(head_img)
logger_mp.info("---------------------🚀start Tracking🚀-------------------------")
@ -262,15 +262,15 @@ if __name__ == '__main__':
# get image
if camera_config['head_camera']['enable_zmq']:
if args.record or xr_need_local_img:
head_img, head_img_fps = img_client.get_head_frame()
head_img = img_client.get_head_frame()
if xr_need_local_img:
tv_wrapper.render_to_xr(head_img)
if camera_config['left_wrist_camera']['enable_zmq']:
if args.record:
left_wrist_img, _ = img_client.get_left_wrist_frame()
left_wrist_img = img_client.get_left_wrist_frame()
if camera_config['right_wrist_camera']['enable_zmq']:
if args.record:
right_wrist_img, _ = img_client.get_right_wrist_frame()
right_wrist_img = img_client.get_right_wrist_frame()
# record mode
if args.record and RECORD_TOGGLE:
@ -387,18 +387,18 @@ if __name__ == '__main__':
depths = {}
if camera_config['head_camera']['binocular']:
if head_img is not None:
colors[f"color_{0}"] = head_img[:, :camera_config['head_camera']['image_shape'][1]//2]
colors[f"color_{1}"] = head_img[:, camera_config['head_camera']['image_shape'][1]//2:]
colors[f"color_{0}"] = head_img.bgr[:, :camera_config['head_camera']['image_shape'][1]//2]
colors[f"color_{1}"] = head_img.bgr[:, camera_config['head_camera']['image_shape'][1]//2:]
else:
logger_mp.warning("Head image is None!")
if camera_config['left_wrist_camera']['enable_zmq']:
if left_wrist_img is not None:
colors[f"color_{2}"] = left_wrist_img
colors[f"color_{2}"] = left_wrist_img.bgr
else:
logger_mp.warning("Left wrist image is None!")
if camera_config['right_wrist_camera']['enable_zmq']:
if right_wrist_img is not None:
colors[f"color_{3}"] = right_wrist_img
colors[f"color_{3}"] = right_wrist_img.bgr
else:
logger_mp.warning("Right wrist image is None!")
else:
@ -408,12 +408,12 @@ if __name__ == '__main__':
logger_mp.warning("Head image is None!")
if camera_config['left_wrist_camera']['enable_zmq']:
if left_wrist_img is not None:
colors[f"color_{1}"] = left_wrist_img
colors[f"color_{1}"] = left_wrist_img.bgr
else:
logger_mp.warning("Left wrist image is None!")
if camera_config['right_wrist_camera']['enable_zmq']:
if right_wrist_img is not None:
colors[f"color_{2}"] = right_wrist_img
colors[f"color_{2}"] = right_wrist_img.bgr
else:
logger_mp.warning("Right wrist image is None!")
states = {

2
teleop/utils/episode_writer.py

@ -8,7 +8,7 @@ from .rerun_visualizer import RerunLogger
from queue import Queue, Empty
from threading import Thread
import logging_mp
logger_mp = logging_mp.get_logger(__name__)
logger_mp = logging_mp.getLogger(__name__)
class EpisodeWriter():
def __init__(self, task_dir, task_goal=None, task_desc = None, task_steps = None, frequency=30, image_size=[640, 480], rerun_log = True):

2
teleop/utils/ipc.py

@ -3,7 +3,7 @@ import zmq
import time
import threading
import logging_mp
logger_mp = logging_mp.get_logger(__name__, level=logging_mp.INFO)
logger_mp = logging_mp.getLogger(__name__)
"""
# Client → Server (Request)

2
teleop/utils/rerun_visualizer.py

@ -190,7 +190,7 @@ if __name__ == "__main__":
import zipfile
import os
import logging_mp
logger_mp = logging_mp.get_logger(__name__, level=logging_mp.INFO)
logger_mp = logging_mp.getLogger(__name__)
zip_file = "rerun_testdata.zip"
zip_file_download_url = "https://drive.google.com/file/d/1f5UuFl1z_gaByg_7jDRj1_NxfJZh2evD/view?usp=sharing"

2
teleop/utils/sim_state_topic.py

@ -14,7 +14,7 @@ from unitree_sdk2py.core.channel import ChannelSubscriber, ChannelFactoryInitial
from unitree_sdk2py.idl.std_msgs.msg.dds_ import String_
import logging_mp
logger_mp = logging_mp.get_logger(__name__)
logger_mp = logging_mp.getLogger(__name__)
class SharedMemoryManager:

Loading…
Cancel
Save