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

Tutorials: launch file problem

asked 2013-01-07 11:57:30 -0500

aldaris gravatar image

I'm a new user of Linux and ROS. I'm running the Groovy on Ubuntu 12.04. I meet some problems with the tutorials on roslaunch. Using the launch file turtlemimic.launch:

<launch>

<group ns="turtlesim1">
<node pkg="turtlesim" name="sim" type="turtlesim_node"/>
</group>

<group ns="turtlesim2">
<node pkg="turtlesim" name="sim" type="turtlesim_node"/>
</group>

<node pkg="turtlesim" name="mimic" type="mimic">
<remap from="input" to="turtlesim1/turtle1"/>
<remap from="output" to="turtlesim2/turtle1"/>
</node>

</launch>

After running the launch file, I can get two turtlesims started. Command

$ rostopic pub /turtlesim1/turtle1/command_velocity turtlesim/Velocity -r 1 --   2.0  -1.8

also allowed me to control the two turtles moving in circles. But after I ran the command

$ rosrun rqt_graph rqt_graph

the result shows as followed:

                 /turtlesim1/turtle1/pose         /turtlesim2/turtle1/command_velocity
/turtlesim1/sim --------------------------> /mimic--------------------> /turtlesim2/sim

This is different from the one in tutorials:

              /turtle1/command_velocity
 teleop_turtle-----------------------> 
              /turtle1/command_velocity  /turtlesim
 rostopic....------------------------>

I don't know whether it's the problem of my setting or not. The result I got makes more sense to me. I also tried to add several lines in the launch file:

  <node pkg="turtlesim" name="tele" type="turtle_teleop_key">
  <remap from="output" to="turtlesim1/turtle1"/>
  </node>

But I still can't control the turtle using keyboard. I checked the node information of "tele", the results are:

Node [/tele]
Publications: 
 * /rosout [rosgraph_msgs/Log]
* /turtle1/command_velocity [turtlesim/Velocity]

Subscriptions: None

Services: 
* /tele/get_loggers
* /tele/set_logger_level


contacting node htt p://localhost:36452/ ...
Pid: 9285
Connections:
* topic: /rosout
* to: /rosout
* direction: outbound
* transport: TCPROS

Can anyone tell me what's happening? Thanks in advance.

edit retag flag offensive close merge delete

Comments

It seems that I can't comment under your answer. Thank you very much for you help. It works. It also helps me to better understand how nodes communicate with each other. I have never edit ROS wiki before, I will try later.

aldaris gravatar image aldaris  ( 2013-01-08 09:03:23 -0500 )edit

1 Answer

Sort by ยป oldest newest most voted
2

answered 2013-01-08 06:27:44 -0500

dbworth gravatar image

Hi

This is a nice extension to a good tutorial. If you can understand how to fix this, you're well on your way...
Can I suggest next time writing a more detailed subject? e.g. "connecting turtlesim teleop to turtlesim mimic"

Here's how to debug it:

When you run the teleop node, do:

$ rostopic list

and you'll see that it outputs to the topic:

/turtle1/command_velocity

But earlier in the tutorial, you sent a command to the turtle manually on the topic:

/turtlesim1/turtle1/command_velocity

using the command:

rostopic pub /turtlesim1/turtle1/command_velocity turtlesim/Velocity -r 1 -- 2.0 -1.8

So therefore you need to launch the teleop node, and re-map the output from the teleop node to the command topic of the first turtle

Here's a launch file with the existing code to start two turtles, plus it launches the teleop node and remaps the teleop topic:

<launch>

<group ns="turtlesim1">
<node pkg="turtlesim" name="sim" type="turtlesim_node"/>
</group>

<group ns="turtlesim2">
<node pkg="turtlesim" name="sim" type="turtlesim_node"/>
</group>

<node pkg="turtlesim" name="mimic" type="mimic">
<remap from="input" to="turtlesim1/turtle1"/>
<remap from="output" to="turtlesim2/turtle1"/>
</node>

<node pkg="turtlesim" name="teleop" type="turtle_teleop_key">
  <remap from="/turtle1/command_velocity" to="/turtlesim1/turtle1/command_velocity"/>
</node>

</launch>

Would you like to add this to the end of the tutorial on the Wiki?


edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2013-01-07 11:57:30 -0500

Seen: 1,537 times

Last updated: Jan 08 '13