Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error when launching python code. #2

Open
Kristian181 opened this issue Nov 17, 2022 · 4 comments
Open

Error when launching python code. #2

Kristian181 opened this issue Nov 17, 2022 · 4 comments
Labels
documentation Improvements or additions to documentation

Comments

@Kristian181
Copy link

After the command "ros2 launch ldlidar_stl_ros2 ld19.launch.py" I recieved the following error:

[INFO] [launch]: All log files can be found below /home/ditmar/.ros/log/2022-11-17-10-38-42-823400-ditmar-VirtualBox-3613
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [ldlidar_stl_ros2_node-1]: process started with pid [3614]
[INFO] [static_transform_publisher-2]: process started with pid [3616]
[static_transform_publisher-2] [WARN] [1668677924.187515024] []: Old-style arguments are deprecated; see --help for new-style arguments
[ldlidar_stl_ros2_node-1] [INFO] [1668677924.433554313] [LD19]: LDLiDAR SDK Pack Version is: v3.0.3
[ldlidar_stl_ros2_node-1] [INFO] [1668677924.434860673] [LD19]: <product_name>: LDLiDAR_LD19
[ldlidar_stl_ros2_node-1] [INFO] [1668677924.435963707] [LD19]: <topic_name>: scan
[ldlidar_stl_ros2_node-1] [INFO] [1668677924.436106027] [LD19]: <frame_id>: base_laser
[ldlidar_stl_ros2_node-1] [INFO] [1668677924.436180008] [LD19]: <port_name>: /dev/ttyUSB0
[ldlidar_stl_ros2_node-1] [INFO] [1668677924.436199364] [LD19]: <port_baudrate>: 230400
[ldlidar_stl_ros2_node-1] [INFO] [1668677924.436209824] [LD19]: <laser_scan_dir>: Counterclockwise
[ldlidar_stl_ros2_node-1] [INFO] [1668677924.436219813] [LD19]: <enable_angle_crop_func>: false
[ldlidar_stl_ros2_node-1] [INFO] [1668677924.436229702] [LD19]: <angle_crop_min>: 135.000000
[ldlidar_stl_ros2_node-1] [INFO] [1668677924.436245783] [LD19]: <angle_crop_max>: 225.000000
[ldlidar_stl_ros2_node-1] [ERROR] [1668677924.436360430] [LD19]: ldlidar node start is fail
[static_transform_publisher-2] [INFO] [1668677924.503143437] [base_link_to_base_laser_ld19]: Spinning until stopped - publishing transform
[static_transform_publisher-2] translation: ('0.000000', '0.000000', '0.180000')
[static_transform_publisher-2] rotation: ('0.000000', '0.000000', '0.000000', '1.000000')
[static_transform_publisher-2] from 'base_link' to 'base_laser'
[ldlidar_stl_ros2_node-1] [LDS][ERROR][Thu Nov 17 10:38:44 2022][/home/ditmar/ldlidar_ros2_ws/src/ldlidar_stl_ros2/ldlidar_driver/src/serialcom/serial_interface_linux.cpp][Open][41][Open open error,Permission denied]
[ldlidar_stl_ros2_node-1] [LDS][ERROR][Thu Nov 17 10:38:44 2022][/home/ditmar/ldlidar_ros2_ws/src/ldlidar_stl_ros2/ldlidar_driver/src/core/ldlidar_driver.cpp][Start][90][serial is not open:/dev/ttyUSB0]
[ERROR] [ldlidar_stl_ros2_node-1]: process has died [pid 3614, exit code 1, cmd '/home/ditmar/ldlidar_ros2_ws/install/ldlidar_stl_ros2/lib/ldlidar_stl_ros2/ldlidar_stl_ros2_node --ros-args -r __node:=LD19 --params-file /tmp/launch_params_02h4cjfi --params-file /tmp/launch_params_4p_xhzqx --params-file /tmp/launch_params_crh_pjiy --params-file /tmp/launch_params_d3w9fnwj --params-file /tmp/launch_params_ed2i03x1 --params-file /tmp/launch_params_xthq6i0l --params-file /tmp/launch_params_kcwvvbzd --params-file /tmp/launch_params_3_0jvih8 --params-file /tmp/launch_params_taoamxlv'].

Currently using ubuntu version: Ubuntu 22.04.1 LTS
I'm also using Oracle Virtual Machine to run Ubuntu.

I hope somone can help me with this problem.

@ldrobotsensor
Copy link
Member

ldrobotsensor commented Nov 17, 2022

Set the -x permission for the serial port device mounted by the lidar in the system:
sudo chmod 777 /dev/ttyUSB*
@Kristian181

