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

tf tutorial is displaying just one turtle instead of two

asked 2018-01-21 12:06:44 -0500

pitosalas gravatar image

updated 2018-01-21 14:00:07 -0500

jayess gravatar image

I am learning tf and doing the tf tutorials (py), In this tutorial:

http://wiki.ros.org/tf/Tutorials/Writ...

when I perform the command:

$ roslaunch learning_tf start_demo.launch

I am supposed to see two turtles, but I see only one. I've double checked the instructions and it seems all is correct. What I don't see is where the second turtle's starting position is indicated. Could it be that the second turtle is on top of the first one which is why I don't see it?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
1

answered 2018-01-21 13:08:29 -0500

updated 2018-01-21 13:29:08 -0500

Hello @pitosalas,

My guess is that you forgot to add the listener node tag to the launch file.

After the instruction:

2. Running the listener With your text editor, open the launch file called start_demo.launch, and add the following lines:

It must to be like that:

<launch>
    <!-- Turtlesim Node-->
    <node pkg="turtlesim" type="turtlesim_node" name="sim"/>
    <node pkg="turtlesim" type="turtle_teleop_key" name="teleop" output="screen"/>

    <node name="turtle1_tf_broadcaster" pkg="learning_tf" type="turtle_tf_broadcaster.py" respawn="false" output="screen" >
      <param name="turtle" type="string" value="turtle1" />
    </node>
    <node name="turtle2_tf_broadcaster" pkg="learning_tf" type="turtle_tf_broadcaster.py" respawn="false" output="screen" >
      <param name="turtle" type="string" value="turtle2" /> 
    </node>
    <node pkg="learning_tf" type="turtle_tf_listener.py" name="listener" />
  </launch>

The turtle_tf_listener is the node that spawns the second turtle (lines 16 and 17)

  16     spawner = rospy.ServiceProxy('spawn', turtlesim.srv.Spawn)
  17     spawner(4, 2, 0, 'turtle2')

Hope it can help you!

Cheers

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2018-01-21 12:06:44 -0500

Seen: 1,334 times

Last updated: Jan 21 '18