diff --git a/.github/workflows/industrial_ci.yml b/.github/workflows/industrial_ci.yml index d1c1fea..3ecf7af 100644 --- a/.github/workflows/industrial_ci.yml +++ b/.github/workflows/industrial_ci.yml @@ -7,23 +7,14 @@ on: pull_request: paths-ignore: - '**.md' - schedule: - - cron: "0 2 * * 0" # Weekly on Sundays at 02:00 + workflow_dispatch: jobs: industrial_ci: - continue-on-error: ${{ matrix.experimental }} strategy: matrix: env: - - { ROS_DISTRO: melodic, ROS_REPO: main } - - { ROS_DISTRO: noetic, ROS_REPO: main } - experimental: [false] - include: - - env: { ROS_DISTRO: melodic, ROS_REPO: testing } - experimental: true - - env: { ROS_DISTRO: noetic, ROS_REPO: testing } - experimental: true + - { ROS_DISTRO: humble, ROS_REPO: ros, BEFORE_RUN_TARGET_TEST_EMBED: "ici_with_unset_variables source /root/target_ws/install/setup.bash" } runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 diff --git a/CMakeLists.txt b/CMakeLists.txt index 2c5e7d6..4e57676 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,33 +1,27 @@ -cmake_minimum_required(VERSION 2.8.3) +cmake_minimum_required(VERSION 3.5) project(sciurus17_description) -# add_definitions(-std=c++11) +find_package(ament_cmake REQUIRED) -find_package(catkin REQUIRED COMPONENTS - rospy - std_msgs +install(DIRECTORY + launch + meshes + urdf + DESTINATION share/${PROJECT_NAME}/ ) -# catkin_python_setup() +ament_python_install_package(${PROJECT_NAME}) +install(PROGRAMS + ${PROJECT_NAME}/robot_description_loader.py + DESTINATION lib/${PROJECT_NAME}) -################################### -## catkin specific configuration ## -################################### -catkin_package( -) +if(BUILD_TESTING) + find_package(ament_lint_auto REQUIRED) + set(ament_cmake_copyright_FOUND TRUE) # Skip copyright checks + ament_lint_auto_find_test_dependencies() -########### -## Build ## -########### -include_directories( - ${catkin_INCLUDE_DIRS} -) + find_package(ament_cmake_pytest REQUIRED) + ament_add_pytest_test(test_robot_description_loader test/test_robot_description_loader.py) +endif() -############# -## Install ## -############# -foreach(dir config launch meshes urdf) - install(DIRECTORY ${dir}/ - DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}/${dir} - ) -endforeach(dir) +ament_package() diff --git a/launch/display.launch b/launch/display.launch deleted file mode 100644 index de0bc53..0000000 --- a/launch/display.launch +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - - ["/sciurus17/joint_states"] - - - - - - diff --git a/launch/display.launch.py b/launch/display.launch.py new file mode 100644 index 0000000..6b857b4 --- /dev/null +++ b/launch/display.launch.py @@ -0,0 +1,34 @@ +# Copyright 2023 RT Corporation + +from ament_index_python.packages import get_package_share_directory +from sciurus17_description.robot_description_loader import RobotDescriptionLoader +from launch import LaunchDescription +from launch_ros.actions import Node + + +def generate_launch_description(): + description_loader = RobotDescriptionLoader() + + rsp = Node(package='robot_state_publisher', + executable='robot_state_publisher', + output='both', + parameters=[{'robot_description': description_loader.load()}]) + jsp = Node( + package='joint_state_publisher_gui', + executable='joint_state_publisher_gui', + output='screen') + + rviz_config_file = get_package_share_directory( + 'sciurus17_description') + '/launch/display.rviz' + rviz = Node(package='rviz2', + executable='rviz2', + name='rviz2', + output='log', + arguments=['-d', rviz_config_file]) + + ld = LaunchDescription() + ld.add_action(rsp) + ld.add_action(jsp) + ld.add_action(rviz) + + return ld diff --git a/launch/display.rviz b/launch/display.rviz new file mode 100644 index 0000000..1d81865 --- /dev/null +++ b/launch/display.rviz @@ -0,0 +1,294 @@ +Panels: + - Class: rviz_common/Displays + Help Height: 78 + Name: Displays + Property Tree Widget: + Expanded: + - /Global Options1 + - /Status1 + Splitter Ratio: 0.5 + Tree Height: 555 + - Class: rviz_common/Selection + Name: Selection + - Class: rviz_common/Tool Properties + Expanded: + - /2D Goal Pose1 + - /Publish Point1 + Name: Tool Properties + Splitter Ratio: 0.5886790156364441 + - Class: rviz_common/Views + Expanded: + - /Current View1 + - /Current View1/Focal Point1 + Name: Views + Splitter Ratio: 0.5 + - Class: rviz_common/Time + Experimental: false + Name: Time + SyncMode: 0 + SyncSource: "" +Visualization Manager: + Class: "" + Displays: + - Alpha: 0.5 + Cell Size: 1 + Class: rviz_default_plugins/Grid + Color: 160; 160; 164 + Enabled: true + Line Style: + Line Width: 0.029999999329447746 + Value: Lines + Name: Grid + Normal Cell Count: 0 + Offset: + X: 0 + Y: 0 + Z: 0 + Plane: XY + Plane Cell Count: 10 + Reference Frame: + Value: true + - Alpha: 1 + Class: rviz_default_plugins/RobotModel + Collision Enabled: false + Description File: "" + Description Source: Topic + Description Topic: + Depth: 5 + Durability Policy: Volatile + History Policy: Keep Last + Reliability Policy: Reliable + Value: /robot_description + Enabled: true + Links: + All Links Enabled: true + Expand Joint Details: false + Expand Link Details: false + Expand Tree: false + Link Tree Style: Links in Alphabetic Order + base_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + body_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + camera_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + chest_camera_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + l_handA_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + l_handB_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + l_link1: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + l_link2: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + l_link3: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + l_link4: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + l_link5: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + l_link5_armarker: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + l_link6: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + l_link7: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + neck_pitch_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + neck_yaw_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + r_handA_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + r_handB_link: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + r_link1: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + r_link2: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + r_link3: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + r_link4: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + r_link5: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + r_link5_armarker: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + r_link6: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + r_link7: + Alpha: 1 + Show Axes: false + Show Trail: false + Value: true + world: + Alpha: 1 + Show Axes: false + Show Trail: false + Mass Properties: + Inertia: false + Mass: false + Name: RobotModel + TF Prefix: "" + Update Interval: 0 + Value: true + Visual Enabled: true + Enabled: true + Global Options: + Background Color: 48; 48; 48 + Fixed Frame: base_link + Frame Rate: 30 + Name: root + Tools: + - Class: rviz_default_plugins/Interact + Hide Inactive Objects: true + - Class: rviz_default_plugins/MoveCamera + - Class: rviz_default_plugins/Select + - Class: rviz_default_plugins/FocusCamera + - Class: rviz_default_plugins/Measure + Line color: 128; 128; 0 + - Class: rviz_default_plugins/SetInitialPose + Covariance x: 0.25 + Covariance y: 0.25 + Covariance yaw: 0.06853891909122467 + Topic: + Depth: 5 + Durability Policy: Volatile + History Policy: Keep Last + Reliability Policy: Reliable + Value: /initialpose + - Class: rviz_default_plugins/SetGoal + Topic: + Depth: 5 + Durability Policy: Volatile + History Policy: Keep Last + Reliability Policy: Reliable + Value: /goal_pose + - Class: rviz_default_plugins/PublishPoint + Single click: true + Topic: + Depth: 5 + Durability Policy: Volatile + History Policy: Keep Last + Reliability Policy: Reliable + Value: /clicked_point + Transformation: + Current: + Class: rviz_default_plugins/TF + Value: true + Views: + Current: + Class: rviz_default_plugins/Orbit + Distance: 2.5 + Enable Stereo Rendering: + Stereo Eye Separation: 0.05999999865889549 + Stereo Focal Distance: 1 + Swap Stereo Eyes: false + Value: false + Focal Point: + X: 0 + Y: 0 + Z: 0 + Focal Shape Fixed Size: true + Focal Shape Size: 0.05000000074505806 + Invert Z Axis: false + Name: Current View + Near Clip Distance: 0.009999999776482582 + Pitch: 0.5 + Target Frame: + Value: Orbit (rviz) + Yaw: 0 + Saved: ~ +Window Geometry: + Displays: + collapsed: false + Height: 846 + Hide Left Dock: false + Hide Right Dock: false + QMainWindow State: 000000ff00000000fd000000040000000000000156000002b4fc0200000008fb0000001200530065006c0065006300740069006f006e00000001e10000009b0000005c00fffffffb0000001e0054006f006f006c002000500072006f007000650072007400690065007302000001ed000001df00000185000000a3fb000000120056006900650077007300200054006f006f02000001df000002110000018500000122fb000000200054006f006f006c002000500072006f0070006500720074006900650073003203000002880000011d000002210000017afb000000100044006900730070006c006100790073010000003b000002b4000000c700fffffffb0000002000730065006c0065006300740069006f006e00200062007500660066006500720200000138000000aa0000023a00000294fb00000014005700690064006500530074006500720065006f02000000e6000000d2000003ee0000030bfb0000000c004b0069006e0065006300740200000186000001060000030c00000261000000010000010f000002b4fc0200000003fb0000001e0054006f006f006c002000500072006f00700065007200740069006500730100000041000000780000000000000000fb0000000a00560069006500770073010000003b000002b4000000a000fffffffb0000001200530065006c0065006300740069006f006e010000025a000000b200000000000000000000000200000490000000a9fc0100000001fb0000000a00560069006500770073030000004e00000080000002e10000019700000003000004b00000003efc0100000002fb0000000800540069006d00650100000000000004b00000025300fffffffb0000000800540069006d006501000000000000045000000000000000000000023f000002b400000004000000040000000800000008fc0000000100000002000000010000000a0054006f006f006c00730100000000ffffffff0000000000000000 + Selection: + collapsed: false + Time: + collapsed: false + Tool Properties: + collapsed: false + Views: + collapsed: false + Width: 1200 + X: 237 + Y: 81 diff --git a/package.xml b/package.xml index b2753b1..fd11130 100644 --- a/package.xml +++ b/package.xml @@ -1,25 +1,30 @@ - + + sciurus17_description - 1.0.0 - The SCIURUS17 description package - + 2.0.0 + The Sciurus17 description package RT Corporation - Hiroyuki Nomura NON-COMMERCIAL LICENSE AGREEMENT - catkin + Hiroyuki Nomura + ShotaAk + Atsushi Kuwagata - rospy - std_msgs + ament_cmake - rospy - std_msgs + ign_ros2_control + joint_state_publisher_gui + launch + robot_state_publisher + rviz2 + xacro - joint_state_publisher - joint_state_publisher_gui - robot_state_publisher - rviz - xacro + ament_lint_auto + ament_lint_common + ament_cmake_pytest - + + ament_cmake + + \ No newline at end of file diff --git a/sciurus17_description/__init__.py b/sciurus17_description/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/sciurus17_description/robot_description_loader.py b/sciurus17_description/robot_description_loader.py new file mode 100755 index 0000000..aa80469 --- /dev/null +++ b/sciurus17_description/robot_description_loader.py @@ -0,0 +1,21 @@ +# Copyright 2023 RT Corporation + +import os + +from ament_index_python.packages import get_package_share_directory +from launch.substitutions import Command + + +class RobotDescriptionLoader(): + + def __init__(self): + self.robot_description_path = os.path.join( + get_package_share_directory('sciurus17_description'), + 'urdf', + 'sciurus17.urdf.xacro') + + def load(self): + return Command([ + 'xacro ', + self.robot_description_path + ]) diff --git a/test/test_robot_description_loader.py b/test/test_robot_description_loader.py new file mode 100644 index 0000000..b81365d --- /dev/null +++ b/test/test_robot_description_loader.py @@ -0,0 +1,27 @@ +# Copyright 2023 RT Corporation + +from sciurus17_description.robot_description_loader import RobotDescriptionLoader +from launch.launch_context import LaunchContext +import pytest + + +def exec_load(loader): + # Command substitutionの実行方法はCommandのテストを参考にした + # https://github.com/ros2/launch/blob/074cd2903ddccd61bce8f40a0f58da0b7c200481/launch/test/launch/substitutions/test_command.py#L47 + context = LaunchContext() + return loader.load().perform(context) + + +def test_load_description(): + # xacroの読み込みが成功することを期待 + rdl = RobotDescriptionLoader() + assert exec_load(rdl) + + +def test_change_description_path(): + # xacroのファイルパスを変更し、読み込みが失敗することを期待 + rdl = RobotDescriptionLoader() + rdl.robot_description_path = 'hoge' + with pytest.raises(Exception) as e: + exec_load(rdl) + assert e.value diff --git a/urdf/sciurus17.urdf.xacro b/urdf/sciurus17.urdf.xacro index 6dea7bc..e78f95d 100644 --- a/urdf/sciurus17.urdf.xacro +++ b/urdf/sciurus17.urdf.xacro @@ -15,9 +15,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -70,86 +181,21 @@ - + - + - - - - - - - - - - - - - - - - - + + + + + + + + + + + diff --git a/urdf/sciurus17_body.xacro b/urdf/sciurus17_body.xacro index 25b7d04..e4d6753 100644 --- a/urdf/sciurus17_body.xacro +++ b/urdf/sciurus17_body.xacro @@ -2,22 +2,14 @@ - + - + - + @@ -32,25 +24,25 @@ - - - + + + + lower="${NAME_JOINT_BODY_LOWER_LIMIT}" + upper="${NAME_JOINT_BODY_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + - + @@ -65,19 +57,19 @@ - - - + + + - + - + @@ -87,13 +79,13 @@ - + Gazebo/White - + Gazebo/White - + Gazebo/Black diff --git a/urdf/sciurus17_head.xacro b/urdf/sciurus17_head.xacro index 700293b..c13deea 100644 --- a/urdf/sciurus17_head.xacro +++ b/urdf/sciurus17_head.xacro @@ -2,36 +2,27 @@ - + - - - + + + + lower="${JOINT_NECK_1_LOWER_LIMIT}" + upper="${JOINT_NECK_1_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + - + @@ -45,26 +36,26 @@ - - - + + + + lower="${JOINT_NECK_2_LOWER_LIMIT}" + upper="${JOINT_NECK_2_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + - + @@ -79,19 +70,19 @@ - - - + + + - + - + @@ -101,13 +92,13 @@ - + Gazebo/White - + Gazebo/White - + Gazebo/Black diff --git a/urdf/sciurus17_left_arm.xacro b/urdf/sciurus17_left_arm.xacro index 535043e..519ccf3 100644 --- a/urdf/sciurus17_left_arm.xacro +++ b/urdf/sciurus17_left_arm.xacro @@ -2,46 +2,28 @@ - + - - - + + + + lower="${JOINT_ARM_L_1_LOWER_LIMIT}" + upper="${JOINT_ARM_L_1_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + - + @@ -56,26 +38,26 @@ - - - + + + + lower="${JOINT_ARM_L_2_LOWER_LIMIT}" + upper="${JOINT_ARM_L_2_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + - + @@ -90,26 +72,26 @@ - - - + + + + lower="${JOINT_ARM_L_3_LOWER_LIMIT}" + upper="${JOINT_ARM_L_3_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + - + @@ -124,26 +106,26 @@ - - - + + + + lower="${JOINT_ARM_L_4_LOWER_LIMIT}" + upper="${JOINT_ARM_L_4_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + - + @@ -158,26 +140,26 @@ - - - + + + + lower="${JOINT_ARM_L_5_LOWER_LIMIT}" + upper="${JOINT_ARM_L_5_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + - + @@ -210,19 +192,19 @@ - - - + + + - + - + @@ -232,26 +214,26 @@ - - - + + + + lower="${JOINT_ARM_L_6_LOWER_LIMIT}" + upper="${JOINT_ARM_L_6_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + - + @@ -266,35 +248,35 @@ - - - + + + + lower="${JOINT_ARM_L_7_LOWER_LIMIT}" + upper="${JOINT_ARM_L_7_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + Gazebo/White - + Gazebo/White - + Gazebo/White - + Gazebo/White - + Gazebo/White - + Gazebo/White diff --git a/urdf/sciurus17_left_hand.xacro b/urdf/sciurus17_left_hand.xacro index 107f345..31750f1 100644 --- a/urdf/sciurus17_left_hand.xacro +++ b/urdf/sciurus17_left_hand.xacro @@ -2,21 +2,15 @@ - + - + - + @@ -31,26 +25,26 @@ - - - + + + + lower="${JOINT_HAND_L_LOWER_LIMIT}" + upper="${JOINT_HAND_L_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + - + @@ -65,27 +59,27 @@ - - - + + + + lower="${JOINT_HAND_L_LOWER_LIMIT}" + upper="${JOINT_HAND_L_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + - + - + @@ -100,13 +94,13 @@ - + Gazebo/Red - + Gazebo/Red - + Gazebo/Red diff --git a/urdf/sciurus17_right_arm.xacro b/urdf/sciurus17_right_arm.xacro index 75ff676..e95558f 100644 --- a/urdf/sciurus17_right_arm.xacro +++ b/urdf/sciurus17_right_arm.xacro @@ -2,46 +2,28 @@ - + - - - + + + + lower="${JOINT_ARM_R_1_LOWER_LIMIT}" + upper="${JOINT_ARM_R_1_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + - + @@ -56,26 +38,26 @@ - - - + + + + lower="${JOINT_ARM_R_2_LOWER_LIMIT}" + upper="${JOINT_ARM_R_2_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + - + @@ -90,26 +72,26 @@ - - - + + + + lower="${JOINT_ARM_R_3_LOWER_LIMIT}" + upper="${JOINT_ARM_R_3_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + - + @@ -124,26 +106,26 @@ - - - + + + + lower="${JOINT_ARM_R_4_LOWER_LIMIT}" + upper="${JOINT_ARM_R_4_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + - + @@ -158,26 +140,26 @@ - - - + + + + lower="${JOINT_ARM_R_5_LOWER_LIMIT}" + upper="${JOINT_ARM_R_5_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + - + @@ -210,19 +192,19 @@ - - - + + + - + - + @@ -232,26 +214,26 @@ - - - + + + + lower="${JOINT_ARM_R_6_LOWER_LIMIT}" + upper="${JOINT_ARM_R_6_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + - + @@ -266,35 +248,35 @@ - - - + + + + lower="${JOINT_ARM_R_7_LOWER_LIMIT}" + upper="${JOINT_ARM_R_7_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + Gazebo/White - + Gazebo/White - + Gazebo/White - + Gazebo/White - + Gazebo/White - + Gazebo/White diff --git a/urdf/sciurus17_right_hand.xacro b/urdf/sciurus17_right_hand.xacro index d63a72a..036ac35 100644 --- a/urdf/sciurus17_right_hand.xacro +++ b/urdf/sciurus17_right_hand.xacro @@ -2,21 +2,15 @@ - + - + - + @@ -31,27 +25,27 @@ - - - + + + + lower="${JOINT_HAND_R_LOWER_LIMIT}" + upper="${JOINT_HAND_R_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + - + @@ -66,28 +60,28 @@ - - - + + + + lower="${JOINT_HAND_R_LOWER_LIMIT}" + upper="${JOINT_HAND_R_UPPER_LIMIT}" + effort="${EFFORT_LIMIT}" + velocity="${VELOCITY_LIMIT}"/> - + - + - + @@ -102,13 +96,13 @@ - + Gazebo/Red - + Gazebo/Red - + Gazebo/Red