ROS2 Foxy에서 URG 사용
URG-04LX-UG01
htps //w w. 호쿠요 - 맞는 t. 이. jp/세아 rch/신 gぇ. php? 세리아 l = 17
urg_node 설치
$ sudo apt update
$ sudo apt install ros-foxy-urg-node
 실행
URG를 USB 케이블로 PC에 연결합니다.
터미널을 열고 다음을 수행하여 기기에 권한 부여
$ sudo chmod 777 /dev/ttyACM0
아래에서 urg_node 실행
$ ros2 run urg_node urg_node_driver --ros-args -p serial_port:=/dev/ttyACM0
다른 터미널에서 다음을 실행하고/scan 주제가 나오면 OK
$ ros2 topic echo /scan
 데이터 시각화
다른 터미널을 열고 rviz2를 시작합니다.
$ rviz2
Fixed Frame 를 laser 로 설정
 
왼쪽 하단의 Add 버튼 클릭
목록에서 LaserScan를 선택하고 확인을 클릭하십시오.
 
/scan 점이 표시되면 성공
 
 launch 파일에서 실행
설정을 yaml 파일로 작성하고 launch 파일에서 시작하는 방법
작업 공간 이하에 적절하게 패키지 작성
$ cd ~/ros2_ws/src
$ ros2 pkg create urg
구성 파일과 launch 파일을 저장하는 디렉토리 만들기
$ cd urg
$ mkdir launch config
config 디렉토리 아래에 다음 설정 파일 만들기
urg.yamlurg_node:
  ros__parameters:
    angle_max: 3.14
    angle_min: -3.14
    serial_port: /dev/ttyACM0
    serial_baud: 115200
    laser_frame_id: "laser"
    calibrate_time: false
    default_user_latency: 0.0
    diagnostics_tolerance: 0.05
    diagnostics_window_time: 5.0
    error_limit: 4
    get_detailed_status: false
    publish_intensity: false
    publish_multiecho: false
    cluster: 0
    skip: 1
launch 디렉토리 아래에 launch 파일 만들기
urg_launch.pyimport os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
    ld = LaunchDescription()
    param_file = os.path.join(
            get_package_share_directory('urg'), 'config',
            'urg.yaml')
    print(param_file)
    hokuyo_node = Node(
        package='urg_node', node_executable='urg_node_driver', output='screen',
        parameters=[param_file]
        )
    ld.add_action(hokuyo_node)
    return ld
CMakeLists.txt에 다음을 설명
CMakeLists.txtinstall(
  DIRECTORY launch config
  DESTINATION share/${PROJECT_NAME}
)
빌드 및 실행
$ cd ~/ros2_ws
$ colcon build
$ source install/setup.bash
$ ros2 launch urg urg_launch.py
 참고
                
                    
        
    
    
    
    
    
                
                
                
                
                    
                        
                            
                            
                            Reference
                            
                            이 문제에 관하여(ROS2 Foxy에서 URG 사용), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
                                
                                https://qiita.com/porizou1/items/b3cc26eb0cf168412dbc
                            
                            
                            
                                텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                            
                            
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                            
                            
                        
                    
                
                
                
            
$ sudo apt update
$ sudo apt install ros-foxy-urg-node
URG를 USB 케이블로 PC에 연결합니다.
터미널을 열고 다음을 수행하여 기기에 권한 부여
$ sudo chmod 777 /dev/ttyACM0
아래에서 urg_node 실행
$ ros2 run urg_node urg_node_driver --ros-args -p serial_port:=/dev/ttyACM0
다른 터미널에서 다음을 실행하고/scan 주제가 나오면 OK
$ ros2 topic echo /scan
데이터 시각화
다른 터미널을 열고 rviz2를 시작합니다.
$ rviz2
Fixed Frame 를 laser 로 설정
 
왼쪽 하단의 Add 버튼 클릭
목록에서 LaserScan를 선택하고 확인을 클릭하십시오.
 
/scan 점이 표시되면 성공
 
 launch 파일에서 실행
