robopeak / rplidar_ros Goto Github PK
View Code? Open in Web Editor NEWLicense: BSD 2-Clause "Simplified" License
License: BSD 2-Clause "Simplified" License
Hi, I got a problem that rplidar A1 can used on PC but can not get scan data in Jetson Tk1.
Under is output message about rplidar a1.
ubuntu@tegra-ubuntu:~/catkin_ws/src/rplidar_ros$ roslaunch rplidar_ros view_rplidar.launch
... logging to /home/ubuntu/.ros/log/71dfd04e-1dd2-11b2-a063-f0421cf8ef80/roslaunch-tegra-ubuntu-4669.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://localhost:45894/
PARAMETERS
NODES
/
rplidarNode (rplidar_ros/rplidarNode)
rviz (rviz/rviz)
ROS_MASTER_URI=http://localhost:11311
core service [/rosout] found
process[rplidarNode-1]: started with pid [4687]
process[rviz-2]: started with pid [4689]
RPLIDAR running on ROS package rplidar_ros
SDK Version: 1.5.7
RPLIDAR S/N: 98FEFBF2C8E49CCFC6E49FF1662C530D
Firmware Ver: 1.20
Hardware Rev: 0
RPLidar health status : 0
Everything is normal but cannot get data.
And also I give permissions for rplidar.
sudo chmod 777 /dev/ttyUSB0
Thanks!
Hi,
On the images rplidar_A1.png
and rplidar_A2.png
, the angle is defined to increase in clock-wise direction. It seems to me that this is only the case when setting inverted = true
in the launch file (default is false
).
I tested this both on A1 and A2 with inverted = false
, echoing the /scan
topic and moving my hand from the start angle in the counter-clockwise direction, which results in an inf
region shifting though the scan from top (range for angle_min) to bottom (range for angle_max), which is what is supposed to happen. This also matches the general convention that positive angles are counter-clockwise.
Also, angle 0 seems to be aligned with the x-axis (which makes sense), whereas the images indicate that angle 0 starts at negative x direction.
Or am I missing something here? Is my assumption correct that ranges[i]
corresponds to angle angle_min + i * angle_increment
?
PARAMETERS
NODES
/
rplidarNode (rplidar_ros/rplidarNode)
rviz (rviz/rviz)
ROS_MASTER_URI=http://192.168.206.141:11311
process[rplidarNode-1]: started with pid [5049]
process[rviz-2]: started with pid [5050]
[ INFO] [1527909126.769626371]: RPLIDAR running on ROS package rplidar_ros. SDK Version:1.6.0
RPLIDAR S/N: 7633FBF2C8E49CCCC6E49FF188E1530E
[ INFO] [1527909129.278021707]: Firmware Ver: 1.20
[ INFO] [1527909129.278133668]: Hardware Rev: 0
[ INFO] [1527909129.280205710]: RPLidar health status : 0
[ INFO] [1527909129.807118185]: current scan mode: Express, max_distance: 16.0 m, Point number: 2.1K
➜ ~ rostopic list
/initialpose
/move_base_simple/goal
/rosout
/rosout_agg
/scan
/tf
/tf_static
➜ ~ rosnode list
/rosout
/rplidarNode
/rviz
➜ ~ rostopic echo /scan
header:
seq: 8952
stamp:
secs: 1527910253
nsecs: 981893616
frame_id: "laser"
angle_min: -3.12413907051
angle_max: 3.14159274101
angle_increment: 3.39666002113e-19
time_increment: 6.64862573211e-21
scan_time: 0.122645497322
range_min: 0.15000000596
range_max: 16.0
ranges: []
intensities: []
Suggesting to add this to this GitHub repo. See our fork for reference: https://github.com/yujinrobot/rplidar_ros
This help ROS users to jump back and forth between the doc (ROS wiki) and code (GitHub repo).
PS: I just created an empty page on the ROS wiki for this package: http://wiki.ros.org/rplidar_ros
Will scan find using python package but the /scan message does not function right our of the box? thoughts?
PARAMETERS
NODES
/
rplidarNode (rplidar_ros/rplidarNode)
ROS_MASTER_URI=http://192.168.22.66:11311
process[rplidarNode-1]: started with pid [3279]
[ INFO] [1534795160.126721422]: RPLIDAR running on ROS package rplidar_ros. SDK Version:1.7.0
RPLIDAR S/N: 509A9AF0C5E29DD2B6E39DF5D3493116
[ INFO] [1534795160.637768326]: Firmware Ver: 1.24
[ INFO] [1534795160.638347576]: Hardware Rev: 5
[ INFO] [1534795160.641101007]: RPLidar health status : 0
ERROR] [1534795161.291767343]: scan mode `Sensitivity' is not supported by lidar, supported modes:
[ERROR] [1534795161.292593794]: Standard: max_distance: 12.0 m, Point number: 2.0K
[ERROR] [1534795161.293005483]: Express: max_distance: 12.0 m, Point number: 4.0K
[ERROR] [1534795161.293501031]: Boost: max_distance: 12.0 m, Point number: 8.0K
[ERROR] [1534795161.293875635]: Can not start scan: 80008001!
^C[rplidarNode-1] killing on exit
shutting down processing monitor...
... shutting down processing monitor complete
done
Hi, it appears the head is not balanced in this unit? I just realized it makes my turtlebot vibrate so much that it screws up it's gyro which it uses in calculating /odom (it actually overwrites the encoder provided values in kobuki_driver). Is there a good solution to this? I've tried various methods of dampening to no avail, it's quite a bit of bad vibes coming off of this thing!
Looking forward to your reply.
Trevor.
Hi @robopeak
Do you plan on releasing this package for ROS Indigo and/or Jade?
We'd like to use this package and it is just more convenient in big setups to have it as a released package.
We'd also like to offer our help for releasing it to Indigo, if you don't plan on doing this.
I'd just want to make sure that we don't get any package conflicts if we release it.
Best regards from Germany
ipa-mig.
i try to use rplidar A1 in cartographer ,bu i got this
`rxh@ASUS-PC:~$ roslaunch cartographer_ros demo_revo_lds.launch
... logging to /home/rxh/.ros/log/d0dc176c-3a3c-11e8-9f3a-c8d3ffb49495/roslaunch-ASUS-PC-7602.log
Checking log directory for disk usage. This may take awhile.
Press Ctrl-C to interrupt
Done checking log file disk usage. Usage is <1GB.
started roslaunch server http://ASUS-PC:36319/
PARAMETERS
NODES
/
cartographer_node (cartographer_ros/cartographer_node)
rviz (rviz/rviz)
ROS_MASTER_URI=http://localhost:11311
core service [/rosout] found
process[cartographer_node-1]: started with pid [7620]
WARNING: Package name "gpsCalibration" does not follow the naming conventions. It should start with a lower case letter and only contain lower case letters, digits and underscores.
process[rviz-2]: started with pid [7633]
[ INFO] [1523090738.559865731]: I0407 16:45:38.000000 7620 configuration_file_resolver.cc:41] Found '/home/rxh/catkin_ws_cartographer/install_isolated/share/cartographer_ros/configuration_files/revo_lds.lua' for 'revo_lds.lua'.
[ INFO] [1523090738.560533819]: I0407 16:45:38.000000 7620 configuration_file_resolver.cc:41] Found '/home/rxh/catkin_ws_cartographer/install_isolated/share/cartographer/configuration_files/map_builder.lua' for 'map_builder.lua'.
[ INFO] [1523090738.560656306]: I0407 16:45:38.000000 7620 configuration_file_resolver.cc:41] Found '/home/rxh/catkin_ws_cartographer/install_isolated/share/cartographer/configuration_files/map_builder.lua' for 'map_builder.lua'.
[ INFO] [1523090738.560827372]: I0407 16:45:38.000000 7620 configuration_file_resolver.cc:41] Found '/home/rxh/catkin_ws_cartographer/install_isolated/share/cartographer/configuration_files/pose_graph.lua' for 'pose_graph.lua'.
[ INFO] [1523090738.560949598]: I0407 16:45:38.000000 7620 configuration_file_resolver.cc:41] Found '/home/rxh/catkin_ws_cartographer/install_isolated/share/cartographer/configuration_files/pose_graph.lua' for 'pose_graph.lua'.
F0407 16:45:38.561285 7620 lua_parameter_dictionary.cc:83] Check failed: status == 0 (2 vs. 0) [string "include "map_builder.lua"..."]:48: attempt to index global 'TRAJECTORY_BUILDER_2D' (a nil value)
[FATAL] [1523090738.561812234]: F0407 16:45:38.000000 7620 lua_parameter_dictionary.cc:83] Check failed: status == 0 (2 vs. 0) [string "include "map_builder.lua"..."]:48: attempt to index global 'TRAJECTORY_BUILDER_2D' (a nil value)
Got bus address: "unix:abstract=/tmp/dbus-jNoDhQPKZ4,guid=fca53e1c6569377def3d342a5ac87f92"
Connected to accessibility bus at: "unix:abstract=/tmp/dbus-jNoDhQPKZ4,guid=fca53e1c6569377def3d342a5ac87f92"
Registered DEC: true
*** Check failure stack trace: ***
@ 0x7f0e3cd89daa (unknown)
@ 0x7f0e3cd89ce4 (unknown)
@ 0x7f0e3cd896e6 (unknown)
@ 0x7f0e3cd8c687 (unknown)
@ 0x677756 cartographer::common::(anonymous namespace)::CheckForLuaErrors()
@ 0x677cc6 cartographer::common::LuaParameterDictionary::LuaParameterDictionary()
@ 0x677e4d cartographer::common::LuaParameterDictionary::LuaParameterDictionary()
@ 0x592682 cartographer_ros::LoadOptions()
@ 0x590313 cartographer_ros::(anonymous namespace)::Run()
@ 0x58d876 main
@ 0x7f0e3921af45 (unknown)
@ 0x590167 (unknown)
@ (nil) (unknown)
Registered event listener change listener: true
[cartographer_node-1] process has died [pid 7620, exit code -6, cmd /home/rxh/catkin_ws_cartographer/install_isolated/lib/cartographer_ros/cartographer_node -configuration_directory /home/rxh/catkin_ws_cartographer/install_isolated/share/cartographer_ros/configuration_files -configuration_basename revo_lds.lua scan:=scan __name:=cartographer_node __log:=/home/rxh/.ros/log/d0dc176c-3a3c-11e8-9f3a-c8d3ffb49495/cartographer_node-1.log].
log file: /home/rxh/.ros/log/d0dc176c-3a3c-11e8-9f3a-c8d3ffb49495/cartographer_node-1*.log
`
the slower the speed, the bigger the angle without points.
This only seem a problem with the ros node. If I use frame_grabber it's ok.
The node publishes scan data even when grabScanData()
returns RESULT_OPERATION_FAIL
in these lines.
This becomes to an issue to other nodes in processing pipeline using this scan data. One of the case is when laserscan_to_pointcloud
will crash if scan data of data size = 1
is published.
As declared here:
if(!scan_in.ranges.empty()) end_time += ros::Duration().fromSec( (scan_in.ranges.size()-1) * scan_in.time_increment);
If node_count = 1
, the angle_increment
and time_increment
fields of scan data will be 'inf' causing crash with 'std::exception'
at above line.
A better and safer way will be to publish ONLY if the result is successful from grabScanData()
and further check is the size of data is 360 before publishing.
I will put up a PR for this.
有没能A3的ROS驱动 ,这里的代码不支持A3的256000波特率。
Hi,
Can anyone help? first time using ROS.. this is the reply that I have when i run roslaunch rplidar_ros view_rplidar.launch..
reply : [view_rplidar.launch] is neither a launch file in package [rplidar_ros] nor is [rplidar_ros] a launch file name
Anyone got any idea what is wrong? I already follow the github instruction.. Please help..
Hello
I would like to ask how this RPLidar works with BeagleBone Black platform? Could You tell me something about it? Do You have some experience with this platform?
I ask about it because i planned to use this RPLidar in my robot project based on BBB board and Rover 5 Motor Driver Board and 4WD tracked chassis.
Greetings.
I am working with the pioneer lx robot, which has an embedded computer running Ubuntu 12.04, and it has ros hydro installed. I am trying to run rplidar launch file with "roslaunch rplidar_ros rplidar.launch", but I am not getting the Health Status, instead I just get: "Error. unexpected error, code: 800080001"
I tried running the launch file on Ubuntu 14.04 in another computer (with ROS indigo) and I can get the scanning data without problems.
Hello,
I am working with the RPLidar 360-degree scanner and am having issues while trying to map in rviz. When I map, I am only seeing red dots, and no legitimate mapping. It is giving me an error message that there is no tf data and that a laser does not exist. Any help would be great. Thanks!
Hi,
I have seen that you have recently release a new version of rplidar_ros for Indigo and Jade.
Will you release it for Kinetic also?
Thanks
hi guys, currently i have configured beaglebone black and completely installed ros in ubuntu. However, i am having of interfacing both beaglebone black and rviz together to show the slam in the rviz. Is there anyone out there could help me out? thanks
I have a problem on launch the program,
i use "roslaunch rplidar_ros view_rplidar.launch"
but it return with
[view_rplidar.launch] is neither a launch file in package [rplidar_ros] nor is [rplidar_ros] a launch file name
The traceback for the exception was written to the log file
I've already successfully do the catkin_make,
do i run the command on wrong directories? or what? thanks
I am using this branch: https://github.com/kintzhao/rplidar_ros/tree/feature/angFilterPublish for limiting the range of the lidar. As per the code,to get the complete range of lidar, the min_angle should be set to -3.14 and the max_angle should be set to 3.12. This gives a complete 360 degree range of lidar.
I have mounted the lidar such that the -x axis is facing the front side of the robot. So, I want to filter the laserscan to have a range of 180 degress. So , as per the axis and degree convention in the diagram rplidar_A2.png, I have set the min_angle to be -1.57 and max_angle to 1.57. But when I run the code, it throws an error immediately,
terminate called after throwing an instance of 'std::runtime_error'
what(): Time is out of dual 32-bit range
terminate called after throwing an instance of 'std::length_error'
what(): vector::_M_fill_insert"
Hi,
I am analyzing the ROS
node for the RPLIDAR
sensor and I would like to know what information store in the array about intensities:
https://github.com/robopeak/rplidar_ros/blob/master/src/node.cpp
scan_msg.intensities[node_count-1-i] = (float) (nodes[i].sync_quality >> 2);
What is the range of values that the sensor generate? In the SDK file: rplidar_cmd.h
define the following structure:
typedef struct _rplidar_response_measurement_node_t {
121: _u8 sync_quality; // syncbit:1;syncbit_inverse:1;quality:6;
I would like to know what possible values are populated to the ROS message: sensor_msgs/LaserScan.h
nodes[i].sync_quality >> 2
Many thanks in advance.
Juan Antonio
你好,有些时候你们的激光雷达转不起来,需要人为的转一下才能够启动,而且很多时候就算起来了频率好像减半了.
Hi,
I am testing RPLIDAR A1 on OSX Sierra and I would like to know how to get the mount point to connect using a serial connection.
Many thanks in advance.
Juan Antonio
I am using gmapping and it is working fine with fake odometry. I use RPlidar
But now I wanted to use laser_scan_matcher to get better odometry data. when ı used laser_scan_matcher with demo launch also it use a demo bag file , no problem it is succesfull. but when ı used to own laser bag file or used real laser data, laser_scan_matcher throw this error :
http://i.imgur.com/4SyDnIW.jpg
[ WARN] [1435132671.572301017]: Skipping scan
Strange FOV: -6.283185 rad = -360.000010 deg
[ WARN] [1435132671.572614765]: Error in scan matching****
I am using static tf for laser to base_link.
Hello,
I was trying to get a map with a rplidar a2 in combination with hector_mapping in Ubuntu, however when killing the rplidar launchfile something went wrong, the lidar was still rotating. After this I restarted the launchfile which eventually stopped the lidar, but now I am not able to restart the lidar again. When I try to start the lidar I receive this error message:
Error, operation time out.
[rplidarNode-2] process has died [pid 3114, exit code 255, cmd /home/pim/catkin_ws/devel/lib/rplidar_ros/rplidarNode __name:=rplidarNode __log:=/home/pim/.ros/log/c4f67012-5370-11e8-bb7d-9
cd21e0c8747/rplidarNode-2.log].
log file: /home/pim/.ros/log/c4f67012-5370-11e8-bb7d-9cd21e0c8747/rplidarNode-2*.log
I found out that it had something to do with the serial port but I cannot find a solution for this, could you help me?
Hello.
I cloned this repo, and catkin_make
d on both my PC and Raspberry Pi 3. The rplidarNode
is running well on my PC (Ubuntu 16.04 x64, ROS Kinetic), but always crash on Raspberry Pi 3(Ubuntu MATE 16.04, ROS Kinetic). Below is a error message.
process[rplidarNode-1]: started with pid [1566]
[ INFO] [1534499013.847457964]: RPLIDAR running on ROS package rplidar_ros. SDK Version:1.7.0
RPLIDAR S/N: 97DD9AF2C1EA9FC0A2EB92F1040E3C02
[ INFO] [1534499014.366249529]: Firmware Ver: 1.24
[ INFO] [1534499014.366457706]: Hardware Rev: 6
[ INFO] [1534499014.368799211]: RPLidar health status : 0
[ INFO] [1534499015.067182568]: current scan mode: Sensitivity, max_distance: 25.0 m, Point number: 15.9K , angle_compensate: 4
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
[rplidarNode-1] process has died [pid 1566, exit code -6, cmd /home/pi/catkin_ws/devel/lib/rplidar_ros/rplidarNode __name:=rplidarNode __log:=/home/pi/.ros/log/6f73eaa0-a1c9-11e8-8585-7085c2230810/rplidarNode-1.log].
log file: /home/pi/.ros/log/6f73eaa0-a1c9-11e8-8585-7085c2230810/rplidarNode-1*.log
all processes on machine have died, roslaunch will exit
shutting down processing monitor...
... shutting down processing monitor complete
done
Also it sometimes throws std::length_error
, instead of std::bad_alloc
.
Thank you.
when I input the "ls -l /dev |grep ttyUSB" command, I got "rplidar -> ttyUSB*", but when I am processing "roslaunch rplidar_ros rolidar.launch", I got some problems:
BTW,I am using nvidia tx1, rplidar A1,rosdistro:kinetic :)
Thank you!
Hi, when I build map with gmapping and rplidar, there is something wrong. If I move or turn it little by little, it can build the right map as picture 1. However, when I move it fast or turn a large angle in a short time, it doesn't work in a right way. As you can see in picture 2-4, the previous map doesn't move or rotate, so it builds new map incorrectly. I haven't changed the original launch file and don't know why it happens. And I also wanna know, why it says I need to change the static_transform_publisher if I use a real robot in "gmapping.launch" and what I should do. Thanks for your help!
在 rplidar.launch 文件中的 param:angle_compensate 这里的角度补偿是如何进行的?
hi, i have an a3 rplidar, when roslaunch rplidar_ros view_rplidar_a3.launch, node crash.log as below:
RPLIDAR S/N: E5BB9AF2C1EA9FC3A2EB92F176683C01
[ INFO] [1534383529.782389325]: Firmware Ver: 1.24
[ INFO] [1534383529.782420782]: Hardware Rev: 6
[ INFO] [1534383529.783272236]: RPLidar health status : 0
[ INFO] [1534383530.397773691]: current scan mode: Sensitivity, max_distance: 25.0 m, Point number: 15.9K , angle_compensate: 4
[rplidarNode-2] process has died [pid 1932, exit code -7, cmd /home/gy/navigation/devel/lib/rplidar_ros/rplidarNode __name:=rplidarNode __log:=/home/gy/.ros/log/1f226ca4-a0f5-11e8-bbf6-f0421c857a46/rplidarNode-2.log].
log file: /home/gy/.ros/log/1f226ca4-a0f5-11e8-bbf6-f0421c857a46/rplidarNode-2*.log
I am using RPLidar A1 and I am looking for a way to limit the angular range of the laser scans. I only want to look at data which is right in front of the robot.
I noticed that this is implemented in another repo kintzhao/rplidar_ros in the branches feature/angFilterPublish and feature/fixedAngleFilter. However these branches are 8 commits behind the main repository and I am afraid if I use these branches then I will miss out on the improvements/bug fixes from the later commits.
Any idea how to go about doing this? @kintzhao
It seems that turtlebot.minimal.launch uses ttyUSB0 and rplidar.launch uses it too, so I change the port parameter in the rplidar.launch to ttyUSB1 as found with the command of "ls /dev/ttyUSB*" . But it shows that " Error, cannot bind to the specified serial port ttyUSB1". How can I solve the problem, thank you for your answer!
i write below command and i get an error as the title.
$ roslaunch rplidar_ros view_rplidar.launch
[ERROR] [1535647334.151867876]: Error, cannot bind to the specified serial port /dev/ttyUSB0.
process[rviz-2]: started with pid [16019]
[rplidarNode-1] process has died [pid 15996, exit code 255, cmd /home/nvidia/racecar-workspace/devel/lib/rplidar_ros/rplidarNode __name:=rplidarNode __log:=/home/nvidia/.ros/log/23793a6c-ac71-11e8-a23d-00044ba50ea0/rplidarNode-1.log].
log file: /home/nvidia/.ros/log/23793a6c-ac71-11e8-a23d-00044ba50ea0/rplidarNode-1*.log
how can i solve this problem
Line 258 in c67b213
I am using the node for a collision avoidance algorithm I'm working on and sometimes while the node is running it stops publishing the /scan message. I am running rostopic hz /scan
and sometimes I get the "no new messages" alert for a long period of time. Sometimes the /scan message comes back, other times I have to power cycle the LIDAR a few times.
Has anyone seen a similar issue?
catkin_make the project on Rasberry Pi(Rasbian OS) will give the following error message:
/usr/bin/ld: CMakeFiles/rplidarNode.dir/sdk/src/arch/linux/timer.cpp.o: undefined reference to symbol 'clock_gettime@@GLIBC_2.4'
//lib/arm-linux-gnueabihf/librt.so.1: error adding symbols: DSO missing from command line
collect2: ld returned 1 exit status
CMakeFiles/rplidarNode.dir/build.make:204: recipe for target 'devel/lib/rplidar_ros/rplidarNode' failed
make[2]: *** [devel/lib/rplidar_ros/rplidarNode] Error 1
CMakeFiles/Makefile2:403: recipe for target 'CMakeFiles/rplidarNode.dir/all' failed
make[1]: *** [CMakeFiles/rplidarNode.dir/all] Error 2
Makefile:123: recipe for target 'all' failed
make: *** [all] Error 2
This problem can be solved by adding a rt
at the end of target_link_libraries(rplidarNode ${catkin_LIBRARIES})
in CMakeLists.txt (on line 26).
You can see more details here, at the bottom of the post.
[ INFO] [1527505798.842747574]: RPLIDAR running on ROS package rplidar_ros. SDK Version:1.6.0
[ERROR] [1527505798.843416854]: Error, cannot bind to the specified serial port /dev/ttyUSB0.
Good morning
I used RPLidar with Arduino but now, I would like to use the product using the USB Adapter.
How to use the sensor on a Raspberry Pi?
How to compile and use the SDK?
https://github.com/robopeak/rplidar_ros/tree/master/sdk
Many thanks in advance.
Juan Antonio
在这里
if ((angle_value - angle_compensate_offset) < 0)
angle_compensate_offset = angle_value;
不管你修改成什么一个偏移值都会在第一次循环置零,所以我不能理解这里这句为什么要这样写,我将其改成了continue,则可以正确设置数据的偏移值了。
if ((angle_value - angle_compensate_offset) < 0)
continue;
Similarly to the hokuyo_node (http://wiki.ros.org/hokuyo_node), it would be very useful to be able to change the minimum and maximum angles of the laserscans.
Since the robot has a 360º FOV, the need to filter out laser readings that correspond to objects that are behind the laser is a common issue for users.
Thanks!
Hi !
Is it possible to install the RPLidar A1 differently than with the motor side toward x ? (don't know if I'm clear, sorry...).
I would like to rotate it at 90°, so basically, x and y axis would be inverted if we compare with the wiki example. I need to do that because I don't have enough room otherwise.
I would use it with gmapping.
anyone out there is able to help me counter my current problem of using hector mapping? apprently the surround data does not save according. do i need to attach another hardware or is there any coding i missed out?
This error occured when running roslaunch rplidar_ros view_rplidar.launch:
libEGL warning: DRI2: failed to authenticate
Dear robopeak,
I'm currently facing this issue of creating udev rule for the RPLidar sensor. I have viewed the instructions but still unsure how to go about doing it.
So far, besides scoring through numerous udev articles and tutorials, what I have done is run the create_udev_rule.sh script, and check that the file is reflected in the /etc/udev/rules.d folder but it did not help in any way as I still get the bind error " Error, cannot bind to the specified serial port /dev/rplidar." when I try to launch the rplidar sensor.
Are there any step by step guide to doing this particular RPLidar remap and giving it read and write authority? Such that rplidar -> ttyUSB* (where * is a number) is displayed when I input the "ls -l /dev |grep ttyUSB" command
Thank you!
Hi,
I would like to know if you have a RPLIDAR A2 STL Model to be used on ROS.
Many thanks in advance.
Juan Antonio
I use the RPLIDAR A2 on a PIC32 microcontroller, it's a web robot here : https://www.serveurperso.com/?page=robot
I find the original driver slow and hard to read.
https://github.com/robopeak/rplidar_ros/blob/master/sdk/src/rplidar_driver.cpp
This is my legacy protocol (RPLIDAR A1) non blocking code :
void readLidar() {
uint8_t current;
static uint8_t n = 0;
static uint8_t quality;
static bool start;
static uint16_t angleq6;
static uint16_t distanceq2;
static uint16_t i = 0;
float angle;
float distance;
float lidarx;
float lidary;
while(RXLIDAR.available()) {
current = RXLIDAR.read();
switch(n) {
case 0:
if((current & 1) != (current >> 1 & 1)) {
quality = current >> 2;
start = current & 1;
n = 1;
}
break;
case 1:
if(current & 1) {
angleq6 = current >> 1;
n = 2;
} else
n = 0;
break;
case 2:
angleq6 |= current << 7;
n = 3;
break;
case 3:
distanceq2 = current;
n = 4;
break;
case 4:
distanceq2 |= current << 8;
if(start) {
if(i && i < NBMESURESMAX) {
lidarReady = true;
for(uint8_t j = i; j < NBMESURESMAX; j++) {
lidarsx[j] = 0;
lidarsy[j] = 0;
lidarsCartex[j] = 0;
lidarsCartey[j] = 0;
}
}
i = 0;
} else if(i == NBMESURESMAX) {
lidarReady = false;
n = 0;
break;
}
if(distanceq2) { // Good sample
angle = float(angleq6) / 64.0 * PI / 180.0;
distance = float(distanceq2) / 4.0;
lidarx = POSITIONLIDARX + distance * sin(angle);
lidary = POSITIONLIDARY + distance * -cos(angle);
if(lidarx > POSITIONSROBOTXMAX || lidarx < POSITIONSROBOTXMIN ||
lidary > POSITIONSROBOTYMAX || lidary < POSITIONSROBOTYMIN) { // Inside the robot
lidarsx[i] = int(lidarx);
lidarsy[i] = int(lidary);
i++;
}
}
n = 0;
}
}
}
Now I must make the 4K (cabin) protocol decoder. This is my non terminated code :
#define RPLIDARRESPONSESIZE 84
#define RPLIDARNBSAMPLES 32
bool readLidar() {
uint8_t current;
static uint8_t n = 0;
static uint8_t checksum;
static uint8_t sum = 0;
static uint16_t oldStartAngle;
static uint16_t startAngle = 0;
static bool start;
static uint16_t diffAngle;
static uint8_t m = 0;
static uint8_t s = 0;
static uint8_t angles[RPLIDARNBSAMPLES];
static uint16_t distances[RPLIDARNBSAMPLES];
while(RXLIDAR.available()) {
current = RXLIDAR.read();
switch(n) {
case 0:
if(current >> 4 == 0xA) {
checksum = current & 0xF;
n = 1;
}
break;
case 1:
if(current >> 4 == 0x5) {
checksum |= current << 4;
n = 2;
} else
n = 0;
break;
case 2:
sum ^= current;
oldStartAngle = startAngle;
startAngle = current;
n++;
break;
case 3:
sum ^= current;
startAngle |= (current & 0x7F) << 8;
start = current >> 7;
if(start)
TXDEBUG.println('S');
if(oldStartAngle > startAngle)
diffAngle = (360 << 6) + startAngle - oldStartAngle;
else
diffAngle = startAngle - oldStartAngle;
for(uint8_t i = 0; i < RPLIDARNBSAMPLES; i++) {
//TXDEBUG.println(float(oldStartAngle * 32 + diffAngle * i - angles[i] * 64) / 1024.0);
}
n++;
break;
default:
sum ^= current;
switch(m) {
case 0:
angles[s] = (current & 3) << 4;
distances[s] = current >> 2;
m++;
break;
case 1:
distances[s] |= current << 6;
m++;
break;
case 2:
angles[s + 1] = (current & 3) << 4;
distances[s + 1] = current >> 2;
m++;
break;
case 3:
distances[s + 1] |= current << 6;
m++;
break;
case 4:
angles[s] |= current & 0xF;
angles[s + 1] |= current >> 4;
s += 2;
m = 0;
break;
}
n++;
if(n == RPLIDARRESPONSESIZE + 1) {
if(sum != checksum) {
TXDEBUG.print(sum);
TXDEBUG.print(" != ");
TXDEBUG.println(checksum);
}
n = 0;
sum = 0;
m = 0;
s = 0;
}
break;
}
}
}
At line no. 250 of src/node.cpp:
scan_duration = (end_scan_time - start_scan_time).toSec() * 1e-3;
Why is the scan duration being multiplied by 0.001? ROS requires these times to be in seconds only (see the message documentation). As a consequence, the time_increment
field generated by the node is also incorrect.
If for some reason, this is deliberate, please add a comment to the code mentioning why (since it is not obvious). Otherwise, please fix this issue by changing that line to:
scan_duration = (end_scan_time - start_scan_time).toSec();
I believe it could prevent problems foe people who are using this package as-is.
Hello, I've given a look to the code (the ROS related mainly, not so much the SDK) and I couldn't find how to change the rate. Do you have any hints on how to do it?
Thank you :)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.