danzimmerman / Universal_Robots_ROS2_Gazebo_Simulation

BSD 3-Clause "New" or "Revised" License
2 stars 1 forks source link

RViz and Gazebo seem to be not working (agian) - related to #2 #3

Closed Icon45 closed 1 year ago

Icon45 commented 1 year ago

Hi @danzimmerman,

unfortunately I'm back with a new (maybe old) issue. I thought I fixed my problem that I had in #2 but it seems that thought was wrong. It worked fine until i created my own gripper in an separate package, which also runs via robot_state_publisher.
I tried to get this gripper working with ros2_control and also in Gazebo. (I've your interested in the code of the gripper: https://github.com/Icon45/Gripper) Until that point the simulation of the Universal Robot using this/your repo was completely fine with no issues what so ever. But as soon as I've lunched my gripper everything broke the same way as in #2. (Note: Gripper and UR Simulations were not running simultaneously). I can confirm that all dependencies are installed with rosdep.

Don't know if this has to do anything with this repo, but because this is my first Ros2 project I don't really know where to ask. The Docs online weren't very helpful with this sort of problem.

danzimmerman commented 1 year ago

Note: Gripper and UR Simulations were not running simultaneously)

Don't know if this has to do anything with this repo

If you're not launching the UR in Gazebo too then it doesn't have anything to do with this repo.

You might get more help faster if you post with lots of details on ROS Answers.

With a quick look at your package, I didn't see you spawning joint_state_broadcaster or any gripper controller into /controller_manager.

If you're using the gripper alone at first, which you definitely should, you need to treat it like its own simulated robot. Look at all the controller spawner nodes in the UR launch file and launch those too.

Once you combine the gripper and the robot in one URDF you won't need to launch the ros 2 control controllers twice, but for an isolated gripper launch you need them.

An actual gripper controller will be optional at first but you will need it to move the gripper jaw.

Joint state broadcaster is not optional: without it, robot state publisher has no data source.

Icon45 commented 1 year ago

Hi @danzimmerman,

First of all thank you for the tip absolut Ros Answers didn't knew the forum there ist still active.

I was already planing on simulating the gripper as a standpauken robot first. Thank you for the tips about getting the gripper to work as well. Very appreciated.

As for the tips about the gripper: joint_state_broadcaster was spawned in /controller_manager in the confit.yaml file or do i have to put it in the launch file as well?

In general i'm not really sure if it is really not related to this repo. For a better understanding here is what i did:

  1. Ran the UR Simulation in Gazebo after installing the dependencies with rosdep (see end of #2)

  2. Then ran the test_trajectory program and everything worked fine and shut down the Simulation of the zur as well as the test_trajectory stuff.

  3. Then i created a new python package for the Gripper (see repo i mentioned at the beginning of this Issue)

  4. I simulated the gripper a lot get it to todays (not working) status. I shut down the Gazebo Simulation of the Gripper afterwards.

  5. Out of curiosity I reran the UR Simulation and everything went south. Gazebo opened with the UR laying on the ground and in RViz i got to see my gripper (which wasn't launched)

  6. I quickly shut down the UR Gazebo Simulation in the terminal and reran it (i hoped it was just a weird bug) and then i was back at the status described in the beginning of #2. I checked rosdep but it was all up to date.

danzimmerman commented 1 year ago

joint_state_broadcaster was spawned in /controller_manager in the confit.yaml file or do i have to put it in the launch file as well?

You need to use spawners in the launch file, for example here. Make sure to add the joint controllers, etc. in a similar way (You can find further examples in the UR launch file).

Look through the launch file and find all the other spawners. I'm not exactly sure what you can do WITHOUT spawners. The controllers YAML gets passed through the URDF here to gazebo_ros2_control here and that should be what starts /controller_manager itself (I am not 100% sure without checking more!)

However, as far as I know /controller_manager doesn't actually load or start any controllers automatically. You may be able to start them from the command line or from a service call since you passed it a YAML file and it "knows" about those controllers.

That said, the spawners in the launch file are what load and start the controllers at launch, so you need them for all the controllers you want to have running when you start things up.

As far as your issue with UR Gazebo after running your gripper package, I don't see why that would happen. Possibly you didn't shut down all the running processes before you tried to launch the UR simulation and controller manager was still hanging around?

Icon45 commented 1 year ago

Well i tried it again today and everything worked as it should. Thanks for the tips!!!