yahboom
HomeLearn
Solution
Blog
Online Store
About Us
EN/中文
YDLIDAR 4ROS LiDAR📖
01.Linux basic course
  • 1.Introduction to Linux system
  • 2.Ubuntu file system
  • 3.Ubuntu common commands
  • 4.Ubuntu common editors
  • 5.Ubuntu software operation commands
  • 6.Virtual machine installation
  • 7.SSH remote control
  • 8.VNC remote control
  • 9.Transfer files remotely
  • 10.Driver library and communication
  • 11.Static IP and hotspot mode
  • 12.Bind device ID
  • 13.Capacity expansion and resource allocation
  • 14.Update system software sources
  • 15.Set root user password
  • 16.sudo free password
  • 17.Connect to WiFi network
  • 18.View system version
  • 19.Customized service management
  • 20.Back up system image
02.ROS1 basic course
  • 1.ROS introduction
  • 2.ROS installation
  • 3.ROS common command tools
  • 4.ROS workspace
  • 5.ROS function package
  • 6.ROS node
  • 7.ROS topic publisher
  • 8.ROS topic subscribers
  • 9.ROS service client
  • 10.ROS service server
  • 11.ROS action client
  • 12.ROS action server
  • 13.ROS custom message reception
  • 14.ROS-launch file
  • 15.ROS-TF transformation
  • 16.ROS parameter service
  • 17.ROS-rviz use
  • 18.ROS-rqt tool usage
  • 19.Topic message recording and playback
  • 20.urdf model introduction
  • 21.gazebo introduction
  • 22.ROS distributed communication
03.ROS1 lidar course
  • 0.Instructions before use
  • 1.Preparation
  • 2.Handheld lidar mapping
  • 3.Lidar avoiding
  • 4.Lidar guard
  • 5.Lidar follow
  • 6.Lidar mapping
  • 7.rrt_exploration mapping algorithm
  • 8.Navigation
  • 9.APP Mapping and Navigation
  • 10.RTAB 3D mapping and navigation
04.ROS2 basic course
  • 1. Introduction to ROS2
  • 2.ROS2 install Humble
  • 3.ROS2 development environment
  • 4.ROS2 workspace
  • 5.ROS2 function package
  • 6.ROS2 node
  • 7.ROS2 topic communication
  • 8.ROS2 service communication
  • 9.ROS2 action communication
  • 10.ROS2 custom interface message
  • 11.ROS2 parameter service case
  • 12.ROS2 meta-function package
  • 13.ROS2 distributed communication
  • 14.ROS2 DDS
  • 15.ROS2 time related API
  • 16.ROS2 common command tools
  • 17.ROS2 rviz2 use
  • 18.ROS2 rqt toolbox
  • 19.ROS2 Launch startup file configuration
  • 20.ROS2 recording and playback tool
  • 21.ROS2 URDF model
  • 22.ROS2 Gazebo simulation platform
  • 23.ROS2 TF2 coordinate transformation
05.ROS2 lidar course
  • 0.ReadMe
  • 1.Preparation
  • 2.Handheld lidar mapping
  • 3.Lidar avoiding
  • 4.Lidar follow
  • 5.Lidar guard
  • 6.Lidar patrol
  • 7.gmapping mapping
  • 8.cartographer mapping
  • 9.Navigation and avoiding
  • 10.APP Mapping and Navigation
  • 11.RTAB 3D mapping and navigation
06.RPi 5 Docker course
  • 1.Overview and installation
  • 2.Common commands
  • 3.Understand and publish images
  • 4.Hardware interaction data processing
  • 5.Enter docker container
  • 6.Update docker images
  • 7.Docker container to install ROS using accessories
Download
  • ROS1-Code
  • ROS1-VMFile
  • ROS2-Code
  • ROS2-VMFile
  • Other File
  • ROS2_Basic_VM
Download ZIP

Welcome to YDLIDAR 4ROS LiDAR repository

12.Bind device ID

12.Bind device ID

12.Bind device ID1.Device view command2. Establish port mapping relationship2.1. Device binding2.2. Introduction to rule file syntax3. Verify view4. Bind USB port

When the robot uses two or more USB serial devices, the corresponding relationship between the device name and the device is not fixed, but is assigned in sequence according to the order in which the devices are connected to the system.

