Control ros1 turtlebot in flatland with ros2 rviz2

asked 2023-05-16 04:44:13 -0600

Nartmangnourt gravatar image

updated 2023-05-16 04:46:41 -0600

Hey ROS Community,

i have the following problem:

I got the flatland repository: https://github.com/avidbots/flatland I also get the turtlebot flatland: https://github.com/avidbots/turtlebot...

I want to test out the nav2 stack in flatland turtlebot. So i started the rosbridge: ros2 run ros1_bridge dynamic_bridge

I also start the turtlebot in flatland in ros1 noetic: roslaunch turtlebot_flatland turtlebot_in_flatland.launch

I started the nav2 stack with this file:

#!/usr/bin/env python3
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.actions import DeclareLaunchArgument
from launch.actions import IncludeLaunchDescription
from launch.launch_description_sources import PythonLaunchDescriptionSource
from launch_ros.actions import Node
from launch.substitutions import LaunchConfiguration

TURTLEBOT3_MODEL = os.environ['TURTLEBOT3_MODEL']

def generate_launch_description():

     use_sim_time = LaunchConfiguration('use_sim_time', default='false')

     nav2_launch_file_dir = os.path.join(get_package_share_directory('nav2_bringup'), 'launch')

     rviz_config_dir = os.path.join(get_package_share_directory('nav2_bringup'),'rviz','nav2_default_view.rviz')

     map_dir = LaunchConfiguration('map', default=os.path.expanduser('~/catkin_ws/src/turtlebot_flatland/maps/hospital_section.yaml'))
     # map_dir = LaunchConfiguration('map', default=os.path.join(get_package_share_directory('arena-simulation-setup'), 'maps', 'map_empty', 'map.yaml'))

     return LaunchDescription([

        # Declare Parameters to use at runtime
        DeclareLaunchArgument(
            'map',
            default_value= map_dir,
            description='Full path to map file to load'),

        # Start Launch Files
        IncludeLaunchDescription(
            PythonLaunchDescriptionSource([nav2_launch_file_dir, '/bringup_launch.py']),
            launch_arguments={
                'map': map_dir,
                'use_sim_time': use_sim_time}.items(),
        ),    

        # Start Nodes
         Node(
            package='rviz2',
            node_executable='rviz2',
            node_name='rviz2',
            arguments=['-d', rviz_config_dir],
            parameters=[{'use_sim_time': use_sim_time}],
            output='screen'),

     ])

If i use the 2D Nav Goal button in nav1 stack rviz1 both robot move in rviz1 and rviz2.

If i use the navigation 2 goal button in rviz2 the robot not moving in rviz1 and rviz2.

I got the following message in the terminal where i started the nav2 stack with rviz2: [amcl-2] Warning: invalid frame ID "base_footprint" passed to canTransform argument target_frame - frame des not exist

How can i use the navigation 2 goal button in rviz2 nav2 stack to control the robot in rviz1 nav1 stack? Is it possible in this way?

Thank you so much !image description

edit retag flag offensive close merge delete