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

roslaunch launching not in one package

asked 2017-05-23 15:28:10 -0600

RL gravatar image

updated 2017-05-24 06:05:18 -0600

gvdhoorn gravatar image

Hi,

after long time I followed the tutorials again and tried a lauch file

<launch>

    <group ns="turtlesim1">
            <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" type="turtle_teleop_key" name="turtle_teleop_key"  output="screen">
            <param name="scale_linear" value="0.5" type="double"/>
            <param name="scale_angular" value="1.5" type="double"/>
            <remap from="turtlebot_teleop_keyboard/cmd_vel" to="cmd_vel_mux/input/teleop"/>
    </node>

</launch>

however the teleop is not working with the turtlesim

how would I correctly use teleop_key in a launchfile so that it work with the turtlesim ?

Thanks for any hint/link to the correct tutorial Regards, RL


Edit: Remapping is only for names ? only makes sense with long names ? is there any way to reuse the turtle_teleop_key in another package/ with another topic ?

this worked for me

<launch>
<group ns="turtlesim1">
        <node pkg="turtlesim" type="turtlesim_node" name="sim"/>
    <node pkg="turtlesim" type="turtle_teleop_key" name="turtle_teleop_key" output="screen">
            <param name="scale_linear" value="0.5" type="double"/>
            <param name="scale_angular" value="1.5" type="double"/>
    </node> 
</group>
</launch>

thanks and regards

edit retag flag offensive close merge delete

Comments

@RL: please don't post answers unless you are actually answering your own question. For everything else, just post comments or update your original question. Use the edit button/link for that.

gvdhoorn gravatar image gvdhoorn  ( 2017-05-24 06:06:01 -0600 )edit

just noticed that..sorry !

RL gravatar image RL  ( 2017-05-24 09:53:32 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted
0

answered 2017-05-24 03:16:56 -0600

So the turtlesim package tells you that it is subscribing to turtleX/cmd_vel (geometry_msgs/Twist). That means that it gets Messages of Type geometry_msgs/Twist at the Topic named turtleX/cmd_vel. The X is a placeholder for the current number of the turtle.

On the other hand we have the teleop node which is publishing to a Topic named turtle1/cmd_vel of type geometry_msgs/Twist by default. So what I don't know where you got <remap from="turtlebot_teleop_keyboard/cmd_vel" to="cmd_vel_mux/input/teleop"/> from. But normally with remap you can change a topic name. For example you can change the topicname from turtle1/cmd_vel to turtle2/cmd_vel with <remap from="turtle1/cmd_vel" to="turtle2/cmd_vel"/>.

So just to explain how it is working.

Another thing what you currently doing is <group ns="turtlesim1"> So this puts all the topics of the nodes you have in this group like f.e. the topic turtleX/cmd_vel in a group namespace. So in your case the topic name changes to turtlesim1/turtleX/cmd_vel.

And thats your current problem. By default the teleop is publishing to turtle1/cmd_vel. Your turtlesim subscribes after doing the namespace to turtlesim1/turtle1/cmd_vel. And this actually doesn't match!

I do not know if I should give you now the concrete solution. Perhaps you can try it on your own after this explaining and if you have further problems we can talk about it.

Didnt mentioned or checked the correctness of mimic by now. We talk abut this later too.

edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2017-05-23 15:28:10 -0600

Seen: 735 times

Last updated: May 24 '17