@Kristian181
Copy link
Author

Thanks for the quick response!

The sudo chmod 777 /dev/ttyUSB* seems to have fixed the permission problem.
But after the following text it stops printing.

ditmar@ditmar-VirtualBox:~/ldlidar_ros2_ws$ ros2 launch ldlidar_stl_ros2 ld19.launch.py
[INFO] [launch]: All log files can be found below /home/ditmar/.ros/log/2022-11-17-12-21-39-380464-ditmar-VirtualBox-5986
[INFO] [launch]: Default logging verbosity is set to INFO
[INFO] [ldlidar_stl_ros2_node-1]: process started with pid [5987]
[INFO] [static_transform_publisher-2]: process started with pid [5989]
[static_transform_publisher-2] [WARN] [1668684099.539221234] []: Old-style arguments are deprecated; see --help for new-style arguments
[static_transform_publisher-2] [INFO] [1668684099.581556904] [base_link_to_base_laser_ld19]: Spinning until stopped - publishing transform
[static_transform_publisher-2] translation: ('0.000000', '0.000000', '0.180000')
[static_transform_publisher-2] rotation: ('0.000000', '0.000000', '0.000000', '1.000000')
[static_transform_publisher-2] from 'base_link' to 'base_laser'
[ldlidar_stl_ros2_node-1] [INFO] [1668684099.611595903] [LD19]: LDLiDAR SDK Pack Version is: v3.0.3
[ldlidar_stl_ros2_node-1] [INFO] [1668684099.612532324] [LD19]: <product_name>: LDLiDAR_LD19
[ldlidar_stl_ros2_node-1] [INFO] [1668684099.613199108] [LD19]: <topic_name>: scan
[ldlidar_stl_ros2_node-1] [INFO] [1668684099.613551183] [LD19]: <frame_id>: base_laser
[ldlidar_stl_ros2_node-1] [INFO] [1668684099.613906238] [LD19]: <port_name>: /dev/ttyUSB0
[ldlidar_stl_ros2_node-1] [INFO] [1668684099.614215534] [LD19]: <port_baudrate>: 230400
[ldlidar_stl_ros2_node-1] [INFO] [1668684099.614502757] [LD19]: <laser_scan_dir>: Counterclockwise
[ldlidar_stl_ros2_node-1] [INFO] [1668684099.614756829] [LD19]: <enable_angle_crop_func>: false
[ldlidar_stl_ros2_node-1] [INFO] [1668684099.615068479] [LD19]: <angle_crop_min>: 135.000000
[ldlidar_stl_ros2_node-1] [INFO] [1668684099.615259426] [LD19]: <angle_crop_max>: 225.000000
[ldlidar_stl_ros2_node-1] [INFO] [1668684100.083317173] [LD19]: ldlidar node start is success
[ldlidar_stl_ros2_node-1] [INFO] [1668684100.110435328] [LD19]: ldlidar communication is normal.
[ldlidar_stl_ros2_node-1] [INFO] [1668684100.116253038] [LD19]: Publish topic message:ldlidar scan data.

Also the /scan doesn't show up in the ros2 topic list.

ditmar@ditmar-VirtualBox:~$ ros2 topic list
/parameter_events
/rosout

@Kristian181
Copy link
Author

It works now, after a second time the /scan did show up.
I am now able to vizualize the data from the lidar in rviz2.

I want to use the lidar to detect obstacles on a modol car.
Is ther a way to print/obtain the "raw data" like Distance, Start angle and End angle?
So I can use the data in code.

@ldrobotsensor
Copy link
Member

@Kristian181 Refer to the following:
https://github.com/ldrobotSensorTeam/ldlidar_stl_sdk/blob/master/src/linux_demo/demo.cpp

 case ldlidar::LidarStatus::NORMAL: 
        ldlidarnode->GetLidarScanFreq(lidar_scan_freq);
        ToLaserscanMessagePublish(laser_scan_points, lidar_scan_freq, setting, node, publisher);

         RCLCPP_ERROR(node->get_logger(),"speed(Hz):%f,size:%d,angle_front:%f, angle_back:%f",
  lidar_scan_freq, laser_scan_points.size(), laser_scan_points.front().angle, laser_scan_points.back().angle);

       //  output 2d point cloud data
      for (auto point : laser_scan_points) {
        RCLCPP_ERROR(node->get_logger(),"angle:%f,distance(mm):%d,intensity:%d", 
           point.angle, point.distance, point.intensity);
       }
       break;

@ldrobotsensor ldrobotsensor added the documentation Improvements or additions to documentation label Nov 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants