Mapping with real robot having issues

System Setup:

Robot: TortoiseBot

ROS Version: Humble

Robot Server: Raspberry Pi (ROS Humble)

Remote Machine: Ubuntu

Issue Description:

I am trying to perform mapping with my real TortoiseBot, but I am facing an issue where Gazebo keeps opening instead of showing the real robot’s data.

Steps Taken:

Ran the bringup:

ros2 launch tortoisebot_bringup bringup.launch.py use_sim_time:=false

Tried the auto bringup:

ros2 launch tortoisebot_bringup auto_bringup.launch.py use_sim_time:=false

On my Ubuntu machine, I ran:

ros2 launch tortoisebot_description display.launch.py

However, instead of showing the real robot, Gazebo still launches.

Gazebo Launches

Expected Behavior:

The real robot should provide mapping data instead of launching Gazebo.

Actual Behavior:

Gazebo opens when running display.launch.py.

Hi @visheshuni,

That is because the launch files you are running also run Gazebo. Setting use_sime_time only tells the system to use the simulation clock versus the machine clock.

It’s important to look at the files you are trying to launch in order to know what you are doing:

As Rodrigo said, you need to check the content of the bringup.launch.py file and remove from it the line 90 that includes the launching of Gazebo (gazebo_launch_cmd,).

That launch file of Tortoisebot is not good because it launches too many things that are not related to each other (like Gazebo, rviz…). Launch files should be more modularized. Anyway, just removing that line will prevent Gazebo from starting

Thank you for your reply.

  1. The gazebo line have been removed by default and gazebo has no way of launching on the rpi ubuntu server.
  2. And i run display.launch.py on my pc which has the gazebo lines commented. So technically speaking gazebo should no open.
    Modified display.launch.py below:-
import launch
from launch.substitutions import Command, LaunchConfiguration
import launch_ros
from launch_ros.substitutions import FindPackageShare
from launch_ros.actions import Node
from launch.actions import DeclareLaunchArgument
from launch.conditions import IfCondition
import os
from launch_ros.descriptions import ParameterValue
from launch.launch_description_sources import PythonLaunchDescriptionSource
import os
import launch
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch.substitutions import LaunchConfiguration, PythonExpression,Command
from launch.actions import DeclareLaunchArgument, SetEnvironmentVariable,IncludeLaunchDescription

from launch.launch_description_sources import PythonLaunchDescriptionSource

def generate_launch_description():
    
    #gazebo_launch_dir = os.path.join(get_package_share_directory('tortoisebot_gazebo'), 'launch')
    state_publisher_dir = os.path.join(get_package_share_directory('tortoisebot_description'), 'launch')
    default_rviz_config_path = os.path.join(get_package_share_directory('tortoisebot_description'), 'rviz/tortoisebot_sensor_display.rviz')
    
    
    use_sim_time = LaunchConfiguration('use_sim_time')

    rviz_node = launch_ros.actions.Node(
        package='rviz2',
        executable='rviz2',
        name='rviz2',
        output='screen',
        arguments=['-d', LaunchConfiguration('rvizconfig')],
        parameters= [{'use_sim_time': use_sim_time}],

    )
    '''gazebo_launch_cmd=IncludeLaunchDescription(
        PythonLaunchDescriptionSource(
            os.path.join(gazebo_launch_dir, 'gazebo.launch.py')),
            launch_arguments={'use_sim_time':use_sim_time}.items())'''
    
    state_publisher_nodes = IncludeLaunchDescription(
        PythonLaunchDescriptionSource(
            os.path.join(state_publisher_dir, 'state_publisher.launch.py')),
        launch_arguments={'use_sim_time': use_sim_time}.items(),
        
    )    

    return launch.LaunchDescription([
        launch.actions.DeclareLaunchArgument(name='use_sim_time', default_value='True',
                                    description='Flag to enable use_sim_time'),
        launch.actions.DeclareLaunchArgument(name='rvizconfig', default_value=default_rviz_config_path,
                                            description='Absolute path to rviz config file'),

        state_publisher_nodes,
        #gazebo_launch_cmd,
        rviz_node,
    ])
  1. I noticed that the Tortoisebot repository for ROS2 has a few errors in some of the files that i had to change myself.
1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.