From 909db122bbc31be9c540aeba4feea4a4c60e0d7c Mon Sep 17 00:00:00 2001 From: YusukeKato Date: Fri, 8 Sep 2023 14:54:57 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E5=AE=9F=E8=A1=8C?= =?UTF-8?q?=E6=99=82=E3=81=AF=E3=83=80=E3=83=9F=E3=83=BC=E3=81=AE=E3=83=91?= =?UTF-8?q?=E3=83=A9=E3=83=A1=E3=83=BC=E3=82=BF=E3=83=95=E3=82=A1=E3=82=A4?= =?UTF-8?q?=E3=83=AB=E3=82=92=E8=AA=AD=E3=81=BF=E8=BE=BC=E3=82=81=E3=82=8B?= =?UTF-8?q?=E3=82=88=E3=81=86=E3=81=ABdescription=5Floader=E3=82=92?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20(#73)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * テスト時はダミーのパラメータファイルを読み込めるようにdescription_loaderを修正 * CIの設定ファイルから読み込む必要のないsetup.bashの変数を削除 * 余計な文字を削除 --- .github/workflows/industrial_ci.yml | 4 +-- .../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 ++ 7 files changed, 58 insertions(+), 7 deletions(-) create mode 100644 crane_plus_description/test/dummy_controllers.yaml diff --git a/.github/workflows/industrial_ci.yml b/.github/workflows/industrial_ci.yml index 61baa93..f539e58 100644 --- a/.github/workflows/industrial_ci.yml +++ b/.github/workflows/industrial_ci.yml @@ -17,9 +17,7 @@ jobs: strategy: matrix: env: - # テストがワークスペース内のパッケージに依存しているため、setup.bashを読み込む - # Ref: https://github.com/ros-industrial/industrial_ci/issues/585 - - { ROS_DISTRO: humble, ROS_REPO: ros, BEFORE_RUN_TARGET_TEST_EMBED: "ici_with_unset_variables source /root/target_ws/install/setup.bash" } + - { ROS_DISTRO: humble, ROS_REPO: ros } runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 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)" />