0
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勉強#2ROSでHello World

0
Last updated at Posted at 2020-07-21

環境

ubuntu20.04LTS
ros-noetic

hello_world.pyをつくる

$ code hello_world.py

hello_world.pyの中身は

import rospy
rospy.init_node('hello_world_node')
rospy.loginfo('Hello world')
rospy.spin()

roscoreして実行

$ roscore

ターミナル変えて、

$ python3 hello_world.py

noeticはpythonのコマンドを打つと、rospkgがないと言われるので、python3とするとうまくいった。

おまけ

以前melodicを入れていたので、

bash: /opt/ros/melodic/setup.bash: No such file or directory

という文言がずっと出ていた。そこで、

$ code ~/.bashrc

で開くと.bashrcに過去の産物があるわあるわ。。いろいろいじって保存し、

$ source /opt/ros/noetic/setup.bash
$ echo "source /opt/ros/noetic/setup.bash" >> ~/.bashrc
$ source ~/.bashrc

とすると、今まででていた文言を消すことができた。

0
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
0
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?