From 80016fd9ae97f4532668339b2df258d23bb0ae3c Mon Sep 17 00:00:00 2001 From: YusukeKato Date: Thu, 7 Sep 2023 16:02:21 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E6=99=82=E3=81=AF?= =?UTF-8?q?=E3=83=80=E3=83=9F=E3=83=BC=E3=81=AE=E3=83=91=E3=83=A9=E3=83=A1?= =?UTF-8?q?=E3=83=BC=E3=82=BF=E3=83=95=E3=82=A1=E3=82=A4=E3=83=AB=E3=82=92?= =?UTF-8?q?=E8=AA=AD=E3=81=BF=E8=BE=BC=E3=82=81=E3=82=8B=E3=82=88=E3=81=86?= =?UTF-8?q?=E3=81=ABdescription=5Floader=E3=82=92=E4=BF=AE=E6=AD=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../robot_description_loader.py | 6 +++- .../test/dummy_controllers.yaml | 35 +++++++++++++++++++ .../test/test_robot_description_loader.py | 6 ++++ .../urdf/crane_plus.gazebo.xacro | 6 ++-- .../urdf/crane_plus.urdf.xacro | 6 +++- .../launch/crane_plus_with_table.launch.py | 2 ++ 6 files changed, 57 insertions(+), 4 deletions(-) create mode 100644 crane_plus_description/test/dummy_controllers.yaml diff --git a/crane_plus_description/crane_plus_description/robot_description_loader.py b/crane_plus_description/crane_plus_description/robot_description_loader.py index 6e13798..ebb9950 100755 --- a/crane_plus_description/crane_plus_description/robot_description_loader.py +++ b/crane_plus_description/crane_plus_description/robot_description_loader.py @@ -29,6 +29,8 @@ def __init__(self): self.use_gazebo = 'false' self.use_ignition = 'false' self.use_camera = 'false' + self.gz_control_config_package = '' + self.gz_control_config_file_path = '' def load(self): return Command([ @@ -37,5 +39,7 @@ def load(self): ' port_name:=', self.port_name, ' use_gazebo:=', self.use_gazebo, ' use_ignition:=', self.use_ignition, - ' use_camera:=', self.use_camera + ' use_camera:=', self.use_camera, + ' gz_control_config_package:=', self.gz_control_config_package, + ' gz_control_config_file_path:=', self.gz_control_config_file_path ]) diff --git a/crane_plus_description/test/dummy_controllers.yaml b/crane_plus_description/test/dummy_controllers.yaml new file mode 100644 index 0000000..62cf745 --- /dev/null +++ b/crane_plus_description/test/dummy_controllers.yaml @@ -0,0 +1,35 @@ +controller_manager: + ros__parameters: + update_rate: 100 # Hz + + crane_plus_arm_controller: + type: joint_trajectory_controller/JointTrajectoryController + crane_plus_gripper_controller: + type: joint_trajectory_controller/JointTrajectoryController + joint_state_broadcaster: + type: joint_state_broadcaster/JointStateBroadcaster + +crane_plus_arm_controller: + ros__parameters: + joints: + - crane_plus_joint1 + - crane_plus_joint2 + - crane_plus_joint3 + - crane_plus_joint4 + + command_interfaces: + - position + + state_interfaces: + - position + +crane_plus_gripper_controller: + ros__parameters: + joints: + - crane_plus_joint_hand + + command_interfaces: + - position + + state_interfaces: + - position diff --git a/crane_plus_description/test/test_robot_description_loader.py b/crane_plus_description/test/test_robot_description_loader.py index 9eb9927..ea93d34 100644 --- a/crane_plus_description/test/test_robot_description_loader.py +++ b/crane_plus_description/test/test_robot_description_loader.py @@ -50,6 +50,8 @@ def test_use_gazebo(): # use_gazeboが変更され、xacroにgazebo_ros2_controlがセットされることを期待 rdl = RobotDescriptionLoader() rdl.use_gazebo = 'true' + rdl.gz_control_config_package = 'crane_plus_description' + rdl.gz_control_config_file_path = 'test/dummy_controllers.yaml' assert 'gazebo_ros2_control/GazeboSystem' in exec_load(rdl) @@ -58,6 +60,8 @@ def test_use_ignition(): rdl = RobotDescriptionLoader() rdl.use_gazebo = 'true' rdl.use_ignition = 'true' + rdl.gz_control_config_package = 'crane_plus_description' + rdl.gz_control_config_file_path = 'test/dummy_controllers.yaml' assert 'ign_ros2_control/IgnitionSystem' in exec_load(rdl) @@ -65,4 +69,6 @@ def test_use_camera(): # use_cameraが変更されて、xacroにcameraがセットされることを期待 rdl = RobotDescriptionLoader() rdl.use_camera = 'true' + rdl.gz_control_config_package = 'crane_plus_description' + rdl.gz_control_config_file_path = 'test/dummy_controllers.yaml' assert 'camera_link' in exec_load(rdl) diff --git a/crane_plus_description/urdf/crane_plus.gazebo.xacro b/crane_plus_description/urdf/crane_plus.gazebo.xacro index 7cdc49f..791a00b 100644 --- a/crane_plus_description/urdf/crane_plus.gazebo.xacro +++ b/crane_plus_description/urdf/crane_plus.gazebo.xacro @@ -27,19 +27,21 @@ name_link_4 name_link_hand use_ignition + config_package + config_file_path "> - $(find crane_plus_control)/config/crane_plus_controllers.yaml + $(find ${config_package})/${config_file_path} gazebo_ros2_control/GazeboSystem - $(find crane_plus_control)/config/crane_plus_controllers.yaml + $(find ${config_package})/${config_file_path} diff --git a/crane_plus_description/urdf/crane_plus.urdf.xacro b/crane_plus_description/urdf/crane_plus.urdf.xacro index 6411b37..d783b81 100644 --- a/crane_plus_description/urdf/crane_plus.urdf.xacro +++ b/crane_plus_description/urdf/crane_plus.urdf.xacro @@ -22,6 +22,8 @@ + + @@ -128,7 +130,9 @@ name_link_3="${NAME_LINK_3}" name_link_4="${NAME_LINK_4}" name_link_hand="${NAME_LINK_HAND}" - use_ignition="$(arg use_ignition)" /> + use_ignition="$(arg use_ignition)" + config_package="$(arg gz_control_config_package)" + config_file_path="$(arg gz_control_config_file_path)" />