ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
0

Problem with multiple turtlebot simulation

asked 2013-12-17 03:24:54 -0500

Stefano Primatesta gravatar image

updated 2014-04-20 14:09:41 -0500

ngrennan gravatar image

I tried to simulate multiple turtlebot in Gazebo. It seems there are no problem, but when I tried to see view_frames I have observed that it only read /robot1 or /robot2.

This is my launch file

<launch>
<arg name="base"      value="$(optenv TURTLEBOT_BASE kobuki)"/> <!-- create, roomba -->
<arg name="battery"   value="$(optenv TURTLEBOT_BATTERY /proc/acpi/battery/BAT0)"/>  <!-- /proc/acpi/battery/BAT0 --> 
<arg name="stacks"    value="$(optenv TURTLEBOT_STACKS hexagons)"/>  <!-- circles, hexagons --> 
<arg name="3d_sensor" value="$(optenv TURTLEBOT_3D_SENSOR kinect)"/>  <!-- kinect, asus_xtion_pro --> 

<include file="$(find gazebo_ros)/launch/empty_world.launch">
<arg name="use_sim_time" value="true"/>
<arg name="debug" value="false"/>
<arg name="world_name" value="$(find turtlebot_gazebo)/worlds/empty.world"/>
</include>


<!-- BEGIN ROBOT 1-->
<group ns="robot1">
<param name="tf_prefix" value="robot1_tf" />

<include file="$(find tesi_gazebo)/launch/includes/$(arg base).launch.xml">
<arg name="base" value="$(arg base)"/>
<arg name="stacks" value="$(arg stacks)"/>
<arg name="3d_sensor" value="$(arg 3d_sensor)"/>
<arg name="init_pose" value="-x 1 -y 1 -z 0" />
<arg name="robot_name"  value="Robot1" />
</include>

<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
<param name="publish_frequency" type="double" value="30.0" />
</node>

<!-- Fake laser -->
<node pkg="nodelet" type="nodelet" name="laserscan_nodelet_manager" args="manager"/>
<node pkg="nodelet" type="nodelet" name="depthimage_to_laserscan"
    args="load depthimage_to_laserscan/DepthImageToLaserScanNodelet laserscan_nodelet_manager">
<param name="scan_height" value="10"/>
<param name="output_frame_id" value="/camera_depth_frame"/>
<param name="range_min" value="0.45"/>
<remap from="image" to="/camera/depth/image_raw"/>
<remap from="scan" to="/scan"/>
</node>
</group>


<!-- BEGIN ROBOT 2-->
<group ns="robot2">
<param name="tf_prefix" value="robot2_tf" />

<include file="$(find tesi_gazebo)/launch/includes/$(arg base).launch.xml">
<arg name="base" value="$(arg base)"/>
<arg name="stacks" value="$(arg stacks)"/>
<arg name="3d_sensor" value="$(arg 3d_sensor)"/>
<arg name="init_pose" value="-x 1 -y -1 -z 0" />
<arg name="robot_name"  value="Robot2" />
</include>

<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
<param name="publish_frequency" type="double" value="30.0" />
</node>

<!-- Fake laser -->
<node pkg="nodelet" type="nodelet" name="laserscan_nodelet_manager" args="manager"/>
<node pkg="nodelet" type="nodelet" name="depthimage_to_laserscan"
    args="load depthimage_to_laserscan/DepthImageToLaserScanNodelet laserscan_nodelet_manager">
<param name="scan_height" value="10"/>
<param name="output_frame_id" value="/camera_depth_frame"/>
<param name="range_min" value="0.45"/>
<remap from="image" to="/camera/depth/image_raw"/>
<remap from="scan" to="/scan"/>
</node>
</group>
</launch>

I don't know why in tf tree I see only one robot and not both.

This is kobuki.launch.xml

<launch>
<arg name="base"/>
<arg name="stacks"/>
<arg name="3d_sensor"/>
<arg name="robot_name"/>
<arg name="init_pose"/>

<arg name="urdf_file" default="$(find xacro)/xacro.py '$(find turtlebot_description)/robots/$(arg base)_$(arg stacks)_$(arg 3d_sensor).urdf.xacro'" />
<param name="/robot_description" command="$(arg urdf_file)" />

<!-- Gazebo model spawner -->
<node name="spawn_turtlebot_model" pkg="gazebo_ros" type="spawn_model"
    args="$(arg init_pose) -unpause -urdf -param /robot_description -model $(arg robot_name)"/>

<!-- Velocity muxer -->
<node pkg="nodelet" type="nodelet" name="mobile_base_nodelet_manager" args="manager"/>
<node pkg="nodelet" type="nodelet" name="cmd_vel_mux"
    args="load yocs_cmd_vel_mux/CmdVelMuxNodelet mobile_base_nodelet_manager">
<param name="yaml_cfg_file" value="$(find turtlebot_bringup)/param/mux.yaml" />
<remap from="cmd_vel_mux/output" to="mobile_base/commands/velocity"/>
</node>

<!-- Bumper/cliff to pointcloud (not working, as it needs sensors/core messages) -->
<include file="$(find turtlebot_bringup)/launch/includes/kobuki/bumper2pc.launch ...
(more)
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2013-12-17 21:55:22 -0500

Stefano Primatesta gravatar image

Today was released an update for Gazebo_ros and tf. Now I can see new tf-tree.

//db.tt/9H5kCHSd

But now I have some doubts: Is this tree correct? Because I see robot1/base_footprint and robot2/base_footprint and odom-->base_footprint.

Do I have to see robot1/odom-->robot1/base_footprint? (The same with robot2/)

edit flag offensive delete link more

Comments

Yes you should see 2 odom tf, one for robot1 and one for robot2.

Tirjen gravatar image Tirjen  ( 2013-12-18 00:53:15 -0500 )edit

But I don't know why I see only one tf.

Stefano Primatesta gravatar image Stefano Primatesta  ( 2013-12-18 11:10:05 -0500 )edit

It's like the node that publishes the odom tf (that should be gazebo) doesn't get the namespaces robot1 and robot2.

Tirjen gravatar image Tirjen  ( 2013-12-18 20:05:31 -0500 )edit

ok! But I don't see where public odom tf.

Stefano Primatesta gravatar image Stefano Primatesta  ( 2013-12-20 01:37:43 -0500 )edit
0

answered 2013-12-20 03:49:45 -0500

Tirjen gravatar image

Try to set as param of the robot state publisher the tf prefix:

<node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
<param name="publish_frequency" type="double" value="30.0" />
<param name="tf_prefix" type="string" value="robot1"/>
</node>
edit flag offensive delete link more

Comments

I tried, but there are no changes. There is the same tf-tree.

Stefano Primatesta gravatar image Stefano Primatesta  ( 2013-12-23 08:00:41 -0500 )edit

The problem is that /gazebo publish odom-->base_footprint, not odom-->robot1/base_footprint but I can not find where to apply this change.

Stefano Primatesta gravatar image Stefano Primatesta  ( 2013-12-25 22:01:37 -0500 )edit

Question Tools

3 followers

Stats

Asked: 2013-12-17 03:24:54 -0500

Seen: 1,457 times

Last updated: Dec 20 '13