diff --git a/kuka_rsi_driver/config/initial_positions.yaml b/kuka_rsi_driver/config/initial_positions.yaml new file mode 100644 index 0000000..94a4e8b --- /dev/null +++ b/kuka_rsi_driver/config/initial_positions.yaml @@ -0,0 +1,6 @@ +joint_a1: 0.0 +joint_a2: -1.5708 +joint_a3: 1.5708 +joint_a4: 0.0 +joint_a5: 0.0 +joint_a6: 0.0 diff --git a/kuka_rsi_driver/launch/test_bringup.launch.py b/kuka_rsi_driver/launch/test_bringup.launch.py index 8b90d7f..c156208 100644 --- a/kuka_rsi_driver/launch/test_bringup.launch.py +++ b/kuka_rsi_driver/launch/test_bringup.launch.py @@ -93,6 +93,19 @@ def declare_robot_description_arg(name, **kwargs): "macro_name", description="Name of robot description macro" ) + declare_robot_description_arg( + "use_mock_hardware", + default_value="false", + description="Whether to use mock hardware instead of real hardware interface", + ) + declare_robot_description_arg( + "initial_positions_file", + default_value=PathJoinSubstitution( + [kuka_rsi_driver, "config", "initial_positions.yaml"] + ), + description="Initial joint positions when using mock hardware", + ) + declare_robot_description_arg( "rsi_listen_ip", default_value="127.0.0.1", diff --git a/kuka_rsi_driver/test/move_sim.py b/kuka_rsi_driver/test/move_sim.py index d0fd5f3..6976edf 100644 --- a/kuka_rsi_driver/test/move_sim.py +++ b/kuka_rsi_driver/test/move_sim.py @@ -56,7 +56,7 @@ @pytest.mark.launch_test @launch_testing.parametrize( - "prefix,robot_model", + "prefix,robot_model,use_mock_hardware", itertools.product( ["", "prefix_"], [ @@ -64,9 +64,10 @@ ("kuka_kr120_support", "kr120r2500pro_macro.xacro", "kuka_kr120r2500pro"), ("kuka_kr210_support", "kr210r3100_macro.xacro", "kuka_kr210r3100"), ], + [True, False], ), ) -def generate_test_description(prefix, robot_model): +def generate_test_description(prefix, robot_model, use_mock_hardware): kuka_rsi_driver = FindPackageShare("kuka_rsi_driver") test_description = LaunchDescription() @@ -84,6 +85,7 @@ def generate_test_description(prefix, robot_model): "description_package": robot_model[0], "description_macro_file": robot_model[1], "macro_name": robot_model[2], + "use_mock_hardware": f"{use_mock_hardware}", "launch_rviz": "False", "prefix": prefix, }.items(), @@ -93,13 +95,14 @@ def generate_test_description(prefix, robot_model): # # Start simulator # - test_description.add_action( - Node( - package="kuka_rsi_driver", - executable="simulator", - arguments=["--host-ip", "127.0.0.1"], + if not use_mock_hardware: + test_description.add_action( + Node( + package="kuka_rsi_driver", + executable="simulator", + arguments=["--host-ip", "127.0.0.1"], + ) ) - ) test_description.add_action(ReadyToTest()) return test_description diff --git a/kuka_rsi_driver/urdf/kuka_rsi_driver.ros2_control.xacro b/kuka_rsi_driver/urdf/kuka_rsi_driver.ros2_control.xacro index 92f1a64..67cd4aa 100644 --- a/kuka_rsi_driver/urdf/kuka_rsi_driver.ros2_control.xacro +++ b/kuka_rsi_driver/urdf/kuka_rsi_driver.ros2_control.xacro @@ -2,10 +2,12 @@ - + - + + ${initial_position} + @@ -13,39 +15,64 @@ - kuka_rsi_driver/KukaRsiHardwareInterface - ${rsi_listen_ip} - ${rsi_listen_port} + + mock_components/GenericSystem + + + kuka_rsi_driver/KukaRsiHardwareInterface + ${rsi_listen_ip} + ${rsi_listen_port} + - - - - - - + + + + + + - - - - - - - + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 0 + + + 1 + - + + 3 + - + + 1 + diff --git a/kuka_rsi_driver/urdf/test_description.urdf.xacro b/kuka_rsi_driver/urdf/test_description.urdf.xacro index 3c41891..be0c668 100644 --- a/kuka_rsi_driver/urdf/test_description.urdf.xacro +++ b/kuka_rsi_driver/urdf/test_description.urdf.xacro @@ -7,11 +7,17 @@ + + + + + + @@ -22,6 +28,8 @@