NVIDIA-ISAAC-ROS / isaac_ros_map_localization

NVIDIA-accelerated global localization
https://developer.nvidia.com/isaac-ros-gems
Apache License 2.0
57 stars 6 forks source link

Unable to localize the robot in Gazebo ROS2 using Isaac ROS Map Localization #9

Closed hmpcjayaweera closed 1 year ago

hmpcjayaweera commented 1 year ago

Hi, Robot - MPO-700 Simulation environment - Gazebo + ROS2 Humble

I have follow the below steps to use the Isaac ROS Map localization for the robot in Gazebo and ROS2, however, the robot model is not shown in the rviz and the "ros2 topic echo /localization_result" not give any value. It only shows that three-axis is localized (3-axis in the correct position of the rviz)

  1. I have put the .png and .yaml files in the "workspaces/isaac_ros-dev/src/isaac_ros_map_localization/isaac_ros_occupancy_grid_localizer/maps" and rename them as map.png and map.yaml (also change the image e inside the .yaml to map.png). then build and source the workspace.
  2. launch the MPO-700 in gazebo and ROS2 humble
  3. Then I run the steps 7, 8, 9,12, and 13 in https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_map_localization/blob/main/README.md#quickstart
  4. when I run the steps 7, 8 and 9, the map is loaded, but the robot is not showing is Rviz,
  5. when I run the step 12, quickly a 3-axis appear on Rviz in the correct place compared to the Gazebo environment robot place. However, the "ros2 topic echo /localization_result" not give any value.

Please help me to solve this problem. Thanks.

ashwinvkNV commented 1 year ago

can you paste the launch file you are using?

And also paste the screenshot of the output for ros2 topic list when the entire pipeline is running?

If you are seeing the frame, it seems like localization is working, but the topic you are looking at might be wrong. For example we remap the /localization_result topic to /initialpose in the Nav2 Isaac Sim launch file.

hmpcjayaweera commented 1 year ago

Rviz2 as in step 7 of https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_map_localization/blob/main/README.md#quickstart. Panels:

import os

from ament_index_python.packages import get_package_share_directory

from launch import LaunchDescription from launch.actions import GroupAction from launch_ros.actions import ComposableNodeContainer from launch_ros.actions import Node from launch_ros.descriptions import ComposableNode

def generate_launch_description():

lifecycle_nodes = ['map_server']
map_yaml_path_dir = os.path.join(
    get_package_share_directory('isaac_ros_occupancy_grid_localizer'), 'maps', 'map.yaml')

occupancy_grid_localizer_node = ComposableNode(
    package='isaac_ros_occupancy_grid_localizer',
    plugin='nvidia::isaac_ros::occupancy_grid_localizer::OccupancyGridLocalizerNode',
    name='occupancy_grid_localizer',
    parameters=[map_yaml_path_dir, {
        'loc_result_frame': 'map',
        'map_yaml_path': map_yaml_path_dir,
    }])

occupancy_grid_localizer_container = ComposableNodeContainer(
    package='rclcpp_components',
    name='occupancy_grid_localizer_container',
    namespace='',
    executable='component_container_mt',
    composable_node_descriptions=[
        occupancy_grid_localizer_node,
    ],
    output='screen'
)

# Seting transform between lidar_frame and base_link
# since Isaac Sim does not set this transform
baselink_lidar_publisher = Node(
    package='tf2_ros', executable='static_transform_publisher',
    output='screen',
    arguments=['0.0', '0.0', '0.0', '0.0', '0.0', '0.0', 'base_link',
               'lidar_frame'])

load_nodes = GroupAction(
    actions=[
        Node(
            package='nav2_map_server',
            executable='map_server',
            name='map_server',
            output='screen',
            respawn_delay=2.0,
            parameters=[{'yaml_filename': map_yaml_path_dir}]),
        Node(
            package='nav2_lifecycle_manager',
            executable='lifecycle_manager',
            name='lifecycle_manager_localization',
            output='screen',
            parameters=[{'use_sim_time': False},
                        {'autostart': True},
                        {'node_names': lifecycle_nodes}])
    ]
)

# Create the launch description and populate
ld = LaunchDescription([occupancy_grid_localizer_container,
                        baselink_lidar_publisher])

# Add the actions to launch all of the localiztion nodes
ld.add_action(load_nodes)

return ld

besides I have used ros2 service call trigger_grid_search_localization std_srvs/srv/Empty {} and ros2 launch isaac_ros_pointcloud_utils isaac_ros_laserscan_to_flatscan.launch.py

In addtion the launch file for neo MPO-700 (for gazebo ros2 humble)

ashwinvkNV commented 1 year ago

Can you send the screenshot for the output for ros2 topic list also.

Also can you confirm that you are running ros2 topic echo /localization_result before running ros2 service call trigger_grid_search_localization std_srvs/srv/Empty {}?

hmpcjayaweera commented 1 year ago

Hi, when i try to run the rviz2 (in step 7 - https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_map_localization/blob/main/README.md#quickstart) and then run the step 9, I got this error, [ERROR] [1686091364.713581586] [rviz2]: Vertex Program:rviz/glsl120/indexed_8bit_image.vert Fragment Program:rviz/glsl120/indexed_8bit_image.frag GLSL link result : active samplers with a different type refer to the same texture image unit

Previously it was working, but suddenly I got this, please can you help me.

ashwinvkNV commented 1 year ago

I do not believe the "[ERROR] [1686091364.713581586] [rviz2]: Vertex Program:rviz/glsl120/indexed_8bit_image.vert Fragment Program:rviz/glsl120/indexed_8bit_image.frag GLSL link result :" is related to the isaac_ros_map_localization package. To discuss that please open an issue with rviz

hmpcjayaweera commented 1 year ago

Please can I know how to make the map (.yaml and .png) files. Can I make it using SLAM Toolbox (slam tool box gives .yaml and pgm, can i use any converter to convert this .pgm to png and use for Isaac ROS map localization package ).

ashwinvkNV commented 1 year ago

yes you can use the map generated using SLAM Toolbox. As you said, convert the .pgm to .png and use it with isaac_ros_map_localization.

Are you able to echo the /localization_result topic?

hmpcjayaweera commented 1 year ago

still not, will let you soon

hmpcjayaweera commented 1 year ago

![Screenshot from 2023-06-08 12-50-11](https://github.com/NVIDIA-ISAAC-ROS/isaac_ros_map_localization/assets/48442332/c10573e9-a795-43b1-8864-9da13fd2c ![Screenshot from 2023-06-08 12-49-23](https://github.com/N Screenshot from 2023-06-08 12-52-22 VIDIA-ISAAC-ROS/isaac_ros_map_localization/assets/48442332/beb42a86-ceda-4f3e-8516-666c3d53e446) c17) the ros2 topic echo /localization_result is not publishing any value

hmpcjayaweera commented 1 year ago

For the ros2 topic echo /flatscan, I got "The message type 'isaac_ros_pointcloud_interfaces/msg/FlatScan' is invalid", Is this possible. Thank you

hmpcjayaweera commented 1 year ago

Screenshot from 2023-06-08 13-12-40 Once I Trigger the localization using a command line service call :ros2 service call trigger_grid_search_localization std_srvs/srv/Empty {}, the three axis appear as attached photo (seems robot in the same position of the map in Gazebo). However, when I check the base_link, it is in the (0,0) of the map.