diff --git a/config/diffbot_controllers.yaml b/config/controllers.yaml similarity index 100% rename from config/diffbot_controllers.yaml rename to config/controllers.yaml diff --git a/config/lsx10.yaml b/config/lidar.yaml similarity index 100% rename from config/lsx10.yaml rename to config/lidar.yaml diff --git a/config/twist_mux.yaml b/config/mux.yaml similarity index 100% rename from config/twist_mux.yaml rename to config/mux.yaml diff --git a/config/nav2_params.yaml b/config/nav2.yaml similarity index 100% rename from config/nav2_params.yaml rename to config/nav2.yaml diff --git a/config/mapper_params_online_async.yaml b/config/slam.yaml similarity index 100% rename from config/mapper_params_online_async.yaml rename to config/slam.yaml diff --git a/launch/min_bot_mini.launch.py b/launch/min_bot_mini.launch.py index 4c892d8..e73e2ab 100644 --- a/launch/min_bot_mini.launch.py +++ b/launch/min_bot_mini.launch.py @@ -105,6 +105,4 @@ def generate_launch_description(): robot_controller_spawner, joystick_spawner, teleop_spawner, - #cam_node, - #lidar_node ]) \ No newline at end of file diff --git a/launch/robot_cam.launch.py b/launch/robot_cam.launch.py index 30ae325..57e211d 100644 --- a/launch/robot_cam.launch.py +++ b/launch/robot_cam.launch.py @@ -21,70 +21,28 @@ from ament_index_python.packages import get_package_share_directory from launch_ros.actions import LifecycleNode from launch_ros.descriptions import ParameterValue +from launch.substitutions import LaunchConfiguration, PythonExpression +from launch.actions import DeclareLaunchArgument, GroupAction, SetEnvironmentVariable def generate_launch_description(): - robot_description_content = Command( - [ - PathJoinSubstitution([FindExecutable(name="xacro")]), - " ", - PathJoinSubstitution( - [ - FindPackageShare("cps_loki_description"), - "urdf", - "odrive_diffbot.urdf.xacro" - ] - ), - ] - ) - robot_description = {"robot_description": ParameterValue(robot_description_content, value_type=str)} - robot_controllers = PathJoinSubstitution( - [ - FindPackageShare("cps_loki_bringup"), - "config", - "diffbot_controllers.yaml", - ] - ) + namespace = LaunchConfiguration('namespace') + use_sim_time = LaunchConfiguration('use_sim_time') - control_node = Node( - package="controller_manager", - executable="ros2_control_node", - parameters=[robot_description, robot_controllers], - output="both", - ) + declare_namespace_cmd = DeclareLaunchArgument( + 'namespace', + default_value='', + description='Top-level namespace') - robot_state_pub_node = Node( - package="robot_state_publisher", - executable="robot_state_publisher", - output="both", - parameters=[robot_description], - ) - - joint_state_broadcaster_spawner = Node( - package="controller_manager", - executable="spawner", - arguments=["joint_state_broadcaster", "-c", "/controller_manager"], - ) - - robot_controller_spawner = Node( - package="controller_manager", - executable="spawner", - arguments=["diffbot_base_controller", "-c", "/controller_manager"], - ) - - joystick_spawner = Node( - package="joy", - executable="joy_node" - ) - - teleop_spawner = Node( - package="rmp220_teleop", - executable="rmp220_teleop" - ) + declare_use_sim_time_cmd = DeclareLaunchArgument( + 'use_sim_time', + default_value='false', + description='Use simulation (Gazebo) clock if true') cam_node = Node( package="ros2_cam_openCV", - executable="cam_node" + executable="cam_node", + namespace=namespace ) lidar_dir = os.path.join(get_package_share_directory('lslidar_driver'), 'params', 'lsx10.yaml') @@ -99,12 +57,5 @@ def generate_launch_description(): ) return LaunchDescription([ - #control_node, - #robot_state_pub_node, - #joint_state_broadcaster_spawner, - #robot_controller_spawner, - #joystick_spawner, - #teleop_spawner, - cam_node, - #lidar_node + cam_node ]) \ No newline at end of file diff --git a/launch/robot_controller.launch.py b/launch/robot_controller.launch.py index 380a06f..24b3c51 100644 --- a/launch/robot_controller.launch.py +++ b/launch/robot_controller.launch.py @@ -21,8 +21,24 @@ from ament_index_python.packages import get_package_share_directory from launch_ros.actions import LifecycleNode from launch_ros.descriptions import ParameterValue +from launch.substitutions import LaunchConfiguration, PythonExpression +from launch.actions import DeclareLaunchArgument, GroupAction, SetEnvironmentVariable def generate_launch_description(): + + namespace = LaunchConfiguration('namespace') + use_sim_time = LaunchConfiguration('use_sim_time') + + declare_namespace_cmd = DeclareLaunchArgument( + 'namespace', + default_value='', + description='Top-level namespace') + + declare_use_sim_time_cmd = DeclareLaunchArgument( + 'use_sim_time', + default_value='false', + description='Use simulation (Gazebo) clock if true') + robot_description_content = Command( [ PathJoinSubstitution([FindExecutable(name="xacro")]), @@ -42,7 +58,7 @@ def generate_launch_description(): [ FindPackageShare("cps_loki_bringup"), "config", - "diffbot_controllers.yaml", + "controllers.yaml", ] ) diff --git a/launch/robot_joy_teleop.launch.py b/launch/robot_joy_teleop.launch.py index 794a3ac..ab92c08 100644 --- a/launch/robot_joy_teleop.launch.py +++ b/launch/robot_joy_teleop.launch.py @@ -21,93 +21,30 @@ from ament_index_python.packages import get_package_share_directory from launch_ros.actions import LifecycleNode from launch_ros.descriptions import ParameterValue +from launch.substitutions import LaunchConfiguration, PythonExpression +from launch.actions import DeclareLaunchArgument, GroupAction, SetEnvironmentVariable def generate_launch_description(): - #use_sim_time = LaunchConfiguration('use_sim_time') - use_sim_time = True - - robot_description_content = Command( - [ - PathJoinSubstitution([FindExecutable(name="xacro")]), - " ", - PathJoinSubstitution( - [ - FindPackageShare("cps_loki_description"), - "urdf", - "odrive_diffbot.urdf.xacro" - ] - ), - ] - ) - robot_description = {"robot_description": ParameterValue(robot_description_content, value_type=str)} + namespace = LaunchConfiguration('namespace') + use_sim_time = LaunchConfiguration('use_sim_time') - robot_controllers = PathJoinSubstitution( - [ - FindPackageShare("cps_loki_bringup"), - "config", - "diffbot_controllers.yaml", - ] - ) + declare_namespace_cmd = DeclareLaunchArgument( + 'namespace', + default_value='', + description='Top-level namespace') - control_node = Node( - package="controller_manager", - executable="ros2_control_node", - parameters=[robot_description, robot_controllers], - output="both", - ) + declare_use_sim_time_cmd = DeclareLaunchArgument( + 'use_sim_time', + default_value='false', + description='Use simulation (Gazebo) clock if true') - robot_state_pub_node = Node( - package="robot_state_publisher", - executable="robot_state_publisher", - output="both", - parameters=[robot_description], - ) - - joint_state_broadcaster_spawner = Node( - package="controller_manager", - executable="spawner", - arguments=["joint_state_broadcaster", "-c", "/controller_manager"], - ) - - robot_controller_spawner = Node( - package="controller_manager", - executable="spawner", - arguments=["diffbot_base_controller", "-c", "/controller_manager"], - ) - - joystick_spawner = Node( - package="joy", - executable="joy_node" - ) - - teleop_spawner = Node( - package="rmp220_teleop", - executable="rmp220_teleop", - remappings=[('cmd_vel', 'cmd_vel_joy')], - ) - - cam_node = Node( - package="ros2_cam_openCV", - executable="cam_node" - ) - - lidar_dir = os.path.join(get_package_share_directory('lslidar_driver'), 'params', 'lsx10.yaml') - lidar_node = LifecycleNode( - package='lslidar_driver', - executable='lslidar_driver_node', - name='lslidar_driver_node', - output='screen', - emulate_tty=True, - namespace='', - parameters=[lidar_dir], - ) - - twist_mux_params = os.path.join(get_package_share_directory('cps_loki_bringup'),'config','twist_mux.yaml') + twist_mux_params = os.path.join(get_package_share_directory('cps_loki_bringup'),'config','mux.yaml') twist_mux = Node( package="twist_mux", executable="twist_mux", - parameters=[twist_mux_params, {'use_sim_time': False}], + parameters=[twist_mux_params, {'use_sim_time': use_sim_time}], remappings=[('/cmd_vel_out','/diffbot_base_controller/cmd_vel_unstamped')] + namespace = namespace ) joy_params = os.path.join(get_package_share_directory('cps_loki_bringup'),'config','joystick.yaml') @@ -115,7 +52,7 @@ def generate_launch_description(): package='joy', executable='joy_node', parameters=[joy_params, {'use_sim_time': use_sim_time}], - #namespace = namespace + namespace = namespace ) teleop_node = Node( @@ -124,18 +61,10 @@ def generate_launch_description(): name='teleop_node', parameters=[joy_params, {'use_sim_time': use_sim_time}], remappings=[('cmd_vel', 'cmd_vel_joy')], - #namespace = namespace + namespace = namespace ) return LaunchDescription([ - #control_node, - #robot_state_pub_node, - #joint_state_broadcaster_spawner, - #robot_controller_spawner, - #joystick_spawner, - #teleop_spawner, - #cam_node, - #lidar_node, twist_mux, joy_node, teleop_node diff --git a/launch/robot_lidar.launch.py b/launch/robot_lidar.launch.py index 8bdeef5..1695614 100644 --- a/launch/robot_lidar.launch.py +++ b/launch/robot_lidar.launch.py @@ -21,17 +21,32 @@ from ament_index_python.packages import get_package_share_directory from launch_ros.actions import LifecycleNode from launch_ros.descriptions import ParameterValue +from launch.substitutions import LaunchConfiguration, PythonExpression +from launch.actions import DeclareLaunchArgument, GroupAction, SetEnvironmentVariable def generate_launch_description(): - lidar_dir = os.path.join(get_package_share_directory('cps_loki_bringup'), 'config', 'lsx10.yaml') + namespace = LaunchConfiguration('namespace') + use_sim_time = LaunchConfiguration('use_sim_time') + + declare_namespace_cmd = DeclareLaunchArgument( + 'namespace', + default_value='', + description='Top-level namespace') + + declare_use_sim_time_cmd = DeclareLaunchArgument( + 'use_sim_time', + default_value='false', + description='Use simulation (Gazebo) clock if true') + + lidar_dir = os.path.join(get_package_share_directory('cps_loki_bringup'), 'config', 'lidar.yaml') lidar_node = LifecycleNode( package='lslidar_driver', executable='lslidar_driver_node', name='lslidar_driver_node', output='screen', emulate_tty=True, - namespace='', + namespace=namespace, parameters=[lidar_dir], ) diff --git a/launch/robot_localization.launch.py b/launch/robot_localization.launch.py index 97ca652..faf5830 100644 --- a/launch/robot_localization.launch.py +++ b/launch/robot_localization.launch.py @@ -22,101 +22,23 @@ from launch_ros.actions import LifecycleNode from launch_ros.descriptions import ParameterValue from launch.substitutions import LaunchConfiguration +from launch.substitutions import LaunchConfiguration, PythonExpression +from launch.actions import DeclareLaunchArgument, GroupAction, SetEnvironmentVariable def generate_launch_description(): - robot_description_content = Command( - [ - PathJoinSubstitution([FindExecutable(name="xacro")]), - " ", - PathJoinSubstitution( - [ - FindPackageShare("cps_loki_description"), - "urdf", - "odrive_diffbot.urdf.xacro" - ] - ), - ] - ) - robot_description = {"robot_description": ParameterValue(robot_description_content, value_type=str)} - robot_controllers = PathJoinSubstitution( - [ - FindPackageShare("cps_loki_bringup"), - "config", - "diffbot_controllers.yaml", - ] - ) + namespace = LaunchConfiguration('namespace') + use_sim_time = LaunchConfiguration('use_sim_time') - control_node = Node( - package="controller_manager", - executable="ros2_control_node", - parameters=[robot_description, robot_controllers], - output="both", - ) + declare_namespace_cmd = DeclareLaunchArgument( + 'namespace', + default_value='', + description='Top-level namespace') - robot_state_pub_node = Node( - package="robot_state_publisher", - executable="robot_state_publisher", - output="both", - parameters=[robot_description], - ) - - joint_state_broadcaster_spawner = Node( - package="controller_manager", - executable="spawner", - arguments=["joint_state_broadcaster", "-c", "/controller_manager"], - ) - - robot_controller_spawner = Node( - package="controller_manager", - executable="spawner", - arguments=["diffbot_base_controller", "-c", "/controller_manager"], - ) - - joystick_spawner = Node( - package="joy", - executable="joy_node" - ) - - teleop_spawner = Node( - package="rmp220_teleop", - executable="rmp220_teleop" - ) - - cam_node = Node( - package="ros2_cam_openCV", - executable="cam_node" - ) - - use_sim_time = False - slam_params_file = PathJoinSubstitution( - [ - FindPackageShare("cps_loki_bringup"), - "config", - "mapper_params_online_async.yaml" - ] - ) - mapper_node = Node( - package="slam_toolbox", - executable="async_slam_toolbox_node", - name='slam_toolbox_node', - output='screen', - parameters=[ - slam_params_file, - {'use_sim_time': use_sim_time} - ], - ) - - lidar_dir = os.path.join(get_package_share_directory('lslidar_driver'), 'params', 'lsx10.yaml') - lidar_node = LifecycleNode( - package='lslidar_driver', - executable='lslidar_driver_node', - name='lslidar_driver_node', - output='screen', - emulate_tty=True, - namespace='', - parameters=[lidar_dir], - ) + declare_use_sim_time_cmd = DeclareLaunchArgument( + 'use_sim_time', + default_value='false', + description='Use simulation (Gazebo) clock if true') robot_localization_node = Node( package='robot_localization', @@ -130,19 +52,11 @@ def generate_launch_description(): "ekf.yaml" ] ) , - #{'use_sim_time': LaunchConfiguration('use_sim_time')} - ] + {'use_sim_time': LaunchConfiguration('use_sim_time')} + ], + namespace=namespace ) return LaunchDescription([ - #control_node, - #robot_state_pub_node, - #joint_state_broadcaster_spawner, - #robot_controller_spawner, - #joystick_spawner, - #teleop_spawner, - #cam_node, - #lidar_node, - #mapper_node, robot_localization_node ]) \ No newline at end of file diff --git a/launch/robot_mapper.launch.py b/launch/robot_mapper.launch.py index c5780dd..ec1fe8b 100644 --- a/launch/robot_mapper.launch.py +++ b/launch/robot_mapper.launch.py @@ -22,17 +22,32 @@ from launch_ros.actions import LifecycleNode from launch_ros.descriptions import ParameterValue from launch.substitutions import LaunchConfiguration +from launch.substitutions import LaunchConfiguration, PythonExpression +from launch.actions import DeclareLaunchArgument, GroupAction, SetEnvironmentVariable def generate_launch_description(): + namespace = LaunchConfiguration('namespace') + use_sim_time = LaunchConfiguration('use_sim_time') + + declare_namespace_cmd = DeclareLaunchArgument( + 'namespace', + default_value='', + description='Top-level namespace') + + declare_use_sim_time_cmd = DeclareLaunchArgument( + 'use_sim_time', + default_value='false', + description='Use simulation (Gazebo) clock if true') + slam_params_file = PathJoinSubstitution( [ FindPackageShare("cps_loki_bringup"), "config", - "mapper_params_online_async.yaml" + "slam.yaml" ] ) - + mapper_node = Node( package="slam_toolbox", executable="async_slam_toolbox_node", @@ -42,6 +57,7 @@ def generate_launch_description(): slam_params_file, {'use_sim_time': use_sim_time} ], + namespace=namespace ) return LaunchDescription([ diff --git a/launch/robot_navigation.launch.py b/launch/robot_navigation.launch.py index 3c5ca58..6b18538 100644 --- a/launch/robot_navigation.launch.py +++ b/launch/robot_navigation.launch.py @@ -83,7 +83,7 @@ def generate_launch_description(): declare_params_file_cmd = DeclareLaunchArgument( 'params_file', - default_value=os.path.join(bringup_dir, 'config', 'nav2_params.yaml'), + default_value=os.path.join(bringup_dir, 'config', 'nav2.yaml'), description='Full path to the ROS2 parameters file to use for all launched nodes') declare_autostart_cmd = DeclareLaunchArgument( diff --git a/launch/robot_scan_filter.launch.py b/launch/robot_scan_filter.launch.py index 41dd487..bc8c5fb 100644 --- a/launch/robot_scan_filter.launch.py +++ b/launch/robot_scan_filter.launch.py @@ -3,8 +3,24 @@ from launch.substitutions import PathJoinSubstitution from launch_ros.actions import Node from ament_index_python.packages import get_package_share_directory +from launch.substitutions import LaunchConfiguration, PythonExpression +from launch.actions import DeclareLaunchArgument, GroupAction, SetEnvironmentVariable def generate_launch_description(): + + namespace = LaunchConfiguration('namespace') + use_sim_time = LaunchConfiguration('use_sim_time') + + declare_namespace_cmd = DeclareLaunchArgument( + 'namespace', + default_value='', + description='Top-level namespace') + + declare_use_sim_time_cmd = DeclareLaunchArgument( + 'use_sim_time', + default_value='false', + description='Use simulation (Gazebo) clock if true') + return LaunchDescription([ Node( package="laser_filters", @@ -14,5 +30,6 @@ def generate_launch_description(): get_package_share_directory("cps_loki_bringup"), "config", "box_filter.yaml", ])], + namespace=namespace ) ]) \ No newline at end of file diff --git a/launch/robot_twist_mux.launch.py b/launch/robot_twist_mux.launch.py deleted file mode 100644 index 013e231..0000000 --- a/launch/robot_twist_mux.launch.py +++ /dev/null @@ -1,120 +0,0 @@ -# Copyright 2022 Factor Robotics -# -# 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 launch import LaunchDescription -from launch.substitutions import Command, FindExecutable, PathJoinSubstitution -from launch_ros.actions import Node -from launch_ros.substitutions import FindPackageShare -from ament_index_python.packages import get_package_share_directory -from launch_ros.actions import LifecycleNode -from launch_ros.descriptions import ParameterValue - - -def generate_launch_description(): - robot_description_content = Command( - [ - PathJoinSubstitution([FindExecutable(name="xacro")]), - " ", - PathJoinSubstitution( - [ - FindPackageShare("cps_loki_description"), - "urdf", - "odrive_diffbot.urdf.xacro" - ] - ), - ] - ) - robot_description = {"robot_description": ParameterValue(robot_description_content, value_type=str)} - - robot_controllers = PathJoinSubstitution( - [ - FindPackageShare("cps_loki_bringup"), - "config", - "diffbot_controllers.yaml", - ] - ) - - control_node = Node( - package="controller_manager", - executable="ros2_control_node", - parameters=[robot_description, robot_controllers], - output="both", - ) - - robot_state_pub_node = Node( - package="robot_state_publisher", - executable="robot_state_publisher", - output="both", - parameters=[robot_description], - ) - - joint_state_broadcaster_spawner = Node( - package="controller_manager", - executable="spawner", - arguments=["joint_state_broadcaster", "-c", "/controller_manager"], - ) - - robot_controller_spawner = Node( - package="controller_manager", - executable="spawner", - arguments=["diffbot_base_controller", "-c", "/controller_manager"], - ) - - joystick_spawner = Node( - package="joy", - executable="joy_node" - ) - - teleop_spawner = Node( - package="rmp220_teleop", - executable="rmp220_teleop", - remappings=[('/diffbot_base_controller/cmd_vel_unstamped','/cmd_vel_joy')] - ) - - cam_node = Node( - package="ros2_cam_openCV", - executable="cam_node" - ) - - lidar_dir = os.path.join(get_package_share_directory('lslidar_driver'), 'params', 'lsx10.yaml') - lidar_node = LifecycleNode( - package='lslidar_driver', - executable='lslidar_driver_node', - name='lslidar_driver_node', - output='screen', - emulate_tty=True, - namespace='', - parameters=[lidar_dir], - ) - - twist_mux_params = os.path.join(get_package_share_directory('cps_loki_bringup'),'config','twist_mux.yaml') - twist_mux = Node( - package="twist_mux", - executable="twist_mux", - parameters=[twist_mux_params, {'use_sim_time': False}], - remappings=[('/cmd_vel_out','/diffbot_base_controller/cmd_vel_unstamped')] - ) - - return LaunchDescription([ - #control_node, - #robot_state_pub_node, - #joint_state_broadcaster_spawner, - #robot_controller_spawner, - #joystick_spawner, - #teleop_spawner, - #cam_node, - #lidar_node, - twist_mux - ]) \ No newline at end of file