neobotix / neo_simulation2

ROS 2 simulation packages for the Neobotix robots
MIT License
20 stars 11 forks source link

Multi-robot simulation with MP400 #65

Open VineetTambe opened 1 year ago

VineetTambe commented 1 year ago

Hey, I am trying to run the multirobot simulation with mp400 but the rviz plugin is glitching out. I understand the code base is supposed to work on mpo_700. What changes should I make to make it work with mp_400??

  1. Where all has the param = 'MY_ROBOT=mpo_700' been harcoded?
  2. Do I need to modify the source code of the rviz for multirobot??

    This command does not work for me. My mp400 do not show up in the drop down.

My environment variables are as follows:

  1. MY_NO_ROBOTS=3
  2. MY_ROBOT=mp_400
  3. MAP_NAME=neo_workshop

I am running ubuntu 22.04 and ROS2 humble. I have checked out to the multi-robot branch of neo_simulation2 and humble branch of neo_nav2_bringup

Thank you in advance! Let me know if you need any further clarification.

padhupradheep commented 1 year ago

Hello Vineet, the multi robot simulation branch is outdated. I would suggest you to look at the branch multi-robot-sim-with-xacro . I'll update the branch to make it work for you with MP-400 and give you the update.


At the moment, we are in the process of migrating our whole simulation to the modern Gazebo. We were planning to release the new simulation package in few months. For now you will be able to use the above solution. But after transition, we are not planning to support the older version of Gazebo. Sorry that you got caught in the midst of this transition.

VineetTambe commented 1 year ago

Thank you!

padhupradheep commented 1 year ago

I guess, it's all up and ready, please checkout to the multi-robot-sim-with-xacro branch.

Also pull the changes from the neo_fleet_rviz2 plugin

Your env variables looks fine already.

Just follow the three steps (sim launch, nav launch, rviz launch):

  1. ros2 launch neo_simulation2 multi_robot_simulation.launch.py
  2. ros2 launch neo_simulation2 multi_robot_navigation.launch.py
  3. ros2 launch neo_nav2_bringup rviz_launch.py rviz_config:=install/neo_nav2_bringup/share/neo_nav2_bringup/rviz/multi_robot.rviz

Gzclient might hang sometimes, or there maybe an issue with loading the plugins (seg faults). In that case, you need to restart the simulation. Try to check if the process are properly killed using the system monitor (just kill everything related to ros2 and Gz over there). We still haven't localized this issue in the Gazebo package. We'll get in touch with the maintainers and get it fixed ASAP. Sorry for the inconvenience if any caused.

VineetTambe commented 1 year ago

Thankyou @padhupradheep!

There are still issues with more than 2 robots. For example when I spawn 3 robots - the configs/mp_400/navigation_2.yaml was absent. I added the navigagtion_2.yaml (by copying navigation_1.yaml and replacing robot_1 with robot_2) and got it to spawn but still wasn't able to control the bot in rviz. I will start working on that aspect and update here.

padhupradheep commented 1 year ago

Auto generation is already in the cards.. We didn't get the time to add it though. Check: #37 I'll be really happy to collaborate with you and make it possible.

For the point 2, I believe that's the point of using the neo_fleet_rviz2 plugin, combined along with the changes that we have already made for the RViz configs in the neo_nav2_bringup package. Is there anything special that you have in mind? I'm open to a phone call and probably get your thoughts on how to make it better..

VineetTambe commented 1 year ago
  1. That'll be great! I'll look into the ticket.
  2. It would be great to have all the robots rendered in a single rviz view than spawning multiple rviz. The multiple rviz approach soon becomes unmanageable as the number of robots increases (as low as 5). Sure, let's have a call if possible!
padhupradheep commented 1 year ago

It would be great to have all the robots rendered in a single rviz view than spawning multiple rviz. The multiple rviz approach soon becomes unmanageable as the number of robots increases (as low as 5). Sure, let's have a call if possible!

No, the idea with rviz_config:=install/neo_nav2_bringup/share/neo_nav2_bringup/rviz/multi_robot.rviz is to use single RViz for multiple robots. The multiple RViz approach is the default approach done by the maintainers of the Nav2 stack. We also wanted to have a single RViz for multiple robots.

image

Here is an example of the same with MPO-700. You'll not be able to just see the robot model but you can determine the position of the robots using the TF's.

Here is a related link: https://neobotix-docs.de/ros/additional_features/multi_robot_setup.html

VineetTambe commented 1 year ago

Oh, it looks like this is not happening on my setup. I'll try to debug it and see what's wrong. The image that you have attached is what I was trying to do. I'll get back to you in some time after a little debugging! Thanks!

padhupradheep commented 1 year ago

Check if the Gazebo plugins are loaded and there maybe cases where gzclient does not probably startup..

