0
$\begingroup$

Rosanswers logo

Hi all hope you al are fine.

I am using Ubuntu 16.04 LTS and ROS Kinetic version. I am working on UR5 robot simulation in Gazebo for which I made a custom catkin space and my own pkg named "ur5_custom" in this pkg I made launch file "custom_initialize.launch file" in which I am using the following:

node name="bin" pkg="gazebo_ros" type="spawn_model" args="-file $(find ur5_notebook)/urdf/bin.urdf -urdf -model bin -y 0.8 -x -0.5 -z 0.05"

node name="bin1" pkg="gazebo_ros" type="spawn_model" args="-file $(find ur5_notebook)/urdf/bin1.urdf -urdf -model bin -y 1 -x -1.5 z 0.05"

This is to spawn 2 bin in gazebo but it is not working. I received the following error: [ERROR] [1640883635.252745507, 0.321000000]: SpawnModel: Failure - model name bin already exists.

I have tried same name different names, same urdf files and different(duplicate) URDF files also but no success at all. please tell me how to spawn 2 same objects at different positons in gazebo using a single URDF file.

Thanks


Originally posted by umar_anjum on ROS Answers with karma: 11 on 2021-12-30

Post score: 0

$\endgroup$

2 Answers 2

0
$\begingroup$

Rosanswers logo

In your second piece of code you don't have a minus next to z. There are no error pasted too. Can you add it?

By this only the name of the models should differ. You can use the same URDF many times. Does the part with $(find ur5_notebook) work correctly too? Can you try your launch file with the URDF file in the same folder?


Originally posted by ljaniec with karma: 3064 on 2021-12-31

This answer was NOT ACCEPTED on the original site

Post score: 1


Original comments

Comment by umar_anjum on 2022-01-01:
I must have missed the - with z in the 2nd line of code but I have tried code with -z 0.05 too.

there are actually no errors just an error saying can't create a node of type spawn_model.

This code is creating 1 bin so I assume $(find ur5_notebook) is working as it is creating a bin.

I will try launching urdf within same folder havent yet tried that.

$\endgroup$
0
$\begingroup$

Rosanswers logo

This issue was resolved by adding a URDF directory in my workspace package and putting in box.urdf in it, where as it was in an other workspce in another package from which I was accessing it. probably that was the problem. This is the piece of code I used instead of the above:

node name="bin" pkg="gazebo_ros" type="spawn_model" args="-file $(find ur5_notebook)/urdf/bin.urdf -urdf -model bin -y 0.8 -x -0.5 -z 0.05"

node name="bin1" pkg="gazebo_ros" type="spawn_model" args="-file $(find ur5_notebook)/urdf/bin.urdf -urdf -model bin1 -y 1 -x -1.5 -z 0.05"

node name is different also name just after -model before describing its coordinates.


Originally posted by umar_anjum with karma: 11 on 2022-01-01

This answer was ACCEPTED on the original site

Post score: 1

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.