0
$\begingroup$

Rosanswers logo

Hello Everyone.

I have installed ROS noetic on both Pi 3 and my workstation. The target is to send Lidar data over to workstation where I will visualize it via Rviz.

The issue is: the lidar works fine when connected to laptop; however when I connect it to pi and run the following: roslaunch rplidar_ros rplidar.launch

Here is the rplidar.launch file:

<launch>
    <node name="rplidarNode"          pkg="rplidar_ros"  type="rplidarNode" output="screen">
    <param name="serial_port"         type="string" value="/dev/ttyUSB0"/>
    <param name="serial_baudrate"     type="int"    value="115200"/><!--A1/A2 -->
    <!--param name="serial_baudrate"     type="int"    value="256000"--><!--A3 -->
    <param name="frame_id"            type="string" value="laser"/> 
    <param name="inverted"            type="bool"   value="false"/> 
    <param name="angle_compensate"    type="bool"   value="true"/> 
    </node>
</launch>

here is the output of lsusb:

Bus 001 Device 005: ID 10c4:ea60 Silicon Labs CP210x UART Bridge
Bus 001 Device 003: ID 0424:ec00 Microchip Technology, Inc. (formerly SMSC) SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Microchip Technology, Inc. (formerly SMSC) SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

I get this:

"[ERROR] [1683048712.103957025]: Error, operation time out. RESULT_OPERATION_TIMEOUT! [rplidarNode-1] process has died [pid 3196, exit code 255, cmd /home/ubuntu/catkin_ws/devel/lib/rplidar_ros/rplidarNode __name:=rplidarNode __log:=/home/ubuntu/.ros/log/690e8cb0-e90e-11ed-8367-b827ebea13cf/rplidarNode-1.log]. log file: /home/ubuntu/.ros/log/690e8cb0-e90e-11ed-8367-b827ebea13cf/rplidarNode-1*.log"

Sometimes I get this:

"[ERROR] [1683050360.490752221]: Error, cannot retrieve rplidar health code: 80008002 [rplidarNode-1] process has died [pid 1607, exit code 255, cmd /home/ubuntu/catkin_ws/devel/lib/rplidar_ros/rplidarNode __name:=rplidarNode __log:=/home/ubuntu/.ros/log/0aea9212-e910-11ed-a08d-69187ab6f95b/rplidarNode-1.log]. log file: /home/ubuntu/.ros/log/0aea9212-e910-11ed-a08d-69187ab6f95b/rplidarNode-1*.log "

Note: The pi and workstation are connected as I can see a list of topics on my workstation. I have sourced the environment as well.

I do not know where is the issue. I have tried my best. Please help.


Originally posted by kowais915 on ROS Answers with karma: 3 on 2023-05-02

Post score: 0


Original comments

Comment by Mike Scheutzow on 2023-05-03:
What serial device name is the rplidar using on your raspberry pi? Here is what mine looks like:

$ ls -ld /dev/rp* /dev/ttyUSB*
lrwxrwxrwx 1 root root         7 Apr 20 14:52 /dev/rplidar -> ttyUSB0
crw-rw---- 1 root dialout 188, 0 Apr 20 14:52 /dev/ttyUSB0

Comment by kowais915 on 2023-05-04:
Mine is ttyUSB0 too. I have given all the rwx permissions too. I tried powering the pi using a powerbank as well but I am still getting the same error.

Comment by Mike Scheutzow on 2023-05-04:
Which machine are you running that roslaunch command on?

Comment by kowais915 on 2023-05-04:
The lidar is connected to raspberry pi 3 Model B+ that has ROS noetic installed. I have connected to the pi via ssh from another machine that has ROS noetic running as well. I have installed Ubuntu 20.04 via WSL2.

So I am technically running the roslaunch command on PI but via SSH on another machine.

I have been searching for everything. At this point, I am so frustrated.

Comment by Mike Scheutzow on 2023-05-04:
Using ssh in that way should be fine. The error message indicates that your ros node (rplidarNode) finds some device on the serial port, but the node is either unable to read from the device, or the values do not match the rplidar model it is looking for.

Please edit your description and copy/paste the output of the lsusb command (please do not give me a screenshot.) You edit using the "edit" button near the end of the description.

Comment by kowais915 on 2023-05-04:
Thank you so much already for help. I have added the output to the description please check.

Furthermore, I only get the first error message now: The TImeout Error.