VineetTambe commented 1 year ago

Hey,

I am trying to run simulations with more than 5 number of robot and one of the major problems I am currently facing is when I launch the simulation not all the robots manage to spawn / render and even if they do some assets like lidar are not loaded properly.

I generally have to relaunch the entire simulation multiple times for it to spawn properly. How do I fix the gazebo spawn issues?

padhupradheep commented 1 year ago

Hey Vineet,

At the moment, I don't have an immediate answer for you to be honest. My assumption is that, the gazebo plugins for the lidar and differential drives requires a lot of computation along with the computations needed for the physics. I guess internally when you try to spawn the robot models, there seems to be some sort of race condition, which does not allow the models to be loaded properly resulting in a lifeless simulation. It also depends upon the computational power that your PC / Graphics card offers.

I'd add it to my ToDo's for further research.

VineetTambe commented 1 year ago

Hey Pradheep, I figured out a way to launch simulation and get upto 11 robots to spawn in gazebo. Working on figuring out/optimising the Nav2 stack to work with them. Will probably raise a PR for a multi-robot branch over the weekend.

padhupradheep commented 1 year ago

Niceee... Sure.. feel free..

padhupradheep commented 1 year ago

here is a small something that could be relevant

https://github.com/ros-planning/navigation2/issues/3298#issuecomment-1590933975

VineetTambe commented 1 year ago

So this is how I went about solving that issue: https://github.com/DockDockGo/neo_simulation2/blob/0bf9fd7865e2492c45ecc0f3ea9d633b9273617f/launch/multi_robot_simulation.launch.py#L134

All the updates that I have done are right now in this repo: https://github.com/DockDockGo/neo_simulation2

Do you have any suggestions on how to reduce the overhead that is caused by launching Nav2? Are there any nodes in particular that could be disabled?

padhupradheep commented 1 year ago

Currently, the overhead should be from the localization, right?

VineetTambe commented 1 year ago

Yes, that would be my guess.

For simulation purpose -> should neo_localization be replaced with a dummy localization node which publishes it's pose by accessing gazebo sim environment variables? I think doing this would allow for scaling to multiple robots in simulation. Because all of this has to run on a single machine.

padhupradheep commented 1 year ago

The best way I can think of now is to make the neo_localization a lifecycle node, and set it to idle, whenever the robot is idle too. That actually requires a complete refactor of the localization node, which I've been planning to do for past few years. I hope to do it sometime soon.

Until then, AMCL could be an option, because I believe it already is implemented as lifecycle. Could you give that a try and tell if that helps? else, I'd think about a work around.

VineetTambe commented 1 year ago

Sure! I plan to wrap up my work with the optimal multirobot planner first and then get to the localization and scalling simulation part. With 5 robots I think I can get the multi-robot planner off the ground.

simayadas23 commented 1 month ago

I guess, it's all up and ready, please checkout to the multi-robot-sim-with-xacro branch.

Also pull the changes from the neo_fleet_rviz2 plugin

Your env variables looks fine already.

Just follow the three steps (sim launch, nav launch, rviz launch):

1. ros2 launch neo_simulation2 multi_robot_simulation.launch.py

2. ros2 launch neo_simulation2 multi_robot_navigation.launch.py

3. ros2 launch neo_nav2_bringup rviz_launch.py rviz_config:=install/neo_nav2_bringup/share/neo_nav2_bringup/rviz/multi_robot.rviz

Gzclient might hang sometimes, or there maybe an issue with loading the plugins (seg faults). In that case, you need to restart the simulation. Try to check if the process are properly killed using the system monitor (just kill everything related to ros2 and Gz over there). We still haven't localized this issue in the Gazebo package. We'll get in touch with the maintainers and get it fixed ASAP. Sorry for the inconvenience if any caused.

I tried these steps, but I am getting this error in the navigation launch file Timed out waiting for transform from robot1/base_link to robot1/odom to become available, tf error: Invalid frame ID "robot1/odom" passed to canTransform argument target_frame - frame does not exist

simayadas23 commented 1 month ago

Also I am unable to get the costmaps in rviz Screenshot from 2024-05-24 20-16-21

padhupradheep commented 1 month ago

Hey @simayadas23

Can you check if you are able to move the robot using the teleoperation? Could be because of the following conditions, you might not be able to move the robot.

Hey Vineet,

At the moment, I don't have an immediate answer for you to be honest. My assumption is that, the gazebo plugins for the lidar and differential drives requires a lot of computation along with the computations needed for the physics. I guess internally when you try to spawn the robot models, there seems to be some sort of race condition, which does not allow the models to be loaded properly resulting in a lifeless simulation. It also depends upon the computational power that your PC / Graphics card offers.

I'd add it to my ToDo's for further research.