0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

ROS2(Foxy)でYD-LiDARを動かす(Jetson AGX Xavier)

Last updated at Posted at 2021-05-02

Jetson AGX Xavierを用いて、ROS2(Foxy)でYD-LiDARを動かした時のメモ

ydlidar.png

YDLidar-SDKのインストール

cd ~/
git clone https://github.com/YDLIDAR/YDLidar-SDK
cd YDLidar-SDK
mkdir build
cd build
cmake ..
make
sudo make install

YDLiDAR ROS2のインストール

cd ~/ros_ws/src
git clone https://github.com/YDLIDAR/ydlidar_ros2_driver

~/ros_ws/src/ydlidar_ros2_driver/params/から、使用する機種のyamlを~/ros_ws/src/ydlidar_ros2_driver/params/ydlidar.yamlにコピー。接続しているUSBポートを修正。frame_idlaser_framebase_scanに修正。

ydlidar_ros2_driver_node:
  ros__parameters:
    port: /dev/ttyUSB0
    frame_id: base_scan
    ignore_array: ""
    baudrate: 128000
    lidar_type: 1
    device_type: 0
    sample_rate: 5
    abnormal_check_count: 4
    resolution_fixed: true
    reversion: true
    inverted: true
    auto_reconnect: true
    isSingleChannel: false
    intensity: false
    support_motor_dtr: true
    angle_max: 180.0
    angle_min: -180.0
    range_max: 64.0
    range_min: 0.01
    frequency: 10.0
    invalid_range_is_inf: false
cd ~/ros_ws/
colcon build --symlink-install --base-paths src/ydlidar_ros2_driver
source install/setup.bash

ROS2 Nav2連携(Turtlebot3側)

標準LiDARの記述をLaunchファイルでコメントアウト。

robot.launch.py

...
        IncludeLaunchDescription(
            PythonLaunchDescriptionSource(
                [ThisLaunchFileDir(), '/turtlebot3_state_publisher.launch.py']),
            launch_arguments={'use_sim_time': use_sim_time}.items(),
        ),

        #IncludeLaunchDescription(
        #    PythonLaunchDescriptionSource([lidar_pkg_dir, '/hlds_laser.launch.py']),
        #    launch_arguments={'port': '/dev/ttyUSB0', 'frame_id': 'base_scan'}.items(),
        #),

        Node(
            package='turtlebot3_node',
            executable='turtlebot3_ros',
            parameters=[tb3_param_dir],
            arguments=['-i', usb_port],
            output='screen'),
    ])
...
ros2 launch turtlebot3_bringup robot.launch.py
ros2 launch ydlidar_ros2_driver ydlidar_launch.py
0
1
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
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?