"[ERROR] [1683048712.103957025]: Error, operation time out. RESULT_OPERATION_TIMEOUT! [rplidarNode-1] process has died [pid 3196, exit code 255, cmd /home/ubuntu/catkin_ws/devel/lib/rplidar_ros/rplidarNode __name:=rplidarNode __log:=/home/ubuntu/.ros/log/690e8cb0-e90e-11ed-8367-b827ebea13cf/rplidarNode-1.log]. log file: /home/ubuntu/.ros/log/690e8cb0-e90e-11ed-8367-b827ebea13cf/rplidarNode-1*.log"

Comment by Mike Scheutzow on 2023-05-04:\

Silicon Labs CP210x UART Bridge

This is the expected usb device label for an rplidar, so this line looks good. You will get a timeout error if something else already has the /dev/ttyUSB0 device open. Could you be launching the ros node twice?

Please edit your description and show us your complete rplidar launch file. To preserve newlines, highlight all the new text and format it by clicking the 101010 button once.

Comment by Mike Scheutzow on 2023-05-04:
In your systemd journal, do you find a line similar to this? Do a search for: ttyUSB0

Apr 20 14:52:49 batmobile kernel: usb 1-5: cp210x converter now attached to ttyUSB0

Comment by kowais915 on 2023-05-04:
When I ran ls -l /dev/ttyUSB*

It returned the following:

crwxrwxrwx 1 root dialout 188, 0 May  4 14:52 /dev/ttyUSB0

Comment by kowais915 on 2023-05-04:
I have updated the description with rplidar.launch file. Please have a look. I don't I am running it twice since there is no topic listed related to rplidar when I run rostopic list

Comment by Mike Scheutzow on 2023-05-04:\

I have updated the description with rplidar.launch file

Your launch file looks OK to me. Please tell me if your systemd journal has that line (3 comments up.) Run the command:

sudo journalctl -b 0 | grep ttyUSB0

Comment by kowais915 on 2023-05-04:
Yes, it does have that line:

May 04 11:14:28 bee kernel: usb 1-1.5: cp210x converter now attached to ttyUSB0                                         May 04 14:51:47 bee kernel: cp210x ttyUSB0: cp210x converter now disconnected from ttyUSB0                              May 04 14:52:02 bee kernel: usb 1-1.3: cp210x converter now attached to ttyUSB0                                         May 04 16:30:09 bee sudo[1608]:   ubuntu : TTY=pts/0 ; PWD=/home/ubuntu ; USER=root ; COMMAND=/usr/bin/chmod 777 /dev/ttyUSB0

Comment by kowais915 on 2023-05-04:
Just tried plugging it out and then in again. From the output of the command you sent above, it seems that the lidar is attached to ttyUSB0:

May 04 17:22:07 bee kernel: usb 1-1.5: cp210x converter now attached to ttyUSB0

Comment by Mike Scheutzow on 2023-05-04:
OK, good. We are running out of things to investigate here.

Are you using an separate usb hub? If so, is it a powered hub (i.e. has its own separate power input)?

Comment by kowais915 on 2023-05-04:
I just tried powering the pi using another cable and 20000mah power bank and it worked!!! I can see the scan data on my workstation which is great!!!!

Now, the issue is that I am having trouble visualizing through Rviz. I added a laserScan visualization type. There are green checks in front of Topic, Points but there is an error in front of Transform [sender=unknown_publisher].

I ran the following command but when I did so the terminal did not output anything, the cursor just keeps on blinking.

rosrun tf static_transform_publisher 0 0 0 0 0 0 world laser 100

Comment by Mike Scheutzow on 2023-05-04:
It's normal for static_transform_publisher to not print anything to stdout. As a test, in rviz, try setting your "Fixed Frame" to "laser". Once that works, you can change it to "world" (which should be listed.)

To see the scan outline more easily, you should increase the "dot" size (point size?) in the laserScan plugin. You also need to make sure that both machines have an accurate time-of-day clock, because rviz will discard stale data.

Comment by kowais915 on 2023-05-04:
Thank you so much @Mike Scheutzow. It seems like the problem was the cable. Now that my pi is powered up correctly it works. I have made my way through the hector slam where I have encountered another issue. If possible, I would very much appreciate your help. I am making another post for that issue.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

Based on our discussion in the comments, it seems like your configuration was all good.

It may be that the power supply for the raspberry pi was undersized. If you find that the rplidar startup is still unreliable, you should try 1) using a powered usb hub, or 2) to plug the rplidar directly into the raspberry pi board (so it doesn't have to share power with another device.)


Originally posted by Mike Scheutzow with karma: 4903 on 2023-05-04

This answer was ACCEPTED on the original site

Post score: 0

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.