Using the following in the .sdf
file works fine only for spawning one object. If I try to spawn more than one, an error occurs because there are two objects "talking" on the same topics.
How can I write this piece of sdf more general so that spawning more objects is not a problem anymore? For example adding the model name inside the topic name?
<plugin name="camera_controller" filename="libgazebo_ros_camera.so">
<alwaysOn>true</alwaysOn>
<updateRate>0.0</updateRate>
<cameraName>RCcar/camera1</cameraName>
<imageTopicName>image_raw</imageTopicName>
<cameraInfoTopicName>camera_info</cameraInfoTopicName>
<frameName>link_camera</frameName>
<hackBaseline>0.0</hackBaseline>
<distortionK1>0.0</distortionK1>
<distortionK2>0.0</distortionK2>
<distortionK3>0.0</distortionK3>
<distortionT1>0.0</distortionT1>
<distortionT2>0.0</distortionT2>
<robotNamespace>/</robotNamespace>
</plugin>
there is a way that you do not need to modify your model profile.
In the ROS launch file in which you spawn the models, you can add a "group ns" attribute. Here is an example:
In the "EXAMPLE_LAUNCH_FILE_FOR_ONE_ROBOT.launch" file, you may launch one robot model.
Then the rostopics will be:
...
...