feat: Add XRobotoolkit UDP bridge functionality
This commit is contained in:
@ -33,6 +33,8 @@ DEFAULT_RIGHT_IP = "192.168.192.19"
|
||||
DEFAULT_PORT = "15000"
|
||||
SAMPLE_SENDER_SECONDS = "30"
|
||||
SAMPLE_SENDER_STAGGERED_SECONDS = "60"
|
||||
XROBOTOOLKIT_BRIDGE_HZ = "90"
|
||||
XROBOTOOLKIT_BRIDGE_EXECUTABLE = "xrobotoolkit_to_udp_bridge"
|
||||
SAMPLE_SENDER_ARGS = (
|
||||
f"--host 127.0.0.1 --port {DEFAULT_PORT} "
|
||||
"--pattern axis_sweep --amplitude 0.5 "
|
||||
@ -111,6 +113,13 @@ def _sample_udp_sender_command(
|
||||
return command
|
||||
|
||||
|
||||
def _xrobotoolkit_bridge_command() -> str:
|
||||
return (
|
||||
f"ros2 run xr_rm_input {XROBOTOOLKIT_BRIDGE_EXECUTABLE} "
|
||||
f"--host 127.0.0.1 --port {DEFAULT_PORT} --hz {XROBOTOOLKIT_BRIDGE_HZ}"
|
||||
)
|
||||
|
||||
|
||||
def _tool_command(arm: str, open_tool: bool) -> str:
|
||||
arm_name = "left_rm75" if arm == "left" else "right_rm75"
|
||||
value = "true" if open_tool else "false"
|
||||
@ -248,6 +257,7 @@ def build_commands_by_mode(mode: str) -> list[tuple[str, str]]:
|
||||
("Left Arm Mock Launch", "ros2 launch xr_rm_bringup arm_debug.launch.py arm:=left use_mock:=true"),
|
||||
("Right Arm Mock Launch", "ros2 launch xr_rm_bringup arm_debug.launch.py arm:=right use_mock:=true"),
|
||||
("Dual Arm Mock Launch", "ros2 launch xr_rm_bringup arm_debug.launch.py arm:=both use_mock:=true"),
|
||||
("XRobotoolkit UDP Bridge (90 Hz)", _xrobotoolkit_bridge_command()),
|
||||
(
|
||||
"Sample UDP Sender (Left, 30s)",
|
||||
_sample_udp_sender_command("left"),
|
||||
@ -282,6 +292,7 @@ def build_commands_by_mode(mode: str) -> list[tuple[str, str]]:
|
||||
f"left_robot_ip:={DEFAULT_LEFT_IP} "
|
||||
"move_to_initial_pose_on_connect:=false",
|
||||
),
|
||||
("XRobotoolkit UDP Bridge (90 Hz)", _xrobotoolkit_bridge_command()),
|
||||
("Left Tool Open", _tool_command("left", True)),
|
||||
("Left Tool Close", _tool_command("left", False)),
|
||||
(
|
||||
@ -299,6 +310,7 @@ def build_commands_by_mode(mode: str) -> list[tuple[str, str]]:
|
||||
f"right_robot_ip:={DEFAULT_RIGHT_IP} "
|
||||
"move_to_initial_pose_on_connect:=false",
|
||||
),
|
||||
("XRobotoolkit UDP Bridge (90 Hz)", _xrobotoolkit_bridge_command()),
|
||||
("Right Tool Open", _tool_command("right", True)),
|
||||
("Right Tool Close", _tool_command("right", False)),
|
||||
(
|
||||
@ -317,6 +329,7 @@ def build_commands_by_mode(mode: str) -> list[tuple[str, str]]:
|
||||
f"left_robot_ip:={DEFAULT_LEFT_IP} right_robot_ip:={DEFAULT_RIGHT_IP} "
|
||||
"move_to_initial_pose_on_connect:=false",
|
||||
),
|
||||
("XRobotoolkit UDP Bridge (90 Hz)", _xrobotoolkit_bridge_command()),
|
||||
(
|
||||
"Sample UDP Sender (Both Staggered, 60s)",
|
||||
_sample_udp_sender_command("both", SAMPLE_SENDER_STAGGERED_SECONDS, "staggered"),
|
||||
@ -329,6 +342,7 @@ def build_commands_by_mode(mode: str) -> list[tuple[str, str]]:
|
||||
("XR-RM Bringup Prefix", "ros2 pkg prefix xr_rm_bringup"),
|
||||
("XR-RM Input Prefix", "ros2 pkg prefix xr_rm_input"),
|
||||
("XR-RM Teleop Prefix", "ros2 pkg prefix xr_rm_teleop"),
|
||||
("XRobotoolkit UDP Bridge (90 Hz)", _xrobotoolkit_bridge_command()),
|
||||
]
|
||||
one_click = None
|
||||
return _finalize_items(items, one_click)
|
||||
@ -1277,7 +1291,7 @@ class LauncherApp:
|
||||
def stop_launched_processes(self, *, confirm: bool, notify: bool) -> bool:
|
||||
if confirm and not messagebox.askyesno(
|
||||
"Confirm Stop",
|
||||
"Stop XR-RM launcher terminals, topic monitors, and ROS nodes started from this workspace?",
|
||||
"Stop XR-RM launcher terminals, topic monitors, ROS nodes, and bridge processes started from this workspace?",
|
||||
):
|
||||
return False
|
||||
|
||||
@ -1287,6 +1301,7 @@ class LauncherApp:
|
||||
"ros2 run xr_rm_input",
|
||||
"ros2 run xr_rm_teleop",
|
||||
"XR_RM_LAUNCHER_SESSION=1",
|
||||
XROBOTOOLKIT_BRIDGE_EXECUTABLE,
|
||||
TERMINAL_TITLE_PREFIX,
|
||||
TOPIC_MONITOR_TITLE,
|
||||
CMD_VEL_MONITOR_TITLE,
|
||||
|
||||
Reference in New Issue
Block a user