diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md new file mode 100644 index 0000000..2f7217c --- /dev/null +++ b/.github/pull_request_template.md @@ -0,0 +1,12 @@ +### Before submitting this PR into master please make sure: +If you added a new robot model: +- [ ] you extended the table of verified data in `README.md` with the new model +- [ ] you extended the CMakeLists.txt of the appropriate moveit configuration package with the new model +- [ ] you added a `test_.launch.py` and after launching the robot was visible in `rviz` +- [ ] you added a `_joint_limits.yaml` file in the `config` directory (to provide moveit support) + +If you modified an already existing robot model: +- [ ] you checked and optionally updated the table of verified data in `README.md` with the changes +- [ ] you have run the `test_.launch.py` and the robot was visible in `rviz` + +### Short description of the change diff --git a/README.md b/README.md index 6ef5e35..4ac5581 100644 --- a/README.md +++ b/README.md @@ -77,36 +77,38 @@ Example of attaching an end effector (with link name `eef_base_link`) to the `fl Some of the data in the xacros might not be valid or missing, the following table shows what can be considered valid. -|Robot name | Transformations | Joint position limits | Joint velocity limits | Joint effort limits | Inertial values | Simplified collision meshes| -|---|:---:|:---:|:---:|:---:|:---:|:---:| -|lbr_iisy3_r760 | ✓ | ✓ | ✓ | ✓ | | ✓ | -|lbr_iisy11_r1300 | ✓ | ✓ | ✓ | ✓ | | | -|lbr_iisy15_r930 | ✓ | ✓ | ✓ | ✓ | | | -|lbr_iiwa14_r820 | ✓ | ✓ | ✓ | | | | -|kr6_r700_sixx | ✓ | ✓ | ✓ | | | ✓ | -|kr6_r900_sixx | ✓ | ✓ | ✓ | | | ✓ | -|kr16_r2010_2 | ✓ | ✓ | ✓ | ✓ | | | -|kr210_r2700_2 | ✓ | ✓ | ✓ | ✓ | | | -|kr210_r3100_2 | ✓ | ✓ | ✓ | ✓ | | | +|Robot name | Robot family | Transformations | Joint position limits | Joint velocity limits | Joint effort limits | Inertial values | Simplified collision meshes| +|---|:---:|:---:|:---:|:---:|:---:|:---:|:---:| +|lbr_iisy3_r760| - | ✓ | ✓ | ✓ | ✓ | | ✓ | +|lbr_iisy11_r1300| - | ✓ | ✓ | ✓ | ✓ | | | +|lbr_iisy15_r930| - | ✓ | ✓ | ✓ | ✓ | | | +|lbr_iiwa14_r820| - | ✓ | ✓ | ✓ | | | | +|kr6_r700_sixx| agilus | ✓ | ✓ | ✓ | | | ✓ | +|kr6_r900_sixx| agilus | ✓ | ✓ | ✓ | | | ✓ | +|kr10_r1100_2| agilus | ✓ | ✓ | ✓ | ✓ | | | +|kr16_r2010_2| cybertech | ✓ | ✓ | ✓ | ✓ | | | +|kr210_r2700_2| quantec | ✓ | ✓ | ✓ | ✓ | | | +|kr210_r3100_2| quantec | ✓ | ✓ | ✓ | ✓ | | | ## Starting the move group server with fake hardware -To start the driver with fake hardware and the motion planning rviz plugin, the following launch files can be used: +To start rviz with the motion planning plugin using fake hardware, the following launch files can be used: -For KR robots (KSS): +#### KR robots (KSS): ``` ros2 launch kuka_kr_moveit_config moveit_planning_fake_hardware.launch.py ``` -Matching `robot_model` and `robot_family` arguments can be added to the command e.g. (`robot_model:=kr16_r2010_2` `robot_family:=cybertech`). +Matching `robot_model` and `robot_family` arguments can be added after the command (e.g. `robot_model:=kr16_r2010_2 robot_family:=cybertech`). The default robot model is `kr6_r700_sixx` -For LBR iiwa robots (Sunrise): +#### LBR iiwa robots (Sunrise): ``` ros2 launch kuka_lbr_iisy_moveit_config moveit_planning_fake_hardware.launch.py ``` -For LBR iisy robots (iiQKA): +#### LBR iisy robots (iiQKA): ``` ros2 launch kuka_lbr_iiwa_moveit_config moveit_planning_fake_hardware.launch.py ``` +A `robot_model` argument can be added after the command (e.g. `robot_model:=lbr_iisy11_r1300`). The default robot model is `lbr_iisy3_r760` -This will launch exactly the same nodes, as the driver launch file, but with fake hardware. Therefore the `robot_manager` lifecycle node must be configured and activated to be able to see the robot in rviz. After activation the server will be able to accept planning requests, from the plugin or from code. (An example how to create such a request from C++ code can be found in the (kuka_drivers/examples)/iiqka_moveit_example package.) +These launch files are not using the actual driver implementation, they only start `rviz` the `move_group` server and a `ros2_control_node` with fake hardware and two controllers `joint_state_broadcaster` and `joint_trajectory_controller` The server will be able to accept planning requests from the plugin or from code. (An example how to create such a request from C++ code can be found in the `iiqka_moveit_example` package in the `kuka_drivers` repository.) To support hardwares with less performance, the update rate of the control node was reduced to 50 Hz for all robots. diff --git a/kuka_agilus_support/config/kr10_r1100_2_joint_limits.yaml b/kuka_agilus_support/config/kr10_r1100_2_joint_limits.yaml new file mode 100644 index 0000000..0b2ab1d --- /dev/null +++ b/kuka_agilus_support/config/kr10_r1100_2_joint_limits.yaml @@ -0,0 +1,38 @@ +# joint_limits.yaml allows the dynamics properties specified in the URDF to be overwritten or augmented as needed +# Specific joint properties can be changed with the keys [max_position, min_position, max_velocity, max_acceleration, max_jerk] +# Joint limits can be turned off with [has_velocity_limits, has_acceleration_limits] + +# Easiest way to slow down the robot is to decrease the velocity and acceleration scaling factors +default_velocity_scaling_factor: 1.0 +default_acceleration_scaling_factor: 1.0 +joint_limits: + joint_1: + has_velocity_limits: true + max_velocity: 5.23599 + has_acceleration_limits: false + has_jerk: false + joint_2: + has_velocity_limits: true + max_velocity: 3.926991 + has_acceleration_limits: false + has_jerk: false + joint_3: + has_velocity_limits: true + max_velocity: 5.75959 + has_acceleration_limits: false + has_jerk: false + joint_4: + has_velocity_limits: true + max_velocity: 6.28319 + has_acceleration_limits: false + has_jerk: false + joint_5: + has_velocity_limits: true + max_velocity: 6.28319 + has_acceleration_limits: false + has_jerk: false + joint_6: + has_velocity_limits: true + max_velocity: 7.55728 + has_acceleration_limits: false + has_jerk: false diff --git a/kuka_agilus_support/launch/test_kr10r1100_2.launch.py b/kuka_agilus_support/launch/test_kr10r1100_2.launch.py new file mode 100644 index 0000000..a2802f6 --- /dev/null +++ b/kuka_agilus_support/launch/test_kr10r1100_2.launch.py @@ -0,0 +1,59 @@ +# Copyright 2022 Márton Antal +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from launch import LaunchDescription +from launch.substitutions import Command, FindExecutable, PathJoinSubstitution +from launch_ros.substitutions import FindPackageShare +from launch_ros.actions import Node + + +def generate_launch_description(): + robot_description_content = Command( + [ + PathJoinSubstitution([FindExecutable(name="xacro")]), + " ", + PathJoinSubstitution( + [FindPackageShare("kuka_agilus_support"), + "urdf", "kr10_r1100_2.urdf.xacro"] + ), + " ", + "use_fake_hardware:=true", + ] + ) + robot_description = {'robot_description': robot_description_content} + + # RViz + rviz_config_file = PathJoinSubstitution([FindPackageShare( + 'kuka_resources'), "config", "view_6_axis_urdf.rviz"]) + rviz_node = Node(package='rviz2', + executable='rviz2', + name='rviz2_launch', + output='log', + arguments=['-d', rviz_config_file], + parameters=[robot_description]) + + # Publish TF + robot_state_publisher = Node(package='robot_state_publisher', + executable='robot_state_publisher', + name='robot_state_publisher', + output='both', + parameters=[robot_description]) + + # Joint state publisher + joint_state_publisher_gui = Node(package='joint_state_publisher_gui', + executable='joint_state_publisher_gui', + name='joint_state_publisher_gui', + output='log') + + return LaunchDescription([robot_state_publisher, rviz_node, joint_state_publisher_gui]) diff --git a/kuka_agilus_support/meshes/kr10_r1100_2/collision/base_link.stl b/kuka_agilus_support/meshes/kr10_r1100_2/collision/base_link.stl new file mode 100755 index 0000000..8767c58 Binary files /dev/null and b/kuka_agilus_support/meshes/kr10_r1100_2/collision/base_link.stl differ diff --git a/kuka_agilus_support/meshes/kr10_r1100_2/collision/link_1.stl b/kuka_agilus_support/meshes/kr10_r1100_2/collision/link_1.stl new file mode 100755 index 0000000..c23e6cb Binary files /dev/null and b/kuka_agilus_support/meshes/kr10_r1100_2/collision/link_1.stl differ diff --git a/kuka_agilus_support/meshes/kr10_r1100_2/collision/link_2.stl b/kuka_agilus_support/meshes/kr10_r1100_2/collision/link_2.stl new file mode 100755 index 0000000..fc14a00 Binary files /dev/null and b/kuka_agilus_support/meshes/kr10_r1100_2/collision/link_2.stl differ diff --git a/kuka_agilus_support/meshes/kr10_r1100_2/collision/link_3.stl b/kuka_agilus_support/meshes/kr10_r1100_2/collision/link_3.stl new file mode 100755 index 0000000..5b6f142 Binary files /dev/null and b/kuka_agilus_support/meshes/kr10_r1100_2/collision/link_3.stl differ diff --git a/kuka_agilus_support/meshes/kr10_r1100_2/collision/link_4.stl b/kuka_agilus_support/meshes/kr10_r1100_2/collision/link_4.stl new file mode 100755 index 0000000..6cca473 Binary files /dev/null and b/kuka_agilus_support/meshes/kr10_r1100_2/collision/link_4.stl differ diff --git a/kuka_agilus_support/meshes/kr10_r1100_2/collision/link_5.stl b/kuka_agilus_support/meshes/kr10_r1100_2/collision/link_5.stl new file mode 100755 index 0000000..eb03311 Binary files /dev/null and b/kuka_agilus_support/meshes/kr10_r1100_2/collision/link_5.stl differ diff --git a/kuka_agilus_support/meshes/kr10_r1100_2/collision/link_6.stl b/kuka_agilus_support/meshes/kr10_r1100_2/collision/link_6.stl new file mode 100755 index 0000000..2bfcaa2 Binary files /dev/null and b/kuka_agilus_support/meshes/kr10_r1100_2/collision/link_6.stl differ diff --git a/kuka_agilus_support/meshes/kr10_r1100_2/visual/base_link.stl b/kuka_agilus_support/meshes/kr10_r1100_2/visual/base_link.stl new file mode 100755 index 0000000..8767c58 Binary files /dev/null and b/kuka_agilus_support/meshes/kr10_r1100_2/visual/base_link.stl differ diff --git a/kuka_agilus_support/meshes/kr10_r1100_2/visual/link_1.stl b/kuka_agilus_support/meshes/kr10_r1100_2/visual/link_1.stl new file mode 100755 index 0000000..c23e6cb Binary files /dev/null and b/kuka_agilus_support/meshes/kr10_r1100_2/visual/link_1.stl differ diff --git a/kuka_agilus_support/meshes/kr10_r1100_2/visual/link_2.stl b/kuka_agilus_support/meshes/kr10_r1100_2/visual/link_2.stl new file mode 100755 index 0000000..fc14a00 Binary files /dev/null and b/kuka_agilus_support/meshes/kr10_r1100_2/visual/link_2.stl differ diff --git a/kuka_agilus_support/meshes/kr10_r1100_2/visual/link_3.stl b/kuka_agilus_support/meshes/kr10_r1100_2/visual/link_3.stl new file mode 100755 index 0000000..5b6f142 Binary files /dev/null and b/kuka_agilus_support/meshes/kr10_r1100_2/visual/link_3.stl differ diff --git a/kuka_agilus_support/meshes/kr10_r1100_2/visual/link_4.stl b/kuka_agilus_support/meshes/kr10_r1100_2/visual/link_4.stl new file mode 100755 index 0000000..6cca473 Binary files /dev/null and b/kuka_agilus_support/meshes/kr10_r1100_2/visual/link_4.stl differ diff --git a/kuka_agilus_support/meshes/kr10_r1100_2/visual/link_5.stl b/kuka_agilus_support/meshes/kr10_r1100_2/visual/link_5.stl new file mode 100755 index 0000000..eb03311 Binary files /dev/null and b/kuka_agilus_support/meshes/kr10_r1100_2/visual/link_5.stl differ diff --git a/kuka_agilus_support/meshes/kr10_r1100_2/visual/link_6.stl b/kuka_agilus_support/meshes/kr10_r1100_2/visual/link_6.stl new file mode 100755 index 0000000..2bfcaa2 Binary files /dev/null and b/kuka_agilus_support/meshes/kr10_r1100_2/visual/link_6.stl differ diff --git a/kuka_agilus_support/package.xml b/kuka_agilus_support/package.xml index 52e40f0..0dfd2b0 100644 --- a/kuka_agilus_support/package.xml +++ b/kuka_agilus_support/package.xml @@ -8,21 +8,19 @@

This package contains configuration data, 3D models and launch files - for KUKA KR 6 manipulators. This currently includes the R700 sixx, - the R900 sixx and the R900-2. + for KUKA agilus manipulators. This currently includes the R700 sixx, + the R900 sixx and the R1100-2.

Specifications:

  • KR 6 R700 sixx - Default
  • KR 6 R900 sixx - Default
  • -
  • KR 6 R900-2 - Default
  • +
  • KR 6 R1100-2 - Default

Joint limits and maximum joint velocities for sixx models are based on the information in the KUKA Roboter GmbH - KR AGILUS sixx - With W and C Variants - Specification version Spez KR AGILUS sixx V12, 26.03.2015. - Joint limits and maximum joint velocities for R900-2 are based on the information - in the KUKA Deutschland GmbH - Robots KR AGILUS-2 Specification version V4, 26.02.2019. All urdfs are based on the default motion and joint velocity limits, unless noted otherwise (ie: no support for high speed joints, extended / limited motion ranges or other options). @@ -32,9 +30,6 @@ in this package, be sure to check they are correct for the particular robot model and configuration you intend to use them with.

-

- Note: the KR6 R900-2 urdf reuses meshes from the kuka_kr10_support package because of their identical appearance. -

G.A. vd. Hoorn (TU Delft Robotics Institute) Brett Hemes (3M) diff --git a/kuka_agilus_support/urdf/kr10_r1100_2.urdf.xacro b/kuka_agilus_support/urdf/kr10_r1100_2.urdf.xacro new file mode 100644 index 0000000..5a5dc12 --- /dev/null +++ b/kuka_agilus_support/urdf/kr10_r1100_2.urdf.xacro @@ -0,0 +1,10 @@ + + + + + + + + + + \ No newline at end of file diff --git a/kuka_agilus_support/urdf/kr10_r1100_2_macro.xacro b/kuka_agilus_support/urdf/kr10_r1100_2_macro.xacro new file mode 100644 index 0000000..af743db --- /dev/null +++ b/kuka_agilus_support/urdf/kr10_r1100_2_macro.xacro @@ -0,0 +1,232 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/kuka_agilus_support/urdf/kr_agilus_ros2_control.xacro b/kuka_agilus_support/urdf/kr_agilus_ros2_control.xacro index 1e69c26..7cb90cd 100644 --- a/kuka_agilus_support/urdf/kr_agilus_ros2_control.xacro +++ b/kuka_agilus_support/urdf/kr_agilus_ros2_control.xacro @@ -5,7 +5,7 @@ mock_components/GenericSystem - false + false 0.0 diff --git a/kuka_cybertech_support/urdf/kr16_r2010_2_macro.xacro b/kuka_cybertech_support/urdf/kr16_r2010_2_macro.xacro index 3c86011..0cfce22 100644 --- a/kuka_cybertech_support/urdf/kr16_r2010_2_macro.xacro +++ b/kuka_cybertech_support/urdf/kr16_r2010_2_macro.xacro @@ -201,7 +201,7 @@ - + diff --git a/kuka_cybertech_support/urdf/kr_cybertech_ros2_control.xacro b/kuka_cybertech_support/urdf/kr_cybertech_ros2_control.xacro index 88fd1d9..e4d922f 100644 --- a/kuka_cybertech_support/urdf/kr_cybertech_ros2_control.xacro +++ b/kuka_cybertech_support/urdf/kr_cybertech_ros2_control.xacro @@ -5,7 +5,7 @@ mock_components/GenericSystem - false + false 0.0 diff --git a/kuka_kr_moveit_config/CMakeLists.txt b/kuka_kr_moveit_config/CMakeLists.txt index 87454ba..d72456a 100644 --- a/kuka_kr_moveit_config/CMakeLists.txt +++ b/kuka_kr_moveit_config/CMakeLists.txt @@ -10,6 +10,7 @@ find_package(xacro REQUIRED) set(supported_robots kr6_r700_sixx kr6_r900_sixx + kr10_r1100_2 kr16_r2010_2 kr210-r2700_2 kr210-r3100_2 diff --git a/kuka_kr_moveit_config/launch/moveit_planning_fake_hardware.launch.py b/kuka_kr_moveit_config/launch/moveit_planning_fake_hardware.launch.py index e5f2aef..9312fc5 100644 --- a/kuka_kr_moveit_config/launch/moveit_planning_fake_hardware.launch.py +++ b/kuka_kr_moveit_config/launch/moveit_planning_fake_hardware.launch.py @@ -44,14 +44,6 @@ def launch_setup(context, *args, **kwargs): .to_moveit_configs() ) - rviz_config_file = get_package_share_directory( - 'kuka_resources') + "/config/planning_6_axis.rviz" - - startup_launch = IncludeLaunchDescription(PythonLaunchDescriptionSource( - [get_package_share_directory('kuka_kss_rsi_driver'), '/launch/startup.launch.py']), - launch_arguments={'robot_model': "{}".format(robot_model.perform(context)), - 'use_fake_hardware': "true"}.items()) - move_group_server = Node( package="moveit_ros_move_group", executable="move_group", @@ -59,19 +51,16 @@ def launch_setup(context, *args, **kwargs): parameters=[moveit_config.to_dict()], ) - rviz = Node( - package="rviz2", - executable="rviz2", - name="rviz2", - output="log", - arguments=["-d", rviz_config_file, - "--ros-args", "--log-level", "error"], - ) + fake_hardware_launch = IncludeLaunchDescription(PythonLaunchDescriptionSource( + [get_package_share_directory('kuka_resources'), + '/launch/fake_hardware_planning_template.launch.py']), + launch_arguments={'robot_model': "{}".format(robot_model.perform(context)), + 'robot_family': "{}".format(robot_family.perform(context)), + 'dof': "{}".format(6)}.items()) to_start = [ - startup_launch, - move_group_server, - rviz + fake_hardware_launch, + move_group_server ] return to_start diff --git a/kuka_lbr_iisy_moveit_config/launch/moveit_planning_fake_hardware.launch.py b/kuka_lbr_iisy_moveit_config/launch/moveit_planning_fake_hardware.launch.py index 0250720..59218c5 100644 --- a/kuka_lbr_iisy_moveit_config/launch/moveit_planning_fake_hardware.launch.py +++ b/kuka_lbr_iisy_moveit_config/launch/moveit_planning_fake_hardware.launch.py @@ -42,14 +42,6 @@ def launch_setup(context, *args, **kwargs): .to_moveit_configs() ) - rviz_config_file = get_package_share_directory( - 'kuka_resources') + "/config/planning_6_axis.rviz" - - startup_launch = IncludeLaunchDescription(PythonLaunchDescriptionSource( - [get_package_share_directory('kuka_iiqka_eac_driver'), '/launch/startup.launch.py']), - launch_arguments={'robot_model': "{}".format(robot_model.perform(context)), - 'use_fake_hardware': "true"}.items()) - move_group_server = Node( package="moveit_ros_move_group", executable="move_group", @@ -57,19 +49,16 @@ def launch_setup(context, *args, **kwargs): parameters=[moveit_config.to_dict()], ) - rviz = Node( - package="rviz2", - executable="rviz2", - name="rviz2", - output="log", - arguments=["-d", rviz_config_file, - "--ros-args", "--log-level", "error"], - ) + fake_hardware_launch = IncludeLaunchDescription(PythonLaunchDescriptionSource( + [get_package_share_directory('kuka_resources'), + '/launch/fake_hardware_planning_template.launch.py']), + launch_arguments={'robot_model': "{}".format(robot_model.perform(context)), + 'robot_family': "{}".format("lbr_iisy"), + 'dof': "{}".format(6)}.items()) to_start = [ - startup_launch, - move_group_server, - rviz + fake_hardware_launch, + move_group_server ] return to_start diff --git a/kuka_lbr_iisy_support/urdf/lbr_iisy_ros2_control.xacro b/kuka_lbr_iisy_support/urdf/lbr_iisy_ros2_control.xacro index 823a11b..7f6804e 100644 --- a/kuka_lbr_iisy_support/urdf/lbr_iisy_ros2_control.xacro +++ b/kuka_lbr_iisy_support/urdf/lbr_iisy_ros2_control.xacro @@ -5,7 +5,7 @@ mock_components/GenericSystem - false + false 0.0 @@ -38,48 +38,72 @@ - - + + 0.0 + + + 0.0 + - - + + 0.0 + + + 0.0 + - - + + 0.0 + + + 0.0 + - - + + 0.0 + + + 0.0 + - - + + 0.0 + + + 0.0 + - - + + 0.0 + + + 0.0 + diff --git a/kuka_lbr_iiwa_moveit_config/launch/moveit_planning_fake_hardware.launch.py b/kuka_lbr_iiwa_moveit_config/launch/moveit_planning_fake_hardware.launch.py index be84136..d16beeb 100644 --- a/kuka_lbr_iiwa_moveit_config/launch/moveit_planning_fake_hardware.launch.py +++ b/kuka_lbr_iiwa_moveit_config/launch/moveit_planning_fake_hardware.launch.py @@ -42,14 +42,6 @@ def launch_setup(context, *args, **kwargs): .to_moveit_configs() ) - rviz_config_file = get_package_share_directory( - 'kuka_resources') + "/config/planning_7_axis.rviz" - - startup_launch = IncludeLaunchDescription(PythonLaunchDescriptionSource( - [get_package_share_directory('kuka_sunrise_fri_driver'), '/launch/startup.launch.py']), - launch_arguments={'robot_model': "{}".format(robot_model.perform(context)), - 'use_fake_hardware': "true"}.items()) - move_group_server = Node( package="moveit_ros_move_group", executable="move_group", @@ -57,19 +49,16 @@ def launch_setup(context, *args, **kwargs): parameters=[moveit_config.to_dict()], ) - rviz = Node( - package="rviz2", - executable="rviz2", - name="rviz2", - output="log", - arguments=["-d", rviz_config_file, - "--ros-args", "--log-level", "error"], - ) + fake_hardware_launch = IncludeLaunchDescription(PythonLaunchDescriptionSource( + [get_package_share_directory('kuka_resources'), + '/launch/fake_hardware_planning_template.launch.py']), + launch_arguments={'robot_model': "{}".format(robot_model.perform(context)), + 'robot_family': "{}".format("lbr_iiwa"), + 'dof': "{}".format(7)}.items()) to_start = [ - startup_launch, - move_group_server, - rviz + fake_hardware_launch, + move_group_server ] return to_start diff --git a/kuka_lbr_iiwa_support/urdf/lbr_iiwa_ros2_control.xacro b/kuka_lbr_iiwa_support/urdf/lbr_iiwa_ros2_control.xacro index 8a7fb03..0d8390a 100644 --- a/kuka_lbr_iiwa_support/urdf/lbr_iiwa_ros2_control.xacro +++ b/kuka_lbr_iiwa_support/urdf/lbr_iiwa_ros2_control.xacro @@ -5,7 +5,7 @@ mock_components/GenericSystem - false + false 0.0 @@ -16,51 +16,93 @@ - - - + + 0.0 + + + 0.0 + + + 0.0 + - - - + + 0.0 + + + 0.0 + + + 0.0 + - - - + + 0.0 + + + 0.0 + + + 0.0 + - - - + + 0.0 + + + 0.0 + + + 0.0 + - - - + + 0.0 + + + 0.0 + + + 0.0 + - - - + + 0.0 + + + 0.0 + + + 0.0 + - - - + + 0.0 + + + 0.0 + + + 0.0 + diff --git a/kuka_quantec_support/urdf/kr_quantec_ros2_control.xacro b/kuka_quantec_support/urdf/kr_quantec_ros2_control.xacro index 77222ac..afca1f7 100644 --- a/kuka_quantec_support/urdf/kr_quantec_ros2_control.xacro +++ b/kuka_quantec_support/urdf/kr_quantec_ros2_control.xacro @@ -5,7 +5,7 @@ mock_components/GenericSystem - false + false 0.0 diff --git a/kuka_resources/CMakeLists.txt b/kuka_resources/CMakeLists.txt index 53ca03a..fdcefb4 100644 --- a/kuka_resources/CMakeLists.txt +++ b/kuka_resources/CMakeLists.txt @@ -4,7 +4,7 @@ project(kuka_resources) find_package(ament_cmake REQUIRED) find_package(urdf REQUIRED) -install(DIRECTORY urdf config +install(DIRECTORY urdf config launch DESTINATION share/${PROJECT_NAME}) ament_package() diff --git a/kuka_resources/config/fake_hardware_config_6_axis.yaml b/kuka_resources/config/fake_hardware_config_6_axis.yaml new file mode 100644 index 0000000..958085d --- /dev/null +++ b/kuka_resources/config/fake_hardware_config_6_axis.yaml @@ -0,0 +1,28 @@ +controller_manager: + ros__parameters: + # Update rate is intentionally lower than for real robot to support less powerful hardware + update_rate: 50 # Hz + + joint_trajectory_controller: + type: joint_trajectory_controller/JointTrajectoryController + + joint_state_broadcaster: + type: joint_state_broadcaster/JointStateBroadcaster + +joint_trajectory_controller: + ros__parameters: + joints: + - joint_1 + - joint_2 + - joint_3 + - joint_4 + - joint_5 + - joint_6 + + command_interfaces: + - position + state_interfaces: + - position + state_publish_rate: 50.0 + action_monitor_rate: 20.0 + allow_nonzero_velocity_at_trajectory_end: True \ No newline at end of file diff --git a/kuka_resources/config/fake_hardware_config_7_axis.yaml b/kuka_resources/config/fake_hardware_config_7_axis.yaml new file mode 100644 index 0000000..ca5d44e --- /dev/null +++ b/kuka_resources/config/fake_hardware_config_7_axis.yaml @@ -0,0 +1,29 @@ +controller_manager: + ros__parameters: + # Update rate is intentionally lower than for real robot to support less powerful hardware + update_rate: 50 # Hz + + joint_trajectory_controller: + type: joint_trajectory_controller/JointTrajectoryController + + joint_state_broadcaster: + type: joint_state_broadcaster/JointStateBroadcaster + +joint_trajectory_controller: + ros__parameters: + joints: + - joint_1 + - joint_2 + - joint_3 + - joint_4 + - joint_5 + - joint_6 + - joint_7 + + command_interfaces: + - position + state_interfaces: + - position + state_publish_rate: 50.0 + action_monitor_rate: 20.0 + allow_nonzero_velocity_at_trajectory_end: True \ No newline at end of file diff --git a/kuka_resources/launch/fake_hardware_planning_template.launch.py b/kuka_resources/launch/fake_hardware_planning_template.launch.py new file mode 100644 index 0000000..9344800 --- /dev/null +++ b/kuka_resources/launch/fake_hardware_planning_template.launch.py @@ -0,0 +1,118 @@ +# Copyright 2022 Áron Svastits +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +from launch import LaunchDescription +from launch_ros.actions import Node +from ament_index_python.packages import get_package_share_directory +from launch.actions import DeclareLaunchArgument, OpaqueFunction +from launch.substitutions import LaunchConfiguration + +from launch.substitutions import Command, FindExecutable, PathJoinSubstitution +from launch_ros.substitutions import FindPackageShare + + +def launch_setup(context, *args, **kwargs): + robot_model = LaunchConfiguration('robot_model') + robot_family = LaunchConfiguration('robot_family') + dof = LaunchConfiguration('dof') + + rviz_config_file = get_package_share_directory( + 'kuka_resources') + "/config/planning_{}_axis.rviz".format(dof.perform(context)) + + # Get URDF via xacro + robot_description_content = Command( + [ + PathJoinSubstitution([FindExecutable(name="xacro")]), + " ", + PathJoinSubstitution( + [FindPackageShare('kuka_{}_support'.format(robot_family.perform(context))), + "urdf", robot_model.perform(context) + ".urdf.xacro"] + ), + " ", + "use_fake_hardware:=", + 'true', + ] + ) + + robot_description = {'robot_description': robot_description_content} + + controller_config = (get_package_share_directory('kuka_resources') + + "/config/fake_hardware_config_{}_axis.yaml".format(dof.perform(context))) + + controller_manager_node = '/controller_manager' + + control_node = Node( + package='controller_manager', + executable='ros2_control_node', + parameters=[robot_description, controller_config] + ) + + rviz = Node( + package="rviz2", + executable="rviz2", + name="rviz2", + output="log", + arguments=["-d", rviz_config_file, + "--ros-args", "--log-level", "error"], + ) + + robot_state_publisher = Node( + package='robot_state_publisher', + executable='robot_state_publisher', + output='both', + parameters=[robot_description] + ) + + # Spawn controllers + def controller_spawner(controller_with_config): + arg_list = [controller_with_config[0], "-c", controller_manager_node, "-p", + controller_with_config[1]] + return Node( + package="controller_manager", + executable="spawner", + arguments=arg_list + ) + + controller_names_and_config = [ + ("joint_state_broadcaster", []), + ("joint_trajectory_controller", controller_config), + ] + + controller_spawners = [controller_spawner(controllers) + for controllers in controller_names_and_config] + + to_start = [ + control_node, + robot_state_publisher, + rviz + ] + controller_spawners + + return to_start + + +def generate_launch_description(): + launch_arguments = [] + launch_arguments.append(DeclareLaunchArgument( + 'robot_model', + default_value='' + )) + launch_arguments.append(DeclareLaunchArgument( + 'robot_family', + default_value='' + )) + launch_arguments.append(DeclareLaunchArgument( + 'dof', + default_value='6' + )) + return LaunchDescription(launch_arguments + [OpaqueFunction(function=launch_setup)])