LoginSignup
1
2

More than 5 years have passed since last update.

ROS tutorial まとめ1 ノードの起動とか

Last updated at Posted at 2015-07-08

ROSまとめ1

HIROやPepperをROSで動かすために、ROSの勉強をはじめた次第です。
勉強のログを残していこうかと!

最初は、ROSのノードの起動まで。

1.準備

  • まず、ワークスペースを作る。
$ mkdir -p ~/catkin_ws/src
$ cd ~/catkin_ws/src
$ catkin_init_workspace
  • ワークスペースをビルド。
$ cd ~/catkin_ws/
$ catkin_make
  • ワークスペースをインストール環境に配置(overlay)。
$ source devel/setup.bash
  • パッケージを作る。
$ cd ~/catkin_ws/src

このあと、catkin_create_pkgでパッケージ生成。

使い方

$ catkin_create_pkg <package_name> [depend1] [depend2] [depend3]

$ catkin_create_pkg beginner_tutorials std_msgs rospy roscpp

これは、std_msgs, roscpp, rospyに依存した新しいpackagebeginner_tutorialsを作るという意味。

パッケージの生成が完了したら、ワークスペースのディレクトリまで移動して、もう一度catkin_makeコマンドを実行

$ cd ~/catkin_ws/
$ catkin_make

これをしないと、rospack depends1コマンドでエラーが発生する。

このあと、

$ source devel/setup.bash

により、setup.bashを読み込む。

2.実行手順

  • ROSを使うためには、まずroscore
  • 次にrosrunでノードを起動

使い方

$ rosrun [package_name] [node_name]

$ rosrun turtlesim turtlesim_node
1
2
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
2