Skip to content

Commit 2633805

Browse files
authored
Merge branch 'master' into chore/add_go2_realsense_urdf
2 parents c480754 + c4e5119 commit 2633805

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

go2_robot_sdk/go2_robot_sdk/go2_driver_node.py

+3-3
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def __init__(self):
8989
self.publish_raw_voxel = self.get_parameter(
9090
'publish_raw_voxel').get_parameter_value().bool_value
9191

92-
self.conn_mode = "single" if len(self.robot_ip_lst) == 1 else "multi"
92+
self.conn_mode = "single" if (len(self.robot_ip_lst) == 1 and self.conn_type != "cyclonedds") else "multi"
9393

9494
self.get_logger().info(f"Received ip list: {self.robot_ip_lst}")
9595
self.get_logger().info(f"Connection type is {self.conn_type}")
@@ -368,7 +368,7 @@ async def on_video_frame(self, track: MediaStreamTrack, robot_num):
368368
# Publish image and camera info
369369
self.img_pub[robot_num].publish(ros_image)
370370
self.camera_info_pub[robot_num].publish(camera_info)
371-
asyncio.sleep(0)
371+
await asyncio.sleep(0)
372372

373373
def on_data_channel_message(self, _, msg, robot_num):
374374

@@ -472,7 +472,7 @@ def publish_voxel_webrtc(self):
472472
for i in range(len(self.robot_lidar)):
473473
if self.robot_lidar[str(i)]:
474474
voxel_msg = VoxelMapCompressed()
475-
voxel_msg.stamp = self.robot_lidar[str(i)]['data']['stamp']
475+
voxel_msg.stamp = float(self.robot_lidar[str(i)]['data']['stamp'])
476476
voxel_msg.frame_id = 'odom'
477477

478478
# Example data: {"type":"msg","topic":"rt/utlidar/voxel_map_compressed",

go2_robot_sdk/launch/robot.launch.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -45,14 +45,15 @@ def generate_launch_description():
4545
robot_ip_lst = robot_ip.replace(" ", "").split(",")
4646
print("IP list:", robot_ip_lst)
4747

48-
conn_mode = "single" if len(robot_ip_lst) == 1 else "multi"
4948

5049
# these are debug only
5150
map_name = os.getenv('MAP_NAME', '3d_map')
5251
save_map = os.getenv('MAP_SAVE', 'true')
5352

5453
conn_type = os.getenv('CONN_TYPE', 'webrtc')
5554

55+
conn_mode = "single" if len(robot_ip_lst) == 1 and conn_type != "cyclonedds" else "multi"
56+
5657
if conn_mode == 'single':
5758
rviz_config = "single_robot_conf.rviz"
5859
else:

go2_robot_sdk/scripts/go2_func.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ def generate_id() -> int:
3333
return int(datetime.datetime.now().timestamp() * 1000 % 2147483648) + random.randint(0, 999)
3434

3535

36-
def create_command_structure(api_id: int, parameter: Any, topic: str = SPORT_MODE_TOPIC) -> Dict:
36+
def create_command_structure(api_id: int, parameter: str, topic: str = SPORT_MODE_TOPIC) -> Dict:
3737
return {
3838
"type": "msg",
3939
"topic": topic,
@@ -44,12 +44,12 @@ def create_command_structure(api_id: int, parameter: Any, topic: str = SPORT_MOD
4444
"api_id": api_id
4545
}
4646
},
47-
"parameter": json.dumps(parameter)
47+
"parameter": parameter
4848
}
4949
}
5050

5151

52-
def gen_command(cmd: int, parameters: Optional[Any] = None, topic: Optional[str] = None) -> str:
52+
def gen_command(cmd: int, parameters: Optional[str] = None, topic: Optional[str] = None) -> str:
5353
parameter = parameters if parameters is not None else cmd
5454
command = create_command_structure(
5555
api_id=cmd,
@@ -63,7 +63,7 @@ def gen_mov_command(x: float, y: float, z: float) -> str:
6363
parameters = {"x": x, "y": y, "z": z}
6464
command = create_command_structure(
6565
api_id=1008,
66-
parameter=parameters,
66+
parameter=json.dumps(parameters),
6767
topic=SPORT_MODE_TOPIC
6868
)
6969
return json.dumps(command)

0 commit comments

Comments
 (0)