diff --git a/launch/display_openarm.launch.py b/launch/display_openarm.launch.py
index f14e231..06ce836 100644
--- a/launch/display_openarm.launch.py
+++ b/launch/display_openarm.launch.py
@@ -24,10 +24,21 @@
from launch_ros.actions import Node
-def robot_state_publisher_spawner(context: LaunchContext, arm_type, ee_type, bimanual):
+def robot_state_publisher_spawner(
+ context: LaunchContext,
+ arm_type,
+ ee_type,
+ bimanual,
+ ros2_control,
+ hardware_type,
+ use_fake_hardware,
+):
arm_type_str = context.perform_substitution(arm_type)
ee_type_str = context.perform_substitution(ee_type)
bimanual_str = context.perform_substitution(bimanual)
+ ros2_control_str = context.perform_substitution(ros2_control)
+ hardware_type_str = context.perform_substitution(hardware_type)
+ use_fake_hardware_str = context.perform_substitution(use_fake_hardware)
xacro_path = os.path.join(
get_package_share_directory("openarm_description"),
@@ -40,6 +51,9 @@ def robot_state_publisher_spawner(context: LaunchContext, arm_type, ee_type, bim
"arm_type": arm_type_str,
"ee_type": ee_type_str,
"bimanual": bimanual_str,
+ "ros2_control": ros2_control_str,
+ "hardware_type": hardware_type_str,
+ "use_fake_hardware": use_fake_hardware_str,
}
).toprettyxml(indent=" ")
@@ -92,13 +106,35 @@ def generate_launch_description():
description="Whether to use bimanual configuration"
)
+ ros2_control_arg = DeclareLaunchArgument(
+ "ros2_control",
+ default_value="false",
+ description="Use ros2_control hardware interfaces in the robot description."
+ )
+
+ hardware_type_arg = DeclareLaunchArgument(
+ "hardware_type",
+ default_value="",
+ description="Hardware backend to use (real/mock/mujoco)."
+ )
+
+ use_fake_hardware_arg = DeclareLaunchArgument(
+ "use_fake_hardware",
+ default_value="false",
+ description="Deprecated flag for backwards compatibility."
+ )
+
arm_type = LaunchConfiguration("arm_type")
ee_type = LaunchConfiguration("ee_type")
bimanual = LaunchConfiguration("bimanual")
+ ros2_control = LaunchConfiguration("ros2_control")
+ hardware_type = LaunchConfiguration("hardware_type")
+ use_fake_hardware = LaunchConfiguration("use_fake_hardware")
robot_state_publisher_loader = OpaqueFunction(
function=robot_state_publisher_spawner,
- args=[arm_type, ee_type, bimanual]
+ args=[arm_type, ee_type, bimanual, ros2_control,
+ hardware_type, use_fake_hardware]
)
rviz_loader = OpaqueFunction(
@@ -110,6 +146,9 @@ def generate_launch_description():
arm_type_arg,
ee_type_arg,
bimanual_arg,
+ ros2_control_arg,
+ hardware_type_arg,
+ use_fake_hardware_arg,
robot_state_publisher_loader,
Node(
package="joint_state_publisher_gui",
diff --git a/urdf/robot/openarm_robot.xacro b/urdf/robot/openarm_robot.xacro
index e0ff3a9..8c16651 100644
--- a/urdf/robot/openarm_robot.xacro
+++ b/urdf/robot/openarm_robot.xacro
@@ -20,6 +20,7 @@
ee_type:=''
ros2_control:=false
can_interface:=''
+ hardware_type:=''
use_fake_hardware:=false
fake_sensor_commands:=false
no_prefix:='false'
@@ -54,6 +55,9 @@
+
@@ -106,7 +110,7 @@
control_gains="${control_gains}"
left_can_interface="${left_can_interface}"
right_can_interface="${right_can_interface}"
- use_fake_hardware="${use_fake_hardware}"
+ hardware_type="${hardware}"
fake_sensor_commands="${fake_sensor_commands}"
left_arm_prefix="${left_arm_prefix}"
right_arm_prefix="${right_arm_prefix}"
@@ -165,7 +169,7 @@
control_gains="${control_gains}"
arm_prefix="${arm_prefix_modified}"
can_interface="${can_interface}"
- use_fake_hardware="${use_fake_hardware}"
+ hardware_type="${hardware}"
fake_sensor_commands="${fake_sensor_commands}"
hand="${hand}"
bimanual="false"
@@ -197,4 +201,4 @@
-
\ No newline at end of file
+
diff --git a/urdf/robot/v10.urdf.xacro b/urdf/robot/v10.urdf.xacro
index fc0420a..2bad105 100644
--- a/urdf/robot/v10.urdf.xacro
+++ b/urdf/robot/v10.urdf.xacro
@@ -35,6 +35,7 @@
+
@@ -70,6 +71,7 @@
right_can_interface="$(arg right_can_interface)"
left_arm_prefix="$(arg left_arm_prefix)"
right_arm_prefix="$(arg right_arm_prefix)"
+ hardware_type="$(arg hardware_type)"
use_fake_hardware="$(arg use_fake_hardware)"
fake_sensor_commands="$(arg fake_sensor_commands)"
no_prefix="$(arg no_prefix)"
diff --git a/urdf/ros2_control/openarm.bimanual.ros2_control.xacro b/urdf/ros2_control/openarm.bimanual.ros2_control.xacro
index 56916e5..cec8420 100644
--- a/urdf/ros2_control/openarm.bimanual.ros2_control.xacro
+++ b/urdf/ros2_control/openarm.bimanual.ros2_control.xacro
@@ -6,7 +6,9 @@
control_gains
left_can_interface:=^|can1
right_can_interface:=^|can0
- use_fake_hardware:=^|false
+ hardware_type:=^|real
+ left_websocket_port:=^|1337
+ right_websocket_port:=^|1338
fake_sensor_commands:=^|false
hand:=^|false
left_arm_prefix:=^|left_
@@ -17,12 +19,16 @@
${arm_type}
-
+
+ openarm_mujoco_hardware/MujocoHardware
+ ${left_websocket_port}
+
+
mock_components/GenericSystem
${fake_sensor_commands}
0.0
-
+
openarm_hardware/OpenArm_v10HW
${left_can_interface}
${left_arm_prefix}
@@ -42,7 +48,7 @@
${control_gains['joint5']['kd']}
${control_gains['joint6']['kd']}
${control_gains['joint7']['kd']}
-
+
@@ -82,12 +88,16 @@
${arm_type}
-
+
+ openarm_mujoco_hardware/MujocoHardware
+ ${right_websocket_port}
+
+
mock_components/GenericSystem
${fake_sensor_commands}
0.0
-
+
openarm_hardware/OpenArm_v10HW
${right_can_interface}
${right_arm_prefix}
@@ -107,7 +117,7 @@
${control_gains['joint5']['kd']}
${control_gains['joint6']['kd']}
${control_gains['joint7']['kd']}
-
+
diff --git a/urdf/ros2_control/openarm.ros2_control.xacro b/urdf/ros2_control/openarm.ros2_control.xacro
index 223c331..d1ec6f4 100644
--- a/urdf/ros2_control/openarm.ros2_control.xacro
+++ b/urdf/ros2_control/openarm.ros2_control.xacro
@@ -5,24 +5,29 @@
params="arm_type
control_gains
can_interface
- use_fake_hardware:=^|false
+ hardware_type:=^|real
fake_sensor_commands:=^|false
hand:=^|false
gazebo_effort:=^|false
arm_prefix:=''
bimanual:=false
- can_fd:=^|true">
+ can_fd:=^|true
+ websocket_port:=1337">
${arm_type}
${arm_prefix}
-
+
+ openarm_mujoco_hardware/MujocoHardware
+ ${websocket_port}
+
+
mock_components/GenericSystem
${fake_sensor_commands}
0.0
-
+
openarm_hardware/OpenArm_${arm_type}HW
${can_interface}
${arm_prefix}