I successfully install and run examples from YDLidar_SDK and ydlidar_launch.py in ydlidar_ros2_driver, but I got error when I run the ydlidar_launch_view.py.
The output:
[INFO] [ydlidar_ros2_driver_node-1]: process started with pid [98526]
[INFO] [static_transform_publisher-2]: process started with pid [98528]
[INFO] [ydlidar_ros2_driver_node-1]: sending signal 'SIGINT' to process[ydlidar_ros2_driver_node-1]
[ydlidar_ros2_driver_node-1] YDLidar SDK initializing
[ydlidar_ros2_driver_node-1] YDLidar SDK has been initialized
[ydlidar_ros2_driver_node-1] [YDLIDAR]:SDK Version: 1.0.3
[ydlidar_ros2_driver_node-1] LiDAR successfully connected
[ydlidar_ros2_driver_node-1] [YDLIDAR]:Lidar running correctly ! The health status: good
[ydlidar_ros2_driver_node-1] [YDLIDAR] Connection established in [/dev/ttyACM0][230400]:
[ydlidar_ros2_driver_node-1] Firmware version: 2.12
[ydlidar_ros2_driver_node-1] Hardware version: 2
[ydlidar_ros2_driver_node-1] Model: G4
[ydlidar_ros2_driver_node-1] Serial: 2018052300000036
[ydlidar_ros2_driver_node-1] [YDLIDAR INFO] Current Scan Frequency: 10.000000Hz
[ydlidar_ros2_driver_node-1] LiDAR init success!
[ydlidar_ros2_driver_node-1] [INFO] [1628759984.906625355] [ydlidar_ros2_driver_node]: [YDLIDAR INFO] Current ROS Driver Version: 1.0.1
[ydlidar_ros2_driver_node-1]
[static_transform_publisher-2] [INFO] [1628759984.909083192] [static_tf_pub_laser]: Spinning until killed publishing transform from 'base_link' to 'laser_frame'
[ydlidar_ros2_driver_node-1] [YDLIDAR3]:Fixed Size: 909
[ydlidar_ros2_driver_node-1] [YDLIDAR3]:Sample Rate: 9K
[ydlidar_ros2_driver_node-1] [YDLIDAR INFO] Current Sampling Rate : 9K
[ydlidar_ros2_driver_node-1] [YDLIDAR INFO] Now YDLIDAR is scanning ......
[ydlidar_ros2_driver_node-1] terminate called after throwing an instance of 'rclcpp::exceptions::RCLError'
[ydlidar_ros2_driver_node-1] what(): could not create publisher: rcl node's context is invalid, at /tmp/binarydeb/ros-foxy-rcl-1.1.11/src/rcl/node.c:441
[ERROR] [ydlidar_ros2_driver_node-1]: process has died [pid 98526, exit code -6, cmd '/home/user/ydlidar_ros2_ws/install/ydlidar_ros2_driver/lib/ydlidar_ros2_driver/ydlidar_ros2_driver_node --ros-args -r node:=ydlidar_ros2_driver_node -r __ns:=/ --params-file /home/user/ydlidar_ros2_ws/install/ydlidar_ros2_driver/share/ydlidar_ros2_driver/params/ydlidar.yaml'].
[ERROR] [static_transform_publisher-2]: process[static_transform_publisher-2] failed to terminate '5' seconds after receiving 'SIGINT', escalating to 'SIGTERM'
[INFO] [static_transform_publisher-2]: sending signal 'SIGTERM' to process[static_transform_publisher-2]
[ERROR] [static_transform_publisher-2]: process has died [pid 98528, exit code -15, cmd '/home/user/ros2_foxy/install/tf2_ros/lib/tf2_ros/static_transform_publisher 0 0 0.02 0 0 0 1 base_link laser_frame --ros-args -r node:=static_tf_pub_laser -r __node:=static_tf_pub_laser'].
Which stopped and shows the " terminate called after throwing an instance of 'rclcpp::exceptions::RCLError' ".
I successfully install and run examples from YDLidar_SDK and ydlidar_launch.py in ydlidar_ros2_driver, but I got error when I run the ydlidar_launch_view.py.
The output:
[INFO] [ydlidar_ros2_driver_node-1]: process started with pid [98526] [INFO] [static_transform_publisher-2]: process started with pid [98528] [INFO] [ydlidar_ros2_driver_node-1]: sending signal 'SIGINT' to process[ydlidar_ros2_driver_node-1] [ydlidar_ros2_driver_node-1] YDLidar SDK initializing [ydlidar_ros2_driver_node-1] YDLidar SDK has been initialized [ydlidar_ros2_driver_node-1] [YDLIDAR]:SDK Version: 1.0.3 [ydlidar_ros2_driver_node-1] LiDAR successfully connected [ydlidar_ros2_driver_node-1] [YDLIDAR]:Lidar running correctly ! The health status: good [ydlidar_ros2_driver_node-1] [YDLIDAR] Connection established in [/dev/ttyACM0][230400]: [ydlidar_ros2_driver_node-1] Firmware version: 2.12 [ydlidar_ros2_driver_node-1] Hardware version: 2 [ydlidar_ros2_driver_node-1] Model: G4 [ydlidar_ros2_driver_node-1] Serial: 2018052300000036 [ydlidar_ros2_driver_node-1] [YDLIDAR INFO] Current Scan Frequency: 10.000000Hz [ydlidar_ros2_driver_node-1] LiDAR init success! [ydlidar_ros2_driver_node-1] [INFO] [1628759984.906625355] [ydlidar_ros2_driver_node]: [YDLIDAR INFO] Current ROS Driver Version: 1.0.1 [ydlidar_ros2_driver_node-1] [static_transform_publisher-2] [INFO] [1628759984.909083192] [static_tf_pub_laser]: Spinning until killed publishing transform from 'base_link' to 'laser_frame'
[ydlidar_ros2_driver_node-1] [YDLIDAR3]:Fixed Size: 909 [ydlidar_ros2_driver_node-1] [YDLIDAR3]:Sample Rate: 9K [ydlidar_ros2_driver_node-1] [YDLIDAR INFO] Current Sampling Rate : 9K [ydlidar_ros2_driver_node-1] [YDLIDAR INFO] Now YDLIDAR is scanning ...... [ydlidar_ros2_driver_node-1] terminate called after throwing an instance of 'rclcpp::exceptions::RCLError' [ydlidar_ros2_driver_node-1] what(): could not create publisher: rcl node's context is invalid, at /tmp/binarydeb/ros-foxy-rcl-1.1.11/src/rcl/node.c:441 [ERROR] [ydlidar_ros2_driver_node-1]: process has died [pid 98526, exit code -6, cmd '/home/user/ydlidar_ros2_ws/install/ydlidar_ros2_driver/lib/ydlidar_ros2_driver/ydlidar_ros2_driver_node --ros-args -r node:=ydlidar_ros2_driver_node -r __ns:=/ --params-file /home/user/ydlidar_ros2_ws/install/ydlidar_ros2_driver/share/ydlidar_ros2_driver/params/ydlidar.yaml']. [ERROR] [static_transform_publisher-2]: process[static_transform_publisher-2] failed to terminate '5' seconds after receiving 'SIGINT', escalating to 'SIGTERM' [INFO] [static_transform_publisher-2]: sending signal 'SIGTERM' to process[static_transform_publisher-2] [ERROR] [static_transform_publisher-2]: process has died [pid 98528, exit code -15, cmd '/home/user/ros2_foxy/install/tf2_ros/lib/tf2_ros/static_transform_publisher 0 0 0.02 0 0 0 1 base_link laser_frame --ros-args -r node:=static_tf_pub_laser -r __node:=static_tf_pub_laser'].
Which stopped and shows the " terminate called after throwing an instance of 'rclcpp::exceptions::RCLError' ".
I am using Ubuntu 20.04, Ros2 Foxy