本シリーズ前回の記事「ROS-O で ROS1 を使う – ROS-O とは」では ROS-O が必要とされる背景などを中心にその概要の説明をしました.
今回の記事では ROS-O のインストールとその動作確認の方法について説明します.本記事での ROS-O をインストールする対象の Ubuntu のバージョンは次の2つを前提としています.
ROS-O のインストール手順は apt で取得できる ROS-O パッケージを配布している Web サイト Bielefeld University ROS-O package repository のトップページに
Install instructions to use ROS One: という項目で掲載されています.
Install instructions to use ROS One: のコメント以外,実行部分のみを書き出したものを下に掲載します.
インストールはターミナルに下のコマンドを1行ずつコピー&ペーストして [Enter] 入力で各コマンドを実行して行います.
Terminal: ROS-O インストール
sudo apt install curl sudo curl -sSL https://ros.packages.techfak.net/gpg.key -o /etc/apt/keyrings/ros-one-keyring.gpg echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/ros-one-keyring.gpg] https://ros.packages.techfak.net $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/ros1.list echo "# deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/ros-one-keyring.gpg] https://ros.packages.techfak.net $(lsb_release -cs) main-dbg" | sudo tee -a /etc/apt/sources.list.d/ros1.list sudo apt update sudo apt install python3-rosdep sudo rosdep init echo "yaml https://ros.packages.techfak.net/ros-one.yaml one" | sudo tee /etc/ros/rosdep/sources.list.d/1-ros-one.list rosdep update sudo apt install ros-one-desktop
ROS-O が動作するかを確認します.動作確認手順の1つとして ROS Noetic 以前と同様に「タートルシム / turtlesim」を Ubuntu PC 画面上で動かしてみます.
ROS Noetic 以前と基本操作は同じですが,異なる点が1つあり,ターミナルの ROS 環境の設定が ROS-O となるように source /opt/ros/one/setup.bash を実行します.
Terminal 1: 入力コマンド roscore
source /opt/ros/one/setup.bash roscore
Terminal 1: 出力例
robotuser@robotuser-PC:~$ source /opt/ros/one/setup.bash robotuser@robotuser-PC:~$ roscore ... logging to /home/robotuser/.ros/log/96e7dc35-4f5d-11f1-b266-50eb713af63d/roslaunch-robotuser-PC-5625.log Checking log directory for disk usage. This may take a while. Press Ctrl-C to interrupt Done checking log file disk usage. Usage is <1GB. started roslaunch server http://robotuser-PC:43503/ ros_comm version 1.17.3 SUMMARY ======== PARAMETERS * /rosdistro: one * /rosversion: 1.17.3 NODES auto-starting new master process[master]: started with pid [5633] ROS_MASTER_URI=http://robotuser-PC:11311/ setting /run_id to 96e7dc35-4f5d-11f1-b266-50eb713af63d process[rosout-1]: started with pid [5642] started core service [/rosout]
Terminal 2: 入力コマンド turtlesim_node
source /opt/ros/one/setup.bash rosrun turtlesim turtlesim_node
Terminal 2: 出力例
robotuser@robotuser-PC:~$ source /opt/ros/one/setup.bash robotuser@robotuser-PC:~$ rosrun turtlesim turtlesim_node QSocketNotifier: Can only be used with threads started with QThread [INFO] [1778739996.107534065]: Starting turtlesim with node name /turtlesim [INFO] [1778739996.111756257]: Spawning turtle [turtle1] at x=[5.544445], y=[5.544445], theta=[0.000000]
turtlesim_node が正常起動すると左図のような中心に亀が表示されたウィンドウが開きます.
Terminal 3: 入力コマンド turtle_teleop_key
source /opt/ros/one/setup.bash rosrun turtlesim turtle_teleop_key
Terminal 3: 出力例
robotuser@robotuser-PC:~$ source /opt/ros/one/setup.bash robotuser@robotuser-PC:~$ rosrun turtlesim turtle_teleop_key Reading from keyboard --------------------------- Use arrow keys to move the turtle. 'q' to quit.
turtle_teleop_key を起動した状態でキーボードの方向キー(←↑↓→)を押すと turtlesim_node で表示しているウィンドウの中の亀がウィンドウ内で動くかと思います.
亀がキー操作で動いたらとりあえずの ROS-O の動作確認は終了です.
Terminal 3 は ‘q’ で,Terminal 1 と 2 は ‘Ctrl-C’ で終了します.
今回の記事はここまでです.
本シリーズ次回の記事では ROS-O での ROS パッケージのビルドとその実行について説明する予定です.