ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question
1

rplidar driver installation problem on Ubuntu

asked 2014-12-15 19:43:11 -0600

casper911ca gravatar image

Apologies for posting here, but since robopeak's rplidar does not seem to have very much on the support side since it does appear to be R&D hardware. My ultimate goal here is to get RPLIDAR to work with rvis so I thought I would attempt as asking here.

I have attempted to get RPLIDAR to talk to Linuxmint 17 system and an Ubuntu 14.04 system. And when I run:

$ roslaunch rplidar_ros view_rplidar.launch

Error, cannot bind to the specified serial port /dev/ttyUSB0.

And the GUI warns:

No tf data.  Actual error: Fixed Frame [laser] does not exist

I believe the problem is that the USB to UART driver is installed with root permissions because I get the same error when I run the rplidar example program:

$ ./ultra_simple /dev/ttyUSB0
Error, cannot bind to the specified serial port /dev/ttyUSB0.

But it runs correctly when I run the above command under root:

$ sudo  ./ultra_simple /dev/ttyUSB0
   theta: 151.48 Dist: 00124.75 Q: 10 
   theta: 152.72 Dist: 00126.00 Q: 10 
   theta: 153.95 Dist: 00127.00 Q: 10 
   theta: 155.19 Dist: 00128.00 Q: 11 
   theta: 156.41 Dist: 00130.00 Q: 11 
   theta: 157.64 Dist: 00132.25 Q: 10 
   theta: 158.88 Dist: 00134.00 Q: 11 
   theta: 160.11 Dist: 00137.50 Q: 10 
   theta: 161.33 Dist: 00141.00 Q: 10

Is there way to install the driver without root permissions? Below is how I installed the driver:

$ cd Linux_3.x.x_VCP_Driver_Source
~/Linux_3.x.x_VCP_Driver_Source$ make
~/Linux_3.x.x_VCP_Driver_Source$ sudo cp cp210x.ko /lib/modules/3.13.0-43-generic/kernel/drivers/usb/serial/usbserial.ko
~/Linux_3.x.x_VCP_Driver_Source$ sudo insmod /lib/modules/3.13.0-43-generic/kernel/drivers/usb/serial/usbserial.ko
$insmod: ERROR: could not insert module /lib/modules/3.13.0-43-generic/kernel/drivers/usb/serial/usbserial.ko: File exists
$sudo insmod cp210x.ko

Can I do a simple chmod? Or is there a way to run ROS as root? When I run it with sudo it get 'command not found':

/catkin_ws$ sudo roslaunch rplidar_ros view_rplidar.launch
sudo: roslaunch: command not found

Thanks!

edit retag flag offensive close merge delete

6 Answers

Sort by » oldest newest most voted
3

answered 2014-12-16 05:42:05 -0600

mrsoft99 gravatar image

My understanding of the best way to handle this, is to add your userid to the 'dialout' group. The dialout group allows access to the serial ports.

You can do this with the following command. ${USER} will be interpreted as your current user name, but you could manually type in the username instead.

sudo gpasswd --add ${USER} dialout

You will have to logout and then log back in before the group change is recognized.

(I'm using rplidar with ubuntu 12.04 and ros hydro.)

edit flag offensive delete link more

Comments

1

sudo adduser $USER dialout is the more canonical way to do this.

tfoote gravatar image tfoote  ( 2015-03-03 01:25:13 -0600 )edit
3

answered 2014-12-17 02:48:40 -0600

tanghz gravatar image

A few days ago, I faced the same problem, too. And I solved the problem by the method below:

Go to the file directory:/etc/udev/rules.d/, and see whether it has the file named " 50-usb-serial.rules ", well, in my computer, there is no this file, thus I created the file, below is the steps:

  1. $ cd /etc/udev/rules.d/
  2. $ sudo touch 50-usb-serial.rules
  3. $ sudo gedit 50-usb-serial.rules

And in the file that is opened by the GEdit, write these words: KERNEL=="ttyUSB0", GROUP="turtlebot", MODE="0666" ( in these words, the word " turtlebot " is my user name)

some one told me that after this, I should run this command: " sudo /etc/init.d/udev restart " , but I did not run this command and it worked, too.

(sorry for my poor English, but I really hope that could help you )

edit flag offensive delete link more

Comments

Same problem but solved using this method. Thank you

Mathew12 gravatar image Mathew12  ( 2022-10-24 03:21:00 -0600 )edit
2

answered 2014-12-16 01:05:56 -0600

gvdhoorn gravatar image

updated 2014-12-16 05:58:33 -0600

Can I do a simple chmod? Or is there a way to run ROS as root? When I run it with sudo it get 'command not found':

No, you don't need to and you should never (well, never ..) do that. See Rosrun as super user (the accepted answer also explains how to solve your problem).


Edit:

[..] I believe the problem is that the USB to UART driver is installed with root permissions [..]

Under Linux, drivers are always installed as root (directly or via sudo), as that is the only user allowed to do that. The permissions of the device file (in your case /dev/ttyUSB0) can be configured separately.

edit flag offensive delete link more
1

answered 2016-01-03 23:27:49 -0600

YingHua gravatar image

hi , maybe try this command but you need to check the port everytime you replug.

sudo chmod 666 /dev/ttyUSB0

roslaunch rplidar_ros view_rplidar.launch

I made my note on blog . https://goo.gl/aKqSvo

And I have the same problem when I try the sample code of rplidar too. stiil not resolve.

edit flag offensive delete link more

Comments

I guess "sudo chmod 666 /dev/ttyUSB0" should be done every single time you restart you computer / terminal. correct me if i am wrong.

BhanuKiran.Chaluvadi gravatar image BhanuKiran.Chaluvadi  ( 2018-04-12 03:06:09 -0600 )edit
0

answered 2015-01-14 17:25:54 -0600

casper911ca gravatar image

updated 2015-01-14 17:26:20 -0600

Thanks everyone. Adding my user to the dialout group worked perfectly. I discovered that the sensor is renamed each time it is unplugged and plugged back in, which was part of my problem (ie - instead of ttyUSB0 it became ttyUSB1).

I still seem to get the

No tf data.  Actual error: Fixed Frame [laser] does not exist

I do not know what I need to do to my .launch file to correct this. I can get realtime data, as in it publishes data, but I don't know what to do about this error.

edit flag offensive delete link more

Comments

Sorry to hear that. But I have the same problem, too. And to avoid this, every time after turned my computer on, I will plugged the rplidar in first.

And the second, I think the reason is that the value of the frame_id is not "laser", open the rplidar.launch, and check frame_id.

tanghz gravatar image tanghz  ( 2015-01-18 18:55:05 -0600 )edit

renamed ??

tanghz gravatar image tanghz  ( 2015-01-19 06:29:35 -0600 )edit
0

answered 2016-01-03 01:51:02 -0600

dchang0 gravatar image

updated 2016-01-03 01:52:42 -0600

This reply is very late, but the solution to:

"I discovered that the sensor is renamed each time it is unplugged and plugged back in, which was part of my problem (ie - instead of ttyUSB0 it became ttyUSB1)."

Can be found here in step 1.2. The code listed is for the FTDI and XV-11, so you would have to modify the specific values to make it work with RPLIDAR. Also, be sure to add the MODE=="0666" to the code so that it always creates the device link with 666 permissions.

http://wiki.ros.org/xv_11_laser_drive...

edit flag offensive delete link more

Question Tools

Stats

Asked: 2014-12-15 19:43:11 -0600

Seen: 19,833 times

Last updated: Jan 03 '16