ROS HYDRO : Two Turtlebot Create in Gazebo with separate odom published topics [closed]

asked 2014-12-18 10:52:36 -0500

satk gravatar image

updated 2014-12-18 10:53:10 -0500


I am trying to simulate two turtlebot creates in the gazebo environment. With my current launch files I get the correct robot position and orientation on the topic gazebo/model_states. I would like to publish the Robot1 and Robot2 odometry data on the topic Robot1/odom and Robot2/odom. It should have been working with my current script as I launch the turtlebot group nodes under two different namespaces.

Here is the main launch file sim.launch


  <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/"/>

  <!-- No namespace here as we will share this description. Access with slash at the beginning -->
  <param name="robot_description"
    command="$(find xacro)/ $(find turtlebot_description)/urdf/turtlebot_gazebo.urdf.xacro" />

  <!-- BEGIN ROBOT 1-->
  <group ns="robot1">
    <param name="tf_prefix" value="robot1_tf" />
    <include file="$(find turtlebot_gaze)/launch/one_robot.launch" >
      <arg name="init_pose" value="-x 1 -y 1 -z 0" />
      <arg name="robot_name"  value="Robot1" />

  <!-- BEGIN ROBOT 2-->
  <group ns="robot2">
    <param name="tf_prefix" value="robot2_tf" />
    <include file="$(find turtlebot_gaze)/launch/one_robot.launch" >
      <arg name="init_pose" value="-x -1 -y 1 -z 0" />
      <arg name="robot_name"  value="Robot2" />

This launch file called one_robot.launch file which is below:

  <arg name="robot_name"/>
  <arg name="init_pose"/>

  <!-- The odometry estimator, throttling, fake laser etc. go here -->
  <!-- All the stuff as from usual robot launch file -->

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

  <include file="$(find turtlebot_gaze)/launch/create_modified.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="$(arg init_pose)"/>
    <arg name="robot_name" value="$(arg robot_name)"/>

  <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher">
    <param name="publish_frequency" type="double" value="30.0"/>
    <remap from="gazebo/model_states" to="/rrbot/gazebo/model_states" />

  <!-- 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"/>


The above launch file calls the create_modified.urdf.xml file which is pasted below:

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

  <arg name="urdf_file" default="$(find xacro)/ '$(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)"/>

  <!-- Odometry estimator -->
  <node pkg="robot_pose_ekf" type="robot_pose_ekf" name="robot_pose_ekf">
    <remap from="imu_data" to="turtlebot_node/imu/data"/>
    <remap from="robot_pose_ekf/odom" to="odom_combined"/>
    <param name="freq ...
edit retag flag offensive reopen merge delete

Closed for the following reason Gazebo Question: The Gazebo community prefers to answer questions at: by tfoote
close date 2015-09-11 15:17:09.839628