9.5.5完成机器人导航并建图出现问题(使用串口进行连接,后面显示这个)
-
li@ubantu:~/chapt9/microros_ws$ ros2 launch bringup bringup.launch.py
[INFO] [launch]: All log files can be found below /home/li/.ros/log/2025-04-15-01-28-25-394866-ubantu-4599
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [joint_state_publisher-1]: process started with pid [4601]
[INFO] [robot_state_publisher-2]: process started with pid [4603]
[INFO] [odom2tf-3]: process started with pid [4605]
[INFO] [micro_ros_agent-4]: process started with pid [4624]
[robot_state_publisher-2] [INFO] [1744651705.590238505] [robot_state_publisher]: got segment base_footprint
[robot_state_publisher-2] [INFO] [1744651705.590380034] [robot_state_publisher]: got segment base_link
[robot_state_publisher-2] [INFO] [1744651705.590393148] [robot_state_publisher]: got segment laser_link
[micro_ros_agent-4] [1744651706.006637] info | TermiosAgentLinux.cpp | init | running... | fd: 3
[micro_ros_agent-4] [1744651706.007247] info | Root.cpp | set_verbose_level | logger setup | verbose_level: 6
[joint_state_publisher-1] [INFO] [1744651706.257693092] [joint_state_publisher]: Waiting for robot_description to be published on the robot_description topic...
[INFO] [ydlidar_node-5]: process started with pid [4652]
[ydlidar_node-5] [INFO] [1744651711.305964413] [ydlidar_node]: [YDLIDAR INFO] Current ROS Driver Version: 1.0.1
[ydlidar_node-5]
[ydlidar_node-5] [2025-04-15 01:28:31][info] SDK initializing
[ydlidar_node-5] [2025-04-15 01:28:31][info] SDK has been initialized
[ydlidar_node-5] [2025-04-15 01:28:31][info] SDK Version: 1.2.9
[ydlidar_node-5] [2025-04-15 01:28:31][info] Connect elapsed time 10 ms
[ydlidar_node-5] [2025-04-15 01:28:31][info] Lidar successfully connected [/dev/ttyUSB1:115200]
[ydlidar_node-5] [2025-04-15 01:28:31][info] Lidar running correctly! The health status good
[ydlidar_node-5] [2025-04-15 01:28:31][info] Current Lidar Model Code 12
[ydlidar_node-5] [2025-04-15 01:28:31][info] Check status, Elapsed time 0 ms
[ydlidar_node-5] [2025-04-15 01:28:31][info] Lidar init success, Elapsed time [12]ms
[ydlidar_node-5] [2025-04-15 01:28:31][info] Start to getting intensity flag
[ydlidar_node-5] [2025-04-15 01:28:33][info] [YDLIDAR] End to getting intensity flag
[ydlidar_node-5] [2025-04-15 01:28:33][info] [YDLIDAR] Create thread 0x41800640
[ydlidar_node-5] [2025-04-15 01:28:33][info] Successed to start scan mode, Elapsed time 2537 ms
[ydlidar_node-5] [2025-04-15 01:28:34][error] Timeout count: 1
[ydlidar_node-5] [2025-04-15 01:28:35][error] Timeout count: 2
[ydlidar_node-5] [2025-04-15 01:28:36][error] Timeout count: 3
[ydlidar_node-5] [2025-04-15 01:28:38][error] Check Sum 0x202A != 0x6878
[ydlidar_node-5] [2025-04-15 01:28:39][error] Timeout count: 1
[ydlidar_node-5] [2025-04-15 01:28:40][error] Check Sum 0x6B1A != 0x7812
[ydlidar_node-5] [2025-04-15 01:28:40][error] Timeout count: 2
[ydlidar_node-5] [2025-04-15 01:28:41][error] Timeout count: 1
[ydlidar_node-5] [2025-04-15 01:28:42][error] Check Sum 0x5D90 != 0x02CD
[ydlidar_node-5] [2025-04-15 01:28:42][error] Timeout count: 2
[ydlidar_node-5] [2025-04-15 01:28:43][error] Timeout count: 3
[ydlidar_node-5] [2025-04-15 01:28:44][error] Failed to turn on the Lidar, because the lidar is [Device Failed].
[ydlidar_node-5] [INFO] [1744651724.497044306] [ydlidar_node]: [YDLIDAR INFO] Now YDLIDAR is stopping .......
[INFO] [ydlidar_node-5]: process has finished cleanly [pid 4652]
[ydlidar_node-5]
我改完后的launch.py如下:
import launch
import launch_ros
from ament_index_python.packages import get_package_share_directory
from launch.launch_description_sources import PythonLaunchDescriptionSourcedef generate_launch_description():
bringup_dir = get_package_share_directory(
'bringup')
ydlidar_ros2_dir = get_package_share_directory(
'ydlidar')urdf2tf = launch.actions.IncludeLaunchDescription( PythonLaunchDescriptionSource( [bringup_dir, '/launch', '/urdf2tf.launch.py']), ) odom2tf = launch_ros.actions.Node( package='bringup', executable='odom2tf', output='screen' ) microros_agent = launch_ros.actions.Node( package='micro_ros_agent', executable='micro_ros_agent', arguments=[ 'serial', # 切换为串口模式 '-b', '115200', # 波特率参数(需字符串类型) '--dev', '/dev/ttyUSB1', # 设备路径 '-v6' # 日志详细级别 ], output='screen' # 保持终端输出可见 ) ydlidar = launch.actions.IncludeLaunchDescription( PythonLaunchDescriptionSource( [ydlidar_ros2_dir, '/launch', '/ydlidar_launch.py']), ) # 使用 TimerAction 启动后 5 秒执行 ydlidar 节点 ydlidar_delay = launch.actions.TimerAction(period=5.0, actions=[ydlidar]) return launch.LaunchDescription([ urdf2tf, odom2tf, microros_agent, ydlidar_delay ])
不知道是什么原因,该怎么修改呢?
后面单独运行这个ros2 launch ydlidar ydlidar_launch.py显示如下(上一章节显示点云成功了的)
li@ubantu:~/chapt9/microros_ws$ ros2 launch ydlidar ydlidar_launch.py
[INFO] [launch]: All log files can be found below /home/li/.ros/log/2025-04-15-01-32-03-185276-ubantu-4693
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [ydlidar_node-1]: process started with pid [4704]
[ydlidar_node-1] [INFO] [1744651923.991974545] [ydlidar_node]: [YDLIDAR INFO] Current ROS Driver Version: 1.0.1
[ydlidar_node-1]
[ydlidar_node-1] [2025-04-15 01:32:03][info] SDK initializing
[ydlidar_node-1] [2025-04-15 01:32:03][info] SDK has been initialized
[ydlidar_node-1] [2025-04-15 01:32:03][info] SDK Version: 1.2.9
[ydlidar_node-1] [2025-04-15 01:32:03][info] Connect elapsed time 6 ms
[ydlidar_node-1] [2025-04-15 01:32:03][info] Lidar successfully connected [/dev/ttyUSB1:115200]
[ydlidar_node-1] [2025-04-15 01:32:03][info] Lidar running correctly! The health status good
[ydlidar_node-1] [2025-04-15 01:32:03][info] Current Lidar Model Code 12
[ydlidar_node-1] [2025-04-15 01:32:03][info] Check status, Elapsed time 1 ms
[ydlidar_node-1] [2025-04-15 01:32:04][info] Lidar init success, Elapsed time [8]ms
[ydlidar_node-1] [2025-04-15 01:32:04][info] Start to getting intensity flag
[ydlidar_node-1] [2025-04-15 01:32:05][info] [YDLIDAR] End to getting intensity flag
[ydlidar_node-1] [2025-04-15 01:32:05][info] [YDLIDAR] Create thread 0xB9400640
[ydlidar_node-1] [2025-04-15 01:32:05][error] Check Sum 0xFA01 != 0x0520
[ydlidar_node-1] [2025-04-15 01:32:06][info] Successed to start scan mode, Elapsed time 2073 ms
[ydlidar_node-1] [2025-04-15 01:32:06][error] Timeout count: 1
[ydlidar_node-1] [2025-04-15 01:32:07][error] Timeout count: 2
[ydlidar_node-1] [2025-04-15 01:32:08][error] Timeout count: 3
[ydlidar_node-1] [2025-04-15 01:32:11][error] Timeout count: 1
[ydlidar_node-1] [2025-04-15 01:32:12][error] Timeout count: 2
[ydlidar_node-1] [2025-04-15 01:32:13][error] Timeout count: 3
[ydlidar_node-1] [2025-04-15 01:32:15][error] Timeout count: 1
[ydlidar_node-1] [2025-04-15 01:32:16][error] Failed to turn on the Lidar, because the lidar is [Device Failed].
[ydlidar_node-1] [INFO] [1744651936.529456617] [ydlidar_node]: [YDLIDAR INFO] Now YDLIDAR is stopping .......
[INFO] [ydlidar_node-1]: process has finished cleanly [pid 4704]
[ydlidar_node-1] -
@1117 为啥不成功建图··呢?然后有时候显示这个
-
@1117 在 9.5.5完成机器人导航并建图出现问题(使用串口进行连接,后面显示这个) 中说:
[ydlidar_node-5] [2025-04-15 01:28:36][error] Timeout count: 3
[ydlidar_node-5] [2025-04-15 01:28:38][error] Check Sum 0x202A != 0x6878
[ydlidar_node-5] [2025-04-15 01:28:39][error] Timeout count: 1
[ydlidar_node-5] [2025-04-15 01:28:40][error] Check Sum 0x6B1A != 0x7812
[ydlidar_node-5] [2025-04-15 01:28:40][error] Timeout count: 2
[ydlidar_node-5] [2025-04-15 01:28:41][error] Timeout count: 1
[ydlidar_node-5] [2025-04-15 01:28:42][error] Check Sum 0x5D90 != 0x02CD
[ydlidar_node-5] [2025-04-15 01:28:42][error] Timeout count: 2
[ydlidar_node-5] [2025-04-15 01:28:43][error] Timeout count: 3
[ydlidar_node-5] [2025-04-15 01:28:44][error] Failed to turn on the Lidar, because the lidar is [Device Failed].
[ydlidar_node-5] [INFO] [1744651724.497044306] [ydlidar_node]: [YDLIDAR INFO] Now YDLIDAR is stopping .......
[INFO] [ydlidar_node-5]: process has finished cleanly [pid 4652]像是雷达部分没有正常输出 /scan 话题
-
@1117 检查下网络连接,网络结构
-
@小鱼 有/scan话题,鱼哥
-
@小鱼 那我晚点儿再试试换一下网络,但是我是用树莓派4b通过串口和雷达转接板和esp控制板。鱼哥,应该怎么样才是正确的呢?我有点儿疑惑,比如说哪些要改,我这个改了
,然后雷达参数那边也是改了,然后有雷达话题,雷达数据可以可视化,但是我运行建图的时候找不到图,就像鱼哥你第九章倒数第二节的那个,就是没有,不知道什么原因唉,有点儿发愁
-
@1117 用树meipai就走串口模式驱动雷达吧
-
@小鱼 鱼哥·,我就是串口驱动雷达的,我wifi不行,但是无法建图就不知道是什么原因了,我是有点云数据的,可以在rviz2里面显示出来
-
@1117 主控板走串口模式需要提高波特率,115200 卡数据