AIRLab-POLIMI / scout_nav2

AgileX Scout robot for navigation with Nav2, in the context of mobile manipulation - ROS2
5 stars 1 forks source link

No map received #1

Open imdsafi09 opened 2 months ago

imdsafi09 commented 2 months ago

Hi, Thank you for open-sourcing your great work. I am running the navigation command in a simulated environment. The simulated environment is running correctly and publishing all the sensor data. However, after launching navigation commands, it shows that map information is missing even if the SLAM is true. Below is the configuration I tried to run:

ros2 launch agilex_scout simulate_control_gazebo.launch.py lidar_type:=3d ros2 launch scout_nav2 nav2.launch.py simulation:=True slam:=True localization:=slam_toolbox Screenshot from 2024-08-05 15-59-30

SimonGiampy commented 2 months ago

Hi thank you for your feedback. Sorry for the late response but I was in vacation. I'm sorry but it is hard for me to help you if you don't provide any additional information other than the commands you input on the console.

What about what you see on the terminal when you input the commands? Does the Gazebo simulation work properly? Can you pilot the robot in the simulation using the teleop command utility?

Last time I had this "no map received error" it was because of Ignition Gazebo was not providing the localization correctly, so the link map -> odom was not correctly available, leading to an incomplete TF tree. Maybe this is the case?

Make sure also that in the simulation you are using the correct set of Nav2 parameters, and the "DUBIN" motion set for the local planner (controller).

imdsafi09 commented 1 month ago

Hi @SimonGiampy, Thank you for your reply. The Gazebo works fine, and I can teleop it without any problem. The problem is in the frame transformations (as shown in the screenshot). I tried manually passing the static transformation as a remedy, but it does not consider those transformations (I did not change anything in the config files). If you have any suggestions, that would be highly appreciated. Secondly, my objective is to implement it on Scout Mini. Are there any other changes I need to make in the configurations, or would just topic names for the sensor, etc., be enough?
Screenshot from 2024-09-04 17-20-48 Screenshot from 2024-09-04 17-53-26

SimonGiampy commented 1 month ago

I'm sorry but the information and the screenshots you provided are not sufficient for me to find the cause of the problem. Are you using the last version of the repository? What is the output that you see on the terminal when you run the commands? Did you try to use AMCL as localization argument instead of slam_toolbox? Did you try to change some parameters in the localization or mapping plugins of Nav2 to make it work?

I haven't worked in this repository in a while, so I don't remember exactly which parameters may have disrupted the localization, and what to change. So my suggestion is to try different parameters and configurations to try to make it work. As mentioned in my last message, did you try to set DUBIN as motion set generator for the local planner?

Secondly, my objective is to implement it on Scout Mini. Are there any other changes I need to make in the configurations, or would just topic names for the sensor, etc., be enough?

Well, there are actually many changes required to make it work with the Scout Mini. First of all, a different URDF would be required and configured inside the description package. Secondly some parameters in the Nav2 configuration need to be changed to take into account the different footprint of the robot. Furthermore, the position of the lidar sensor for navigation must be changed according to your own robot setup. There are many changes, but if you understand how everything works with Nav2, you can manage to modify it on your own.

nasazad commented 1 month ago

Hi @imdsafi09, I encountered the same problem as you, and I realized that the nav2_bringup script needs to be launched in a separate shell. I followed these steps(I will explain next), and it worked for me. However, there is still an issue that @SimonGiampy mentioned, which I haven’t figured out how to solve yet.

The problem lies in the transformation between map and odom, which I mistakenly assumed to be static. After reviewing the Nav2 stack documentation, I found the following statement:

"The first transform map => odom is usually provided by a separate ROS package that handles localization and mapping, such as AMCL. This transform updates dynamically, so we shouldn’t set static values for it in our robot’s TF tree. Setting this up can be quite complex, so we highly recommend reviewing the documentation of the mapping or localization package you're using for your platform. All ROS-compliant SLAM and localization packages will automatically provide this transformation on launch."

In our case, however, this transformation is not being applied automatically.

@SimonGiampy, I would appreciate it if you could help me resolve this issue and share how you solved it.

@imdsafi09, I'll provide you with my commands, but please be aware that the transformation between map and odom is still incorrect. However, the navigation will work accordingly!

  1. ros2 launch agilex_scout simulate_control_gazebo.launch.py lidar_type:=3d rviz:=true
  2. ros2 launch scout_nav2 nav2.launch.py simulation:=true
  3. ros2 run tf2_ros static_transform_publisher 0 0 0 0 0 0 map odom
  4. ros2 launch nav2_bringup bringup_launch.py use_sim_time:=True map:=/home/nasazad/agilex_ws/src/scout_nav2/scout_nav2/maps/warehouse/map_slam_v2.yaml

However, it would be better if the fourth command were applied automatically. I am still trying to figure that out, but if you find a solution, please share it with me.

imdsafi09 commented 1 month ago

Hi @nasazad, In my case, I didn't put effort into looking into the simulation side since I was implemented on hardware. That time, I was in a hurry, so I tried to look into this workspace but found out that a lot needed to be configured or added to the code. Since the transformation and another setup I had done before, I just installed SLAMToolbx and Navigation2 and changed the configuration, which worked for me.