Multiple Turtlebots in Gazebo - how to solve conflicts in multiple cameras?
Hello all!
I'm trying to introduce two turtlebots in gazebo for some of our experiments, and I followed instructions given in the answer to
answers.ros.org/question/41433/multiple-robots-simulation-and-navigation/
..and successfully spawned two turtlebots with the lasers working correctly (and independently) for both. Now, I want to get the cameras for both the turtlebots working, but have had no luck in that regard yet. I suspect the problem is that the separate tf_prefixes for the two robots are not getting appended to the camera topics of the two robots while publishing, and consequently the robots try to publish to the same topic and fail.
I have not been able to find a solution to this yet, and any help in this regard would be much appreciated!
My Current configuration is:
Ubuntu 11.10 + ROS Electric (Yes, i am stuck with Electric and cannot upgrade at the moment), Gazebo (simulator_gazebo) - version 1.4.15
Also, I get the following ERRORs when i try to roslaunch my launch file for gazebo node:
"Tried to advertise a service that is already advertised in this node [/camera/image_raw/compressed/set_parameters]"
"Tried to advertise a service that is already advertised in this node [/camera/image_raw/theora/set_parameters]"
Here are my launch files:
* create_multi_robot_world.launch *
<?xml version="1.0" ?>
<launch>
<param name="/use_sim_time" value="true" />
<!-- start world -->
<node name="gazebo" pkg="gazebo" type="gazebo" args="-u $(find turtlebot_exp)/worlds/Boyd_5th_floor_brown_doors.world" respawn="false" output="screen" />
<!-- include our robots -->
<include file="$(find turtlebot_exp)/launch/robots.launch"/>
</launch>
* robots.launch *
<?xml version="1.0" ?>
<launch>
<!-- No namespace here as we will share this description.
Access with slash at the beginning -->
<param name="robot_description"
command="$(find xacro)/xacro.py $(find turtlebot_description)/urdf/turtlebot.urdf.xacro" />
<!-- BEGIN ROBOT 1-->
<group ns="robot1">
<param name="tf_prefix" value="robot1_tf" />
<include file="$(find turtlebot_exp)/launch/one_robot.launch" >
<arg name="init_pose" value="-x 2.5 -y 0 -z 0" />
<arg name="robot_name" value="Robot1" />
</include>
</group>
<!-- BEGIN ROBOT 2-->
<group ns="robot2">
<param name="tf_prefix" value="robot2_tf" />
<include file="$(find turtlebot_exp)/launch/one_robot.launch" >
<arg name="init_pose" value="-x -1.5 -y 0 -z 0" />
<arg name="robot_name" value="Robot2" />
</include>
</group>
</launch>
* one_robot.launch *
<?xml version="1.0" ?>
<launch>
<arg name="robot_name"/>
<arg name="init_pose"/>
<node name="spawn_minibot_model" pkg="gazebo" type="spawn_model" args="$(arg init_pose) -urdf -param /robot_description -model $(arg robot_name)" respawn="false" output="screen"/> <!-- launch-prefix="xterm -e ddd" /> -->
<node pkg="diagnostic_aggregator" type="aggregator_node" name="diagnostic_aggregator" >
<rosparam command="load" file="$(find turtlebot_bringup)/config/diagnostics.yaml" />
</node>
<node pkg="robot_state_publisher" type="state_publisher" name="robot_state_publisher" output="screen">
<param name="publish_frequency" type="double" value="30.0" />
</node>
<!-- The odometry estimator, throttling, fake laser etc. go here -->
<!-- All the stuff as from usual robot launch file -->
<!-- The odometry estimator -->
<node pkg="robot_pose_ekf" type="robot_pose_ekf" name="robot_pose_ekf">
<param name="freq" value="30.0"/>
<param name="sensor_timeout" value="1.0"/>
<param name="publish_tf" value="true"/>
<param name="odom_used" value="true"/>
<param name="imu_used" value="false"/>
<param name="vo_used" value="false"/>
<param name="output_frame" value="odom"/> <!-- This line ...
The "tried to advertise a service" warnings can be ignored, they always pop up (I think). Don't confuse tf_prefix with remapping, you need to get both right. If remapping works,
rostopic list
should show sth like/robot1/camera/...
and not just/camera/...
.I thought so too initially, but i still don't see any camera feed from either of the two turtlebots. Also, these are not merely warnings, they pop up as "ERRORS". I tried to see if /robot_1/camera/.. gets published, but its not. And all i see is /camera/...