robopeak / rplidar_ros

BSD 2-Clause "Simplified" License
453 stars 370 forks source link

Setting motorPWM to low values (like 200) makes the node not publishing all points #40

Closed rbiasini closed 7 years ago

rbiasini commented 7 years ago

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.

rbiasini commented 7 years ago

Did some investigation today and found 3 bottle necks:

1- the function grabScanData accepts max node count as input. Currently is set to 3602, which is too small for low rotational speeds. `rplidar_response_measurement_node_t nodes[3602];`

2- in rplidar_driver_serial.h there is a MAX_SCAN_NODES parameter set to 2048, which is also a bit low for very low rotational speeds (at motor PWM of 150 I see ~2400 nodes) MAX_SCAN_NODES = 2048

3- in rplidar_driver_serial.h there is _cached_scan_node_buf parameter initialized to size of 2048 rplidar_response_measurement_node_t _cached_scan_node_buf[2048];

In conclusion, I'm not sure if this is an issue, as it's possible to change the parameters to see all points. However, it took me quite a while to figure out first that there was a problem and then to debug it. A warning should at least be displayed when points are discarded.

kintzhao commented 7 years ago

which version of rplidar laser, rplidar A1 or A2. which range of frequency do you accept in your system?

rbiasini commented 7 years ago

RPlidar A2M4 is the model. Not sure about the range of frequency: you mean which rotational frequency I'm ok with? If so, the lower the better: I don't have speed performance requirements and I prefer fewer accurate sweeps to reduce the log size.

kintzhao commented 7 years ago

@rbiasini yeah, make it( frequency or motor PWM value) be suitable for your system at first, then consider your investigation and improve it in detail.

rbiasini commented 7 years ago

@kintzhao , Let's say I want to set motor PWM to 200. Are the 3 bottle necks I mentioned above all you suggest to change to not drop points?

kintzhao commented 7 years ago

@rbiasini It will not output the data lower 3hz by older firmware. it will lower 2hz near 200 PWM. we suggest that it is better at 10 hz .

can you get data at 2hz (PWM 200) from frame_grabber, if not , you can update the firmware detail

kintzhao commented 7 years ago

It is not suitable to change the code for lower frequency at official node for your special demand. If it is needed, you can fork it and process it at your local repo.