Inserting one device first and then another device can determine the relationship between the device and the device name, but it is very troublesome to plug and unplug the device every time the system starts. The serial port can be mapped to a fixed device name. Regardless of the insertion order, the device will be mapped to a new device name. We only need to use the new device name to read and write the device.

 

1.Device view command

View camera device parameters

Enter the following command in the terminal to view the corresponding relationship between the camera's pixel size and frame rate.

v4l2-ctl --list-formats-ext

image-20220215110456637

View device ID

xxxxxxxxxx
lsusb

As can be seen from the picture below, Astra depth camera has an official document for binding the device to the ID number of each device. Generally, the controller does not need to be bound, and it can mainly be bound to the PCB and radar.

image-20220215111840056

View device ID

xxxxxxxxxx
ll /dev/

image-20220214200740623

2. Establish port mapping relationship

2.1. Device binding

  • Astra binding

There is a create_udev_rules file in the scripts folder under the astra_camera function package.

Run this file to automatically bind it.

Run the command as follows

xxxxxxxxxx
./create_udev_rules

Enter rules.d directory

xxxxxxxxxx
cd /etc/udev/rules.d/

You can find the 56-orbbec-usb.rules file, which is the Astra camera device binding file.

  • PCB and lidar binding

Enter rules.d directory

xxxxxxxxxx
cd /etc/udev/rules.d/

Create a new rplidar.rules file

xxxxxxxxxx
sudo touch rplidar.rules
sudo chmod 777 rplidar.rules

Open the rplidar.rules file

xxxxxxxxxx
sudo vim rplidar.rules

Write the following content

xxxxxxxxxx
KERNEL=="ttyUSB*", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", MODE:="0777", SYMLINK+="myserial"
KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", MODE:="0777", SYMLINK+="rplidar"

Exit for the rules to take effect

xxxxxxxxxx
sudo udevadm trigger
sudo service udev reload
sudo service udev restart

 

2.2. Introduction to rule file syntax

xxxxxxxxxx
KERNEL=="ttyUSB*", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", MODE:="0777", SYMLINK+="myserial"
KERNEL=="ttyUSB*", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="ea60", MODE:="0777", SYMLINK+="rplidar"

Analyze

x
KERNEL                 #The device name matching the event
ATTR{filename}         # Match the sysfs attributes of the event device.
idVendor               # Manufacturer number
idProduct              # Product number
SYMLINK                # Generate symbolic links for device files under /dev/. Just give this device an alias.
MODE                   # Set permissions for the device。

From [6.1], we can see that the PCB device number is [ttyUSB0] and is easy to change. The ID number is [1a86, 7523] and is fixed. [ttyUSB*] means that no matter the device number becomes [ttyUSB] in the future, it will be followed by [ 0, 1, 2, 3, 4,...] are all bound to [myserial]; the radar device [ttyUSB1] is the same; the same is true for other devices that need to be bound.

3. Verify view

View device number

xxxxxxxxxx
ll /dev/

PCB

image-20220214200850110

laser

image-20220214200912909

4. Bind USB port

The above situations are all different ID numbers. If the ID numbers of the radar and PCB are the same, or there are two or more PCBs (radars) with the same ID, the above binding will be confusing.

Then, we need to bind the USB port. After binding, the USB port cannot be changed at will. Each device can only be connected to a fixed USB port.

Binding method, take [ttyUSB0] as an example to check the port of the device at this time

xxxxxxxxxx
udevadm info --attribute-walk --name=/dev/ttyUSB0 |grep KERNELS

image-20220214200632653

We need is to modify it in the rules file

x
# KERNEL=="ttyUSB*", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", MODE:="0777", SYMLINK+="myserial"    # before modify
KERNELS=="1-2.1.3", ATTRS{idVendor}=="1a86", ATTRS{idProduct}=="7523", MODE:="0777", SYMLINK+="myserial"     # after modify

 

Static IP and hotspot mode
Capacity expansion and resource allocation

COMPANY

  • About us
  • Team Style
  • Blog

LEARNING & EXPLORATION

  • Tutorials
  • Edge AI hardware
  • Educational robots
  • Embedded intelligent hardware

WHERE TO BUY

  • Yahboom Online Store
  • Amazon
  • Alibaba
  • AliExpress
  • Mercado

TECHNOLOGY SUPPORT

  • Email: support@yahboom.com

BE A DISTRIBUTOR

  • Email: sales@yahboom.com
QR Code

Copyright © 2017-2026 Yahboom. All Rights Reserved.

EN/中文