1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ROS tutorial まとめ3 rosparamとroslaunch

1
Posted at

まとめ3#

パラメータとは##

パラメータサーバというところに格納されたデータのこと。
データベースのようなもの。

rosparam##

  • rosparam list
    パラメータサーバにあるパラメータの表示。

  • rosparam get
    パラメータの値を取得。

    使い方

    $ rosparam get [param_name]
    

    すべてのパラメータの値を見るには、

    $ rosparam get /
    
  • rosparam set
    パラメータの値を変更。

    使い方

    $ rosparam set [param_name] [変更後の値]
    
  • rosparam dump
    ファイルへの書き込み。

    使い方

    $ rosparam dump [file_name]
    

roslaunch##

一度に複数のノードを起動することができる。
launchファイルで起動するノードを記述しておく。

使い方

$ roslaunch [package] [filename.launch]

まず、パッケージまで移動(ここでは、beginner_tutorials)。

$ roscd beginner_tutorials

launchディレクトリを作成。

$ mkdir launch
$ cd launch

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>

roslaunchする。

$ roslaunch beginner_tutorials turtlemimic.launch
$ rostopic pub /turtlesim1/turtle1/cmd_vel geometry_msgs/Twist -r 1 -- '[2.0, 0.0, 0.0]' '[0.0, 0.0, -1.8]'

亀のウィンドウが2つ表示され、turtle1に送った指示がturtle2にも反映される。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?