설정을 yaml 파일로 작성하고 launch 파일에서 시작하는 방법
작업 공간 이하에 적절하게 패키지 작성
$ cd ~/ros2_ws/src
$ ros2 pkg create urg
구성 파일과 launch 파일을 저장하는 디렉토리 만들기
$ cd urg
$ mkdir launch config
config 디렉토리 아래에 다음 설정 파일 만들기
urg.yamlurg_node:
  ros__parameters:
    angle_max: 3.14
    angle_min: -3.14
    serial_port: /dev/ttyACM0
    serial_baud: 115200
    laser_frame_id: "laser"
    calibrate_time: false
    default_user_latency: 0.0
    diagnostics_tolerance: 0.05
    diagnostics_window_time: 5.0
    error_limit: 4
    get_detailed_status: false
    publish_intensity: false
    publish_multiecho: false
    cluster: 0
    skip: 1
launch 디렉토리 아래에 launch 파일 만들기
urg_launch.pyimport os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
    ld = LaunchDescription()
    param_file = os.path.join(
            get_package_share_directory('urg'), 'config',
            'urg.yaml')
    print(param_file)
    hokuyo_node = Node(
        package='urg_node', node_executable='urg_node_driver', output='screen',
        parameters=[param_file]
        )
    ld.add_action(hokuyo_node)
    return ld
CMakeLists.txt에 다음을 설명
CMakeLists.txtinstall(
  DIRECTORY launch config
  DESTINATION share/${PROJECT_NAME}
)
빌드 및 실행
$ cd ~/ros2_ws
$ colcon build
$ source install/setup.bash
$ ros2 launch urg urg_launch.py
 참고
                
                    
        
    
    
    
    
    
                
                
                
                
                    
                        
                            
                            
                            Reference
                            
                            이 문제에 관하여(ROS2 Foxy에서 URG 사용), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
                                
                                https://qiita.com/porizou1/items/b3cc26eb0cf168412dbc
                            
                            
                            
                                텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                            
                            
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                            
                            
                        
                    
                
                
                
            
$ rviz2
설정을 yaml 파일로 작성하고 launch 파일에서 시작하는 방법
작업 공간 이하에 적절하게 패키지 작성
$ cd ~/ros2_ws/src
$ ros2 pkg create urg
구성 파일과 launch 파일을 저장하는 디렉토리 만들기
$ cd urg
$ mkdir launch config
config 디렉토리 아래에 다음 설정 파일 만들기
urg.yaml
urg_node:
  ros__parameters:
    angle_max: 3.14
    angle_min: -3.14
    serial_port: /dev/ttyACM0
    serial_baud: 115200
    laser_frame_id: "laser"
    calibrate_time: false
    default_user_latency: 0.0
    diagnostics_tolerance: 0.05
    diagnostics_window_time: 5.0
    error_limit: 4
    get_detailed_status: false
    publish_intensity: false
    publish_multiecho: false
    cluster: 0
    skip: 1
launch 디렉토리 아래에 launch 파일 만들기
urg_launch.py
import os
from ament_index_python.packages import get_package_share_directory
from launch import LaunchDescription
from launch_ros.actions import Node
def generate_launch_description():
    ld = LaunchDescription()
    param_file = os.path.join(
            get_package_share_directory('urg'), 'config',
            'urg.yaml')
    print(param_file)
    hokuyo_node = Node(
        package='urg_node', node_executable='urg_node_driver', output='screen',
        parameters=[param_file]
        )
    ld.add_action(hokuyo_node)
    return ld
CMakeLists.txt에 다음을 설명
CMakeLists.txt
install(
  DIRECTORY launch config
  DESTINATION share/${PROJECT_NAME}
)
빌드 및 실행
$ cd ~/ros2_ws
$ colcon build
$ source install/setup.bash
$ ros2 launch urg urg_launch.py
참고
                
                    
        
    
    
    
    
    
                
                
                
                
                    
                        
                            
                            
                            Reference
                            
                            이 문제에 관하여(ROS2 Foxy에서 URG 사용), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다
                                
                                https://qiita.com/porizou1/items/b3cc26eb0cf168412dbc
                            
                            
                            
                                텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                            
                            
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)
                            
                            
                        
                    
                
                
                
            
Reference
이 문제에 관하여(ROS2 Foxy에서 URG 사용), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://qiita.com/porizou1/items/b3cc26eb0cf168412dbc텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
                                
                                
                                
                                
                                
                                우수한 개발자 콘텐츠 발견에 전념
                                (Collection and Share based on the CC Protocol.)