Help us understand the problem. What is going on with this article?

ROS_12:基本 roslaunch

More than 3 years have passed since last update.

roslaunch

robotを動かす時には複数のノードが必要です。それをまとめて動かすみたいです。

$ roslaunch [package] [filename.launch]

作り方

ROS Wikiの例を参考に

rosのパッケージのフォルダに移動

$ roscd beginner_tutorials

launchというフォルダを作成して移動

$ mkdir launch
$ cd launch

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>

で、他の端末からturlesim1にTopicを送る

$ rostopic pub /turtlesim1/turtle1/cmd_vel geometry_msgs/Twist -r 1 -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, -1.8]'

とturtlesimに送ったにも関わらず、両方のカメが動きます。

<group>タグは、グループを作る。
<node>タグは、ノードを動かす。 pkg属性でパッケージを指定。name属性で名前を指定(__name:=と同じ?)。type属性がノード名
<remap>タグはリマップですね。。
バックグラウンドで動いているみたいだからrosrun turtlesim turtle_teleop_keyは無理かなあ
<turtle1>と同じグループでよいと思うので、

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

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

にしてみる。。カメが1匹表示されないし動かない。。。やっぱり駄目っぽい。

ちなみに別で動かす時は、名前空間が追加されているのでリマップでPubliserの名前を変更する必要があるので、

$ rosrun turtlesim turtle_teleop_key /turtule/cmd_vel:=/turtlesim1/turtle1/cmd_vel

とする。

Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした