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

Adding two robots in gazebo tfs problem and urdf files

asked 2014-09-23 07:38:00 -0600

RSA_kustar gravatar image

updated 2014-09-23 08:35:46 -0600

I want to add two robots in gazebo.

The first robot is a quadrotor from hector package the second robot is husky

I used apt-get to download both of then except the husky_description. I used git clone "link"

I changed in the mesh file of the husky.

My launch file is the following:

 <launch><!-- Start Gazebo with my world by changing the arg > running in (max) realtime -->
 <include file="$(find haptic_teleoperation)/launch/box.launch"/>
 <!-- Spawn simulated quadrotor uav -->
 <include file="$(find hector_quadrotor_gazebo)/launch/spawn_quadrotor.launch"> 
 <arg name="x" value="10.0"/>
 <arg name="y" value="0.0"/>
 <arg name="z" value="0.3"/>
 <arg name="model" value="$(find hector_quadrotor_description)/urd/quadrotor_hokuyo_utm30lx.gazebo.xacro"/>
<include file="$(find haptic_teleoperation)/launch/husky_spawn.launch"/>  

The husky_spwan.launch file is the following:

<!-- Send the Husky A200 Robot URDF/XACRO to param server -->
<param name="husky_robot_description" command="$(find xacro)/ '$(find husky_description)/urdf/base.urdf.xacro'" />
    <!-- Spawn robot in gazebo -->
     <node name="spawn_husky_model" pkg="gazebo_ros" type="spawn_model" args="$(optenv ROBOT_INITIAL_POSE) -unpause -urdf -param husky_robot_description -model mobile_base"/>

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

 <!--   <remap from="robot_description" to="different_robot_description" />
        <remap from="joint_states" to="different_joint_states" />-->

   <node pkg="robot_pose_ekf" type="robot_pose_ekf" name="robot_pose_ekf">
      freq: 10.0
      sensor_timeout: 1.0
       publish_tf: true
      odom_used: true
      vo_used: true
      output_frame: /world

the box.launch file only launch the gazebo client and server.

first I faced a problem becasue both robots have two links with the smae names. Therefore, I changed in the urdf file of the husky from base_footprint to husky_foot_print and from base_link into husky_base link. ( I dont know if what I did it write or wrong)

Anyway, when I run the quad rotor alone and I check the tf I find all the tfs and links and joints that are specified in the urdf file for the quad rotor. Also, when I run the husky alone I find all its links and joints.

but when I run them together as the shown in the launch file above the links that their parent is the "base_link" in the quadrotor disapear from the tf tree.

Also, I dont know what is the fixed frame for the husky or from where to spacey it ?? if I want it to be the world frame as for the quad rotor what should I do ??

Also, there is a node that is called robot_state_publisher >> should I call it twice for each robot or once for both ?? because it exist in the launch file of the hector_quadrotor and also you can see it in the launch file for the husky ??

Actually I could not run if the two robot_state_publisher nodes so I had the following: This node I added it in the launch file of husky:

 <node pkg="robot_state_publisher" type="robot_state_publisher" name="husky_state_publisher"></node>

this node exist in the launch file of the quadrotor:

 <node pkg="robot_state_publisher" type="robot_state_publisher" name="robot_state_publisher"></node>
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2014-10-09 03:57:39 -0600

RSA_kustar gravatar image

I solved this problem by running two different launch files for each one alone and it worked. But I made sure that one of them had a different name space.

I faced later a problem when using the topics that gazebo publish for example the topic /ground_truth/state that gives me the information about only one robot and I want the information for both.

So, I didn't know which topic to use for getting the information of the position and velocity with time stamp for the second robot.

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2014-09-23 07:38:00 -0600

Seen: 984 times

Last updated: Oct 09 '14