1
3

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 1 year has passed since last update.

北陽電機公式のROS 2ノード urg_node2 でURGを動かす

Last updated at Posted at 2023-03-11

はじめに

北陽電機の2DLiDARを使えるROS2パッケージとしてurg_nodeがあるが、公式からurg_node2というROS2パッケージが出ている。
今回はこれを使ってUSBタイプのURG-04LXを動かしてみた。

以前書いたurg_nodeの記事

環境

OS:ubuntu22.04LTS
ROS 2 : Humble

使用したLiDAR URG-04LX

Install

READMEの通り

cd ros2_ws/src/
git clone --recursive https://github.com/Hokuyo-aut/urg_node2.git
rosdep update
rosdep install -i --from-paths urg_node2
cd ../
colcon build --symlink-install --packages-select urg_node2 

launchファイル編集

USB接続のURGを使う場合launch/urg_node2.launch.py​​を以下のように変更する。(デフォルトはparams_ether)

urg_node2.launch
def generate_launch_description():

    # パラメータファイルのパス設定
    config_file_path = os.path.join(
        get_package_share_directory('urg_node2'),
        'config',
        'params_serial.yaml'
    )

実行

以下でros2ノードの実行 ※/dev/ttyACM0にLiDARがつながっているとする

sudo chmod 777 /dev/ttyACM0
ros2 launch urg_node2 urg_node2.launch.py
[INFO] [launch]: All log files can be found below /home/porizou/.ros/log/2023-03-11-11-12-15-148865-porizou-RM7C-R35T-3253
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [urg_node2_node-1]: process started with pid [3265]
[urg_node2_node-1] [INFO] [1678500735.912239365] [urg_node2]: Connected to a serial device with single scan. Hardware ID: H1510839

rviz2 でLaserScanを見る

rviz2起動

rviz2

Fixed Frame をlaserに設定
左下のAddボタンをクリック
一覧からLaserScanを選択してOKをクリック
Topicに/scanを入力

rviz_screenshot_2023_03_11-02_58_15.png

点群がrvuz2に表示されればOK

node の終了

Lifecycleの機能で終了できる

ros2 lifecycle set /urg_node2 shutdown

おわりに

公式のROS2パッケージだけあってLifecycleに対応していたり、多機能なので
今後ROS2で北陽電機の2DLiDARを使う場合はこちらのパッケージを使うのがよいだろう。

参考

1
3
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
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?