Include RPLidar A1M8 in ROS

Hello,

I do not know English, Linux or ROS. Have a TURTLEBOT3 Waffle Pi with defective laser. Since the original laser is currently hard to get, I bought a “RPLidar A1M8 360-degree laser scanner”. The accuracy values at the same price were just too convincing.

I use „Linux Ubuntu 20.04.4.LTS“

/rosdistro: noetic

/rosversion: 1.15.14

1st question: “Which ROS version am I using?”, or better asked: “How can I find out if I am using ROS or ROS2?”

Currently I have downloaded the package for ROS. The README.md contained there wants from me:

How to build rplidar ros package

  1. Clone this project to your catkin’s workspace src folder
  2. Running catkin_make to build rplidarNode and rplidarNodeClient

How to run rplidar ros package

There’re two ways to run rplidar ros package

I. Run rplidar node and view in the rviz

roslaunch rplidar_ros view_rplidar.launch (for RPLIDAR A1/A2)

You should see rplidar’s scan result in the rviz.

II. Run rplidar node and view using test application

roslaunch rplidar_ros rplidar.launch (for RPLIDAR A1/A2)

rosrun rplidar_ros rplidarNodeClient

You should see rplidar’s scan result in the console

Regarding point 1) If I understand correctly, I should copy the contents of the ZIP file into the catkin working directory src.

2nd question: Where is the src directory? Or is the directory /usr/src meant?
After all, there are more directories with the name scr.

3rd question: to point 2) Next I should do what? Just catkin_make without parameters? And then will rplidarNode and rplidarNodeClient be created or are these the parameters for catkin_make ?

4th question: ``bash ???. I guess I am supposed to be in a directory where a certain bash file is located. And please, which directory ?

For better understanding of me. I have been developing medical devices for many years. In hard- and software. I am now retired and have very little knowledge of English and have never worked with Linux or ROS. However, I have used controllers from Atmel for the medical devices and programmed in assembler. Currently I am creating a program for a company in Python3 for the TurtleBot3. It is supposed to bring a measuring device to the measuring positions in a clean room environment and initiate the measurements. So I definitely have various programming experiences. I use ROS only as a device driver. I know, every ROS-friend’s stomach turns now. But please understand one thing: “It makes no sense for me to invest much time in ROS now. But it is easy for me to implement the navigation in a programming language I know. Only without laser I can continue badly.”

Thanks for Answer
citkid

Hello @citkid and welcome to the RobotShop forum,

1st question: “Which ROS version am I using?”

ROS Noetic is ROS1

“How can I find out if I am using ROS or ROS2?”

You can find ROS1 distributions here:
http://wiki.ros.org/Distributions

And ROS2 distributions here:
https://docs.ros.org/en/rolling/Releases.html

Where is the src directory? Or is the directory /usr/src meant? Next I should do what ? bash ???.

Create a new folder with a name related to the package (i.e. rplidar_pck)
Inside that create a src folder and paste the contents of the ZIP file.

Open the command line in the main folder (rplidar_pck)
Source your environment (source /opt/ros/noetic/setup.bash)
run catkin_make (this will build any catkin projects found in the src folder and it will create some new folders like Install)
Once that’s done you might need to source the package and then you can use the launch commands they mentioned in the README.

PS: If you are a beginner I strongly recommend checking ROS basic tutorials:
http://wiki.ros.org/ROS/Tutorials

Or at least this one:
http://wiki.ros.org/ROS/Tutorials/BuildingPackages

I hope that helps! :slight_smile:

1 Like

Thank you very much for your support.

I have to admit a mistake on my part right at the beginning. I had entered the data of my PC and not of the robot. So I don’t have a noetic but a kinetic. But thanks to your links I could see that kinetic is even older and therefore still only ROS.

I was able to follow the installation process and did not see any error. Unfortunately rviz does not work for me. In rviz there is an error message which I am not able to fix for the known reasons: “Global Status: Error” “Fixed Frame = Unknow frame map”.

But in rviz I can add the laser under and get “Topic = OK”. There is a check mark at Topic and Points. But behind Points there is no message, so no OK or Error.
I tried it with rqt and get the old hint that the laser does not provide usable data.
This raises the question for me: “Is the installation of the old laser still in ROS? Possibly in preferential use, so that I still communicate with the old laser?”, or “Was the data of the old laser overwritten with the new installation?”.

So now I tried the lines in the readme for my laser. Only I don’t know what to do with ``bash and so I ignored it.
Input: roslaunch rplidar_ros view_rplidar.lunch
Output: RLException: [view_rplidar.lunch] is neither a launch file in package [rplidar_ros] nor is [rplidar_ros] a launch file name

The 2nd position does not work either:
Input: roslaunch rplidar_ros rplidar.lunch
Output: RLException: [rplidar.lunch] is neither a launch file in package [rplidar_ros] nor is [rplidar_ros] a launch file name

Now I found out that the folder is not called rplidar_ros but rplidar_ros-master.
So I renamed the folder to “rplidar_ros” and entered the whole thing again:
Input: source /opt/ros/kinetic/setup.bash
Input: catkin_make
Output: looked good again.

Now again:
Input: roslaunch rplidar_ros view_rplidar.launch
Output: [view_rplidar.launch] is neither a launch file in package [rplidar_ros] nor is [rplidar_ros] a launch file name

But in the rplidar_ros /launch directory there is a file “view_rplidar.launch”.

The same here:
Input: roslaunch rplidar_ros rplidar.launch
Output: [rplidar.launch] is neither a launch file in package [rplidar_ros] nor is [rplidar_ros] a launch file name.

This file is also in the launch directory

And as expected, I can’t read the laser data in my Python program.

You write nicely, I should try it with ROS/Tutorials - ROS Wiki. If, like me, you have a robot that is supposed to have driven one meter under ROS and in reality drives 1.2 meters. I asked the question: “where can I find the possibility to adjust the wheel diameter?” and received the answer, “no idea”, then one does not have to wonder that I have terminated the friendship with ROS.
I would also like to reset the gyro so that it stops wandering again. But I don’t dare to ask this question, because I expect the same answer: “no idea”. A gyro is only stable when it is not moved, for example, when it is switched on. Unfortunately the gyro starts to run after a certain time ( ≥ 2minutes). So it would make sense to reset the gyro e.g. every 2 minutes.

Thank you very much for answering my questions.
citkid

In rviz there is an error message which I am not able to fix for the known reasons: “Global Status: Error” “Fixed Frame = Unknow frame map”.

Try changing the frame, you can try world or maybe base_link.

“Is the installation of the old laser still in ROS? Possibly in preferential use, so that I still communicate with the old laser?”, or “Was the data of the old laser overwritten with the new installation?”.

I’m not sure what you mean by this. I guess you have tried installing it a few times and you are confused about what you are actually using. Is that the case?

Only I don’t know what to do with ``bash and so I ignored it.
Input: roslaunch rplidar_ros view_rplidar.lunch

Not sure what you are referring to here but I will assume you probably are talking about the step of sourcing your workspace. Try running this command after you build:

source install/setup.bash

Also, you have a typo there, it shouldn’t be “lunch” it is probably breakfast :laughing: lol jk, it is probably “launch”

Now I found out that the folder is not called rplidar_ros but rplidar_ros-master.
So I renamed the folder to “rplidar_ros” and entered the whole thing again:

That shouldn’t matter, the important thing is the name of the package, not the folder.

However, looks like you are forgetting a important step: sourcing your workspace

I asked the question: “where can I find the possibility to adjust the wheel diameter?”

My guess would be in the robot description, try looking for the URDF or xacro file, and look for the wheel radius.

I would also like to reset the gyro so that it stops wandering again.

Unfortunately, I won’t be able to help with this but maybe you can find something useful here:
http://wiki.ros.org/turtlebot_calibration/Tutorials/Calibrate%20Odometry%20and%20Gyro

Regards

1 Like

My comment was probably not translated well. I will try to provide clarification.

Try changing the frame, you can try world or maybe base_link.

I need specific instructions. Unfortunately, hints do not help me. To my excuse: I have not dealt with the program so far, because I could not see any use for me. Also, I would have to fix a bug first (without knowing how) to be able to see different functions of a robot without it seeming useful for my program.

I’m not sure what you mean by this. I guess you have tried installing it a few times and you are confused about what you are actually using. Is that the case?

The robot is a “TurtleBot3 Waffle Pi”. The laser is defective and has now been replaced by me with a “RPLidar A1M8”. So the question is about software remnants from the origin laser. There is only info for installation, but no info if you have to remove the entries from the old laser. I didn’t remove anything, just installed it. Is that ok?

The following has been lost in translation. The readme says:

‘’'bash
roslaunch rplidar_ros view_rplidar.launch (for RPLIDAR A1/A2)

and

‘’'bash
roslaunch rplidar_ros rplidar.launch (for RPLIDAR A1/A2)

What does it stand for: " ’ ’ ’ bash"? Without"" and space

Input: roslaunch rplidar_ros view_rplidar.lunch

Was a typo from me: lunch = launch
Input: roslaunch rplidar_ros view_rplidar.launch

That shouldn’t matter, the important thing is the name of the package, not the folder.

Not quite correct. The error messages are different depending on the folder name.

However, looks like you are forgetting a important step: sourcing your workspace

I ran “source /opt/ros/kinetic/setup.bash” in the “rplidar_pck” directory. There was no feedback. Also no error message.

My guess would be in the robot description, try looking for the URDF or xacro file, and look for the wheel radius.

Found an estimated 50 files with URDF or/and xacro. Should I search them all for radius? Is there a command in Linux to check the contents of all files for radius?

turtlebot_calibration/Tutorials/Calibrate Odometry and Gyro - ROS Wiki

I was already there. Unfortunately, you can only get the gyro to really use 360°degrees for one rotation. The wandering can not be fixed with this. Wandering = 0, 0, 0, … after 2 minutes, 0, 0.01, 0.02, 0.03, 0.04, …

Regards
citkid

p.s.: I hope the text is now ok.

What does it stand for: " ’ ’ ’ bash"? Without"" and space

I think you’re reading the “raw” README, ’ ’ bash" is only formatting so people are able to copy and paste the command on GitHub, you can find the README file here:

Eitherway I’m pretty sure the reason why you are getting a "neither a launch file in package " error is because you are not sourcing your workspace, which you do by using this command:

source install/setup.bash

which is different from sourcing your ROS environment with:

source /opt/ros/kinetic/setup.bash

You should source both things.

Not quite correct. The error messages are different depending on the folder name.

The error messages are different depending on the package name, on each package you should have an xml file with the name for the package (which usually is the same as the name of the folder)

I ran “source /opt/ros/kinetic/setup.bash” in the “rplidar_pck” directory. There was no feedback. Also no error message.

Again, that’s your ROS installation not your workspace which you source from inside your package folder directory, by running the following command:

source install/setup.bash

Found an estimated 50 files with URDF or/and xacro. Should I search them all for radius? Is there a command in Linux to check the contents of all files for radius?

Try searching for the keywords on GitHub instead, I did a quick search and I think this might be the one:

However keep in mind that I’m not sure if changing the radius migh fix your issue, you might have to tweak the scale or something else.

Regards

1 Like

Hello geraldinebc15 and all the others,

When I type “source install/setup.bash”, it can’t find install.

the new laser is recognized but not included in my old environment for my python program, so I figured it was the location of the files for the new laser. At the link …
https://softwaretester.info/rplidar-a1-with-ros-melodic-on-ubuntu-18-04/
… I found an installation for my new laser from the position “Create a Catkin workspace” that suited me. Actually exactly as geraldinebc15 had written it to me. Just at a probably better place. To be on the safe side, I first reset the image to my previous state and then started the installation from “Create a Catkin workspace”.
The test with rviz still doesn’t work of course, but the error message is probably not so blatant anymore. I don’t want to work with rviz anyway, so it doesn’t matter.

So I first did the following:

rqt now shows:
image

The laser works, but of course I can’t use it like this in my Python program, because all other sensors and the motors are not included. So I used my launch file:

I suspect the error message refers to the current change in the laser section.
rqt now shows:
image

You can’t see a laser entry, unfortunately. The rest works now again in my Python program.

So I thought I could compare the two launch files:

here is a reference to a core and lidar file:

Now how can I make sure that the laser is recognized in ROS for all? Or if that is unknown, how can I make sure that the laser is recognized in my project?

So that half is not lost again when posting the text, but also because I can only take screen shots of the robot, I have used pictures here. Please forgive me.

Kind regards
citkid

When I type “source install/setup.bash”, it can’t find install.

Try this instead:

source devel/setup.bash

Unfortunately, the rest of your questions are more related to the rplidar_ros package so I suggest contacting Slamtec about your questions or perhaps creating an issue on Github.

Also, although I understand your goal is not to learn how to use ROS but simply to use the robot for navigation, the Waffle-pi is a ROS development platform so the best option is at least to learn the basics of ROS, also as you customized your robot with a new LIDAR you will have to work a bit more to integrate it properly to your project, as just installing the rplidar package won’t do the trick.

Here are some resources that might help you:

I hope that helps!

Hallo,
source devel/setup.bash
is part of the installation of the link. Also, this problem no longer exists due to the new installation.

I have “only” the problem to combine both launch packages. I will try this myself. Will probably still many protests from the robot software. But giving up is not an option for me.

Thank you for your support of my problem.
citkid

p.s. the WafflePi is a financially manageable method to prove that I can create such a project. The final solution is to run on an industrial robot with little adaptation of the software. This is the statement of the accompanying company that supplied the robot. The company itself writes such software applications. Unfortunately, the company is not able to answer my questions. They refer to their forum. But there I get only incomplete help. I still have an ace up my sleeve. An employee of my client. He is just in the exam. I am not allowed to disturb him for this time. Together with me, he has managed everything so far. We complement each other quite well. He’s English and Linux, I’m technical. Only ROS is missing for both of us.