From 30f3f9437c5ccd9a33f77ec5873cc35995c5a7ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Denis=20=C5=A0togl?= Date: Fri, 28 May 2021 18:00:34 +0200 Subject: [PATCH] Move all files --- .../config/diffbot_diff_drive_controller.yaml | 0 ...ot_gazebo_forward_controller_position.yaml | 0 ...t_multi_interface_forward_controllers.yaml | 0 .../env-hooks/ros2_control_demo_robot.dsv.in | 0 .../launch/diffbot_system.launch.py | 0 .../launch/rrbot.launch.py | 15 +- .../rrbot_system_multi_interface.launch.py | 81 +++++++ ...rbot_system_position_only_gazebo.launch.py | 105 +++++++++ .../meshes/hokuyo.dae | 0 .../urdf}/diffbot_system.urdf.xacro | 0 ..._system_multi_interface.ros2_control.xacro | 30 ++- .../rrbot_system_multi_interface.urdf.xacro | 46 ++++ ...ot_system_position_only.ros2_control.xacro | 40 ---- .../description/rrbot/urdf/rrbot.urdf.xacro | 204 ------------------ .../rrbot_system_multi_interface.urdf.xacro | 38 ---- .../rrbot_system_multi_interface.launch.py | 52 ----- ...rbot_system_position_only_gazebo.launch.py | 77 ------- 17 files changed, 269 insertions(+), 419 deletions(-) rename {ros2_control_demo_robot => ros2_control_demo_bringup}/config/diffbot_diff_drive_controller.yaml (100%) rename {ros2_control_demo_robot => ros2_control_demo_bringup}/config/rrbot_gazebo_forward_controller_position.yaml (100%) rename {ros2_control_demo_robot => ros2_control_demo_bringup}/config/rrbot_multi_interface_forward_controllers.yaml (100%) rename {ros2_control_demo_robot => ros2_control_demo_bringup}/env-hooks/ros2_control_demo_robot.dsv.in (100%) rename {ros2_control_demo_robot => ros2_control_demo_bringup}/launch/diffbot_system.launch.py (100%) create mode 100644 ros2_control_demo_bringup/launch/rrbot_system_multi_interface.launch.py create mode 100644 ros2_control_demo_bringup/launch/rrbot_system_position_only_gazebo.launch.py rename {ros2_control_demo_robot/description/rrbot => ros2_control_demo_description}/meshes/hokuyo.dae (100%) rename {ros2_control_demo_robot/description => ros2_control_demo_description/urdf}/diffbot_system.urdf.xacro (100%) rename {ros2_control_demo_robot/description/rrbot => ros2_control_demo_description/urdf/rrbot/ros2_control}/rrbot_system_multi_interface.ros2_control.xacro (59%) create mode 100644 ros2_control_demo_description/urdf/rrbot_system_multi_interface.urdf.xacro delete mode 100644 ros2_control_demo_robot/description/rrbot/ros2_control/rrbot_system_position_only.ros2_control.xacro delete mode 100644 ros2_control_demo_robot/description/rrbot/urdf/rrbot.urdf.xacro delete mode 100644 ros2_control_demo_robot/description/rrbot_system_multi_interface.urdf.xacro delete mode 100644 ros2_control_demo_robot/launch/rrbot_system_multi_interface.launch.py delete mode 100644 ros2_control_demo_robot/launch/rrbot_system_position_only_gazebo.launch.py diff --git a/ros2_control_demo_robot/config/diffbot_diff_drive_controller.yaml b/ros2_control_demo_bringup/config/diffbot_diff_drive_controller.yaml similarity index 100% rename from ros2_control_demo_robot/config/diffbot_diff_drive_controller.yaml rename to ros2_control_demo_bringup/config/diffbot_diff_drive_controller.yaml diff --git a/ros2_control_demo_robot/config/rrbot_gazebo_forward_controller_position.yaml b/ros2_control_demo_bringup/config/rrbot_gazebo_forward_controller_position.yaml similarity index 100% rename from ros2_control_demo_robot/config/rrbot_gazebo_forward_controller_position.yaml rename to ros2_control_demo_bringup/config/rrbot_gazebo_forward_controller_position.yaml diff --git a/ros2_control_demo_robot/config/rrbot_multi_interface_forward_controllers.yaml b/ros2_control_demo_bringup/config/rrbot_multi_interface_forward_controllers.yaml similarity index 100% rename from ros2_control_demo_robot/config/rrbot_multi_interface_forward_controllers.yaml rename to ros2_control_demo_bringup/config/rrbot_multi_interface_forward_controllers.yaml diff --git a/ros2_control_demo_robot/env-hooks/ros2_control_demo_robot.dsv.in b/ros2_control_demo_bringup/env-hooks/ros2_control_demo_robot.dsv.in similarity index 100% rename from ros2_control_demo_robot/env-hooks/ros2_control_demo_robot.dsv.in rename to ros2_control_demo_bringup/env-hooks/ros2_control_demo_robot.dsv.in diff --git a/ros2_control_demo_robot/launch/diffbot_system.launch.py b/ros2_control_demo_bringup/launch/diffbot_system.launch.py similarity index 100% rename from ros2_control_demo_robot/launch/diffbot_system.launch.py rename to ros2_control_demo_bringup/launch/diffbot_system.launch.py diff --git a/ros2_control_demo_bringup/launch/rrbot.launch.py b/ros2_control_demo_bringup/launch/rrbot.launch.py index 3d54ab41b..1082fed3d 100644 --- a/ros2_control_demo_bringup/launch/rrbot.launch.py +++ b/ros2_control_demo_bringup/launch/rrbot.launch.py @@ -62,6 +62,13 @@ def generate_launch_description(): have to be updated.", ) ) + declared_arguments.append( + DeclareLaunchArgument( + "use_sim", + default_value="false", + description="Start robot in Gazebo simulation.", + ) + ) declared_arguments.append( DeclareLaunchArgument( "use_fake_hardware", @@ -96,6 +103,7 @@ def generate_launch_description(): description_package = LaunchConfiguration("description_package") description_file = LaunchConfiguration("description_file") prefix = LaunchConfiguration("prefix") + use_sim = LaunchConfiguration("use_sim") use_fake_hardware = LaunchConfiguration("use_fake_hardware") fake_sensor_commands = LaunchConfiguration("fake_sensor_commands") slowdown = LaunchConfiguration("slowdown") @@ -106,11 +114,16 @@ def generate_launch_description(): [ PathJoinSubstitution([FindExecutable(name="xacro")]), " ", - PathJoinSubstitution([FindPackageShare(description_package), "urdf", description_file]), + PathJoinSubstitution( + [FindPackageShare(description_package), "urdf", description_file] + ), " ", "prefix:=", prefix, " ", + "use_sim:=", + use_sim, + " ", "use_fake_hardware:=", use_fake_hardware, " ", diff --git a/ros2_control_demo_bringup/launch/rrbot_system_multi_interface.launch.py b/ros2_control_demo_bringup/launch/rrbot_system_multi_interface.launch.py new file mode 100644 index 000000000..aa67787f2 --- /dev/null +++ b/ros2_control_demo_bringup/launch/rrbot_system_multi_interface.launch.py @@ -0,0 +1,81 @@ +# Copyright 2021 Department of Engineering Cybernetics, NTNU. +# +# 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.actions import DeclareLaunchArgument, IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch.substitutions import LaunchConfiguration, ThisLaunchFileDir + + +def generate_launch_description(): + # Declare arguments + declared_arguments = [] + declared_arguments.append( + DeclareLaunchArgument( + "prefix", + default_value='""', + description="Prefix of the joint names, useful for \ + multi-robot setup. If changed than also joint names in the controllers' configuration \ + have to be updated.", + ) + ) + declared_arguments.append( + DeclareLaunchArgument( + "use_fake_hardware", + default_value="true", + description="Start robot with fake hardware mirroring command to its states.", + ) + ) + declared_arguments.append( + DeclareLaunchArgument( + "fake_sensor_commands", + default_value="false", + description="Enable fake command interfaces for sensors used for simple simulations. \ + Used only if 'use_fake_hardware' parameter is true.", + ) + ) + declared_arguments.append( + DeclareLaunchArgument( + "slowdown", default_value="3.0", description="Slowdown factor of the RRbot." + ) + ) + declared_arguments.append( + DeclareLaunchArgument( + "robot_controller", + default_value="forward_position_controller", + description="Robot controller to start.", + ) + ) + + # Initialize Arguments + prefix = LaunchConfiguration("prefix") + use_fake_hardware = LaunchConfiguration("use_fake_hardware") + fake_sensor_commands = LaunchConfiguration("fake_sensor_commands") + slowdown = LaunchConfiguration("slowdown") + robot_controller = LaunchConfiguration("robot_controller") + + base_launch = IncludeLaunchDescription( + PythonLaunchDescriptionSource([ThisLaunchFileDir(), "/rrbot.launch.py"]), + launch_arguments={ + "controllers_file": "rrbot_multi_interface_forward_controllers.yaml", + "description_file": "rrbot_system_multi_interface.urdf.xacro", + "prefix": prefix, + "use_fake_hardware": use_fake_hardware, + "fake_sensor_commands": fake_sensor_commands, + "slowdown": slowdown, + "robot_controller": robot_controller, + }.items(), + ) + + return LaunchDescription(declared_arguments + [base_launch]) diff --git a/ros2_control_demo_bringup/launch/rrbot_system_position_only_gazebo.launch.py b/ros2_control_demo_bringup/launch/rrbot_system_position_only_gazebo.launch.py new file mode 100644 index 000000000..978ac84f4 --- /dev/null +++ b/ros2_control_demo_bringup/launch/rrbot_system_position_only_gazebo.launch.py @@ -0,0 +1,105 @@ +# Copyright 2021 Open Source Robotics Foundation, Inc. +# +# 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.actions import DeclareLaunchArgument, IncludeLaunchDescription +from launch.launch_description_sources import PythonLaunchDescriptionSource +from launch.substitutions import LaunchConfiguration, PathJoinSubstitution, ThisLaunchFileDir + +from launch_ros.actions import Node +from launch_ros.substitutions import FindPackageShare + + +def generate_launch_description(): + # Declare arguments + declared_arguments = [] + declared_arguments.append( + DeclareLaunchArgument( + "prefix", + default_value='""', + description="Prefix of the joint names, useful for \ + multi-robot setup. If changed than also joint names in the controllers' configuration \ + have to be updated.", + ) + ) + declared_arguments.append( + DeclareLaunchArgument( + "use_fake_hardware", + default_value="true", + description="Start robot with fake hardware mirroring command to its states.", + ) + ) + declared_arguments.append( + DeclareLaunchArgument( + "fake_sensor_commands", + default_value="false", + description="Enable fake command interfaces for sensors used for simple simulations. \ + Used only if 'use_fake_hardware' parameter is true.", + ) + ) + declared_arguments.append( + DeclareLaunchArgument( + "slowdown", default_value="3.0", description="Slowdown factor of the RRbot." + ) + ) + declared_arguments.append( + DeclareLaunchArgument( + "robot_controller", + default_value="forward_position_controller", + description="Robot controller to start.", + ) + ) + + # Initialize Arguments + prefix = LaunchConfiguration("prefix") + use_fake_hardware = LaunchConfiguration("use_fake_hardware") + fake_sensor_commands = LaunchConfiguration("fake_sensor_commands") + slowdown = LaunchConfiguration("slowdown") + robot_controller = LaunchConfiguration("robot_controller") + + gazebo = IncludeLaunchDescription( + PythonLaunchDescriptionSource( + [ + PathJoinSubstitution( + [ + FindPackageShare("gazebo_ros"), + "launch", + "/gazebo.launch.py", + ] + ) + ] + ), + launch_arguments={"verbose": "false"}.items(), + ) + + spawn_entity = Node( + package="gazebo_ros", + executable="spawn_entity.py", + arguments=["-topic", "robot_description", "-entity", "rrbot_system_position"], + output="screen", + ) + + base_launch = IncludeLaunchDescription( + PythonLaunchDescriptionSource([ThisLaunchFileDir(), "/rrbot.launch.py"]), + launch_arguments={ + "description_file": "rrbot_system_position_only.urdf.xacro", + "prefix": prefix, + "use_fake_hardware": use_fake_hardware, + "fake_sensor_commands": fake_sensor_commands, + "slowdown": slowdown, + "robot_controller": robot_controller, + }.items(), + ) + + return LaunchDescription(declared_arguments + [gazebo, base_launch, spawn_entity]) diff --git a/ros2_control_demo_robot/description/rrbot/meshes/hokuyo.dae b/ros2_control_demo_description/meshes/hokuyo.dae similarity index 100% rename from ros2_control_demo_robot/description/rrbot/meshes/hokuyo.dae rename to ros2_control_demo_description/meshes/hokuyo.dae diff --git a/ros2_control_demo_robot/description/diffbot_system.urdf.xacro b/ros2_control_demo_description/urdf/diffbot_system.urdf.xacro similarity index 100% rename from ros2_control_demo_robot/description/diffbot_system.urdf.xacro rename to ros2_control_demo_description/urdf/diffbot_system.urdf.xacro diff --git a/ros2_control_demo_robot/description/rrbot/rrbot_system_multi_interface.ros2_control.xacro b/ros2_control_demo_description/urdf/rrbot/ros2_control/rrbot_system_multi_interface.ros2_control.xacro similarity index 59% rename from ros2_control_demo_robot/description/rrbot/rrbot_system_multi_interface.ros2_control.xacro rename to ros2_control_demo_description/urdf/rrbot/ros2_control/rrbot_system_multi_interface.ros2_control.xacro index 60d7b46d2..5ca0251b6 100644 --- a/ros2_control_demo_robot/description/rrbot/rrbot_system_multi_interface.ros2_control.xacro +++ b/ros2_control_demo_description/urdf/rrbot/ros2_control/rrbot_system_multi_interface.ros2_control.xacro @@ -1,15 +1,31 @@ - + - - ros2_control_demo_hardware/RRBotSystemMultiInterfaceHardware - 2.0 - 3.0 - 2.0 - + + + + gazebo_ros2_control/GazeboSystem + + + + + + fake_components/GenericSystem + ${fake_sensor_commands} + 0.0 + + + ros2_control_demo_hardware/RRBotSystemMultiInterfaceHardware + 2.0 + 3.0 + ${slowdown} + + + + -1 diff --git a/ros2_control_demo_description/urdf/rrbot_system_multi_interface.urdf.xacro b/ros2_control_demo_description/urdf/rrbot_system_multi_interface.urdf.xacro new file mode 100644 index 000000000..ce1a243af --- /dev/null +++ b/ros2_control_demo_description/urdf/rrbot_system_multi_interface.urdf.xacro @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + diff --git a/ros2_control_demo_robot/description/rrbot/ros2_control/rrbot_system_position_only.ros2_control.xacro b/ros2_control_demo_robot/description/rrbot/ros2_control/rrbot_system_position_only.ros2_control.xacro deleted file mode 100644 index 628dd2c4d..000000000 --- a/ros2_control_demo_robot/description/rrbot/ros2_control/rrbot_system_position_only.ros2_control.xacro +++ /dev/null @@ -1,40 +0,0 @@ - - - - - - - - - - gazebo_ros2_control/GazeboSystem - - - - - ros2_control_demo_hardware/RRBotSystemPositionOnlyHardware - 2.0 - 3.0 - ${slowdown} - - - - - - -1 - 1 - - - - - - -1 - 1 - - - - - - - - diff --git a/ros2_control_demo_robot/description/rrbot/urdf/rrbot.urdf.xacro b/ros2_control_demo_robot/description/rrbot/urdf/rrbot.urdf.xacro deleted file mode 100644 index 97031e426..000000000 --- a/ros2_control_demo_robot/description/rrbot/urdf/rrbot.urdf.xacro +++ /dev/null @@ -1,204 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/ros2_control_demo_robot/description/rrbot_system_multi_interface.urdf.xacro b/ros2_control_demo_robot/description/rrbot_system_multi_interface.urdf.xacro deleted file mode 100644 index 6a330bb4c..000000000 --- a/ros2_control_demo_robot/description/rrbot_system_multi_interface.urdf.xacro +++ /dev/null @@ -1,38 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - true - - - - - - - - - - - diff --git a/ros2_control_demo_robot/launch/rrbot_system_multi_interface.launch.py b/ros2_control_demo_robot/launch/rrbot_system_multi_interface.launch.py deleted file mode 100644 index 59f202ebd..000000000 --- a/ros2_control_demo_robot/launch/rrbot_system_multi_interface.launch.py +++ /dev/null @@ -1,52 +0,0 @@ -# Copyright 2021 Department of Engineering Cybernetics, NTNU. -# -# 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. - - -import os - -from ament_index_python.packages import get_package_share_directory - -from launch import LaunchDescription -from launch_ros.actions import Node - -import xacro - - -def generate_launch_description(): - - # Get URDF via xacro - robot_description_path = os.path.join( - get_package_share_directory("ros2_control_demo_robot"), - "description", - "rrbot_system_multi_interface.urdf.xacro", - ) - robot_description_config = xacro.process_file(robot_description_path) - robot_description = {"robot_description": robot_description_config.toxml()} - - rrbot_forward_controller = os.path.join( - get_package_share_directory("ros2_control_demo_robot"), - "config", - "rrbot_multi_interface_forward_controllers.yaml", - ) - - return LaunchDescription( - [ - Node( - package="controller_manager", - executable="ros2_control_node", - parameters=[robot_description, rrbot_forward_controller], - output={"stdout": "screen", "stderr": "screen"}, - ) - ] - ) diff --git a/ros2_control_demo_robot/launch/rrbot_system_position_only_gazebo.launch.py b/ros2_control_demo_robot/launch/rrbot_system_position_only_gazebo.launch.py deleted file mode 100644 index 45cc547c7..000000000 --- a/ros2_control_demo_robot/launch/rrbot_system_position_only_gazebo.launch.py +++ /dev/null @@ -1,77 +0,0 @@ -# Copyright 2021 Open Source Robotics Foundation, Inc. -# -# 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. - -import os - -from ament_index_python.packages import get_package_share_directory - -from launch import LaunchDescription -from launch.actions import IncludeLaunchDescription -from launch.launch_description_sources import PythonLaunchDescriptionSource - -from launch_ros.actions import Node - -import xacro - - -def generate_launch_description(): - gazebo = IncludeLaunchDescription( - PythonLaunchDescriptionSource( - [ - os.path.join(get_package_share_directory("gazebo_ros"), "launch"), - "/gazebo.launch.py", - ] - ), - launch_arguments={"verbose": "false"}.items(), - ) - - robot_description_path = os.path.join( - get_package_share_directory("ros2_control_demo_robot"), - "description", - "rrbot", - "rrbot_system_position_only.urdf.xacro", - ) - robot_description_config = xacro.process_file( - robot_description_path, mappings={"use_sim": "true"} - ) - robot_description = {"robot_description": robot_description_config.toxml()} - - node_robot_state_publisher = Node( - package="robot_state_publisher", - executable="robot_state_publisher", - output="screen", - parameters=[robot_description], - ) - - spawn_entity = Node( - package="gazebo_ros", - executable="spawn_entity.py", - arguments=["-topic", "robot_description", "-entity", "rrbot_system_position"], - output="screen", - ) - spawn_controller = Node( - package="controller_manager", - executable="spawner.py", - arguments=["joint_state_broadcaster"], - output="screen", - ) - - return LaunchDescription( - [ - gazebo, - node_robot_state_publisher, - spawn_entity, - spawn_controller, - ] - )