Skip to content

Commit

Permalink
Version bump
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiaai committed Apr 30, 2024
1 parent 2f1f0da commit 3cd713e
Show file tree
Hide file tree
Showing 6 changed files with 38 additions and 25 deletions.
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# LDS/LiDAR Library for Arduino
Laser distance scan sensor (LDS/LIDAR) Arduino wrapper/controller for [kaia.ai](https://kaia.ai) home robot software platform.
Please read this [blog post](https://kaia.ai/blog/arduino-lidar-library/) for more details.
Please check out the [Awesome 2D LiDARs list](https://github.com/kaiaai/awesome-2d-lidars)
and read this [blog post](https://kaia.ai/blog/arduino-lidar-library/) for more details.

This library supports:
- YDLIDAR X4, X3, X3-PRO, X2/X2L models
- SLAMTEC RPLIDAR A1
- Neato XV11/Botvac
- Xiaomi Roborock Mi 1st gen LDS02RR
- 3drobotix Delta-2A, Delta-2B, Delta-2G, Delta-2A 115000 baud
- 3irobotix Delta-2A, Delta-2B, Delta-2G, Delta-2A 115000 baud
- Note: there is a fixed pattern noise issue that needs debug
- LDROBOT LD14P
- CAMSENSE X1

Other models are in the works.

Expand Down Expand Up @@ -39,6 +42,11 @@ Other models are in the works.
<img src="http://img.youtube.com/vi/ebbHqs4lW0U/maxresdefault.jpg" alt="LDROBOT LD14P LiDAR connected to Arduino, ROS2" width="720" height="405" border="10" />
</a>

### Video: CAMSENSE X1 runs on Arduino, ROS2
<a href="http://www.youtube.com/watch?feature=player_embedded&v=kNBraxYKvvI" target="_blank">
<img src="http://img.youtube.com/vi/kNBraxYKvvI/maxresdefault.jpg" alt="CAMSENSE X1 LiDAR connected to Arduino, ROS2" width="720" height="405" border="10" />
</a>

## Connecting to Arduino
Please follow [this tutorial](https://kaia.ai/blog/tutorial-connect-ld14p-lidar/) to connect LDROBOT LD14P to Arduino ESP32.

Expand All @@ -50,11 +58,16 @@ Some LiDAR/LDS models do not have built-in motor control and therefore require a

## Performance Notes
- currently Delta-2A, -2B, -2G exhibit mysterioius fixed pattern noise
- I'm sure it can be fixed, but so far I haven't heard back from 3irobotix support.
- this noise does NOT show when using 3irobotix development kit, so it should be fix-able (somehow)
- so far I haven't heard back from 3irobotix support.

## Release notes

## v0.5.3 - in debug
## v0.5.4
- added CAMSENSE X1
- example sketch fix

## v0.5.3
- added Delta-2A 230400 baud
- added Delta-2B

Expand Down
2 changes: 1 addition & 1 deletion keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ LDS_DELTA_2A_230400 KEYWORD1
LDS_DELTA_2A_115200 KEYWORD1
LDS_DELTA_2B KEYWORD1
LDS_DELTA_2G KEYWORD1
LDS_LDLIDAR_LD14P KEYWORD1
LDS_LDROBOT_LD14P KEYWORD1
LDS_CAMSENSE_X1 KEYWORD1

#######################################
Expand Down
4 changes: 2 additions & 2 deletions library.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name=LDS
version=0.5.3
version=0.5.4
author=Ilia O. <[email protected]>
maintainer=Ilia O. <[email protected]>
sentence=Laser distance scan sensors (LDS/LIDAR) wrapper/controller for kaia.ai robotics platform
paragraph=Supports YDLIDAR X4, X3, X3 PRO, X2/X2L; Xiaomi Roborock 1st gen LDS02RR; Neato XV11; SLAMTEC RPLIDAR A1; 3irobotix Delta-2A, -2B, -2G, -2A 115000; LDROBOT LD14P
paragraph=Supports YDLIDAR X4, X3, X3 PRO, X2/X2L; Xiaomi Roborock 1st gen LDS02RR; Neato XV11; SLAMTEC RPLIDAR A1; 3irobotix Delta-2A, -2B, -2G, -2A 115000; LDROBOT LD14P; CAMSENSE X1
category=Sensors
url=https://github.com/kaiaai/LDS
architectures=*
32 changes: 16 additions & 16 deletions src/LDS_LDLIDAR_LD14P.cpp → src/LDS_LDROBOT_LD14P.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "LDS_LDLIDAR_LD14P.h"
#include "LDS_LDROBOT_LD14P.h"

void LDS_LDLIDAR_LD14P::init() {
void LDS_LDROBOT_LD14P::init() {
motor_enabled = false;
speed_deg_per_sec = 0;
parser_idx = 0;
Expand All @@ -24,35 +24,35 @@ void LDS_LDLIDAR_LD14P::init() {
enableMotor(false);
}

LDS::result_t LDS_LDLIDAR_LD14P::start() {
LDS::result_t LDS_LDROBOT_LD14P::start() {
enableMotor(true);
postInfo(INFO_MODEL, getModelName());
return RESULT_OK;
}

uint32_t LDS_LDLIDAR_LD14P::getSerialBaudRate() {
uint32_t LDS_LDROBOT_LD14P::getSerialBaudRate() {
return 230400;
}

float LDS_LDLIDAR_LD14P::getTargetScanFreqHz() {
float LDS_LDROBOT_LD14P::getTargetScanFreqHz() {
return DEFAULT_VALUE;
}

int LDS_LDLIDAR_LD14P::getSamplingRateHz() {
int LDS_LDROBOT_LD14P::getSamplingRateHz() {
return 4000;
}

float LDS_LDLIDAR_LD14P::getCurrentScanFreqHz() {
float LDS_LDROBOT_LD14P::getCurrentScanFreqHz() {
static constexpr float ONE_OVER_360 = 1.0f/360.0f;
return ONE_OVER_360 * speed_deg_per_sec;
}

LDS::result_t LDS_LDLIDAR_LD14P::stop() {
LDS::result_t LDS_LDROBOT_LD14P::stop() {
enableMotor(false);
return RESULT_OK;
}

void LDS_LDLIDAR_LD14P::enableMotor(bool enable) {
void LDS_LDROBOT_LD14P::enableMotor(bool enable) {
static constexpr uint8_t START_CMD[] = {0x54, 0xA0, 0x04, 0x00, 0x00, 0x00, 0x00, 0x5E};
static constexpr uint8_t STOP_CMD[] = {0x54, 0xA1, 0x04, 0x00, 0x00, 0x00, 0x00, 0x4A};
motor_enabled = enable;
Expand All @@ -65,15 +65,15 @@ void LDS_LDLIDAR_LD14P::enableMotor(bool enable) {
// TODO verify serial response
}

bool LDS_LDLIDAR_LD14P::isActive() {
bool LDS_LDROBOT_LD14P::isActive() {
return motor_enabled;
}

LDS::result_t LDS_LDLIDAR_LD14P::setScanTargetFreqHz(float freq) {
LDS::result_t LDS_LDROBOT_LD14P::setScanTargetFreqHz(float freq) {
return freq <= 0 ? RESULT_OK : ERROR_NOT_IMPLEMENTED;
}

void LDS_LDLIDAR_LD14P::loop() {
void LDS_LDROBOT_LD14P::loop() {
while (true) {
int c = readSerial();
if (c < 0)
Expand All @@ -85,7 +85,7 @@ void LDS_LDLIDAR_LD14P::loop() {
}
}

void LDS_LDLIDAR_LD14P::checkSum(uint8_t value) {
void LDS_LDROBOT_LD14P::checkSum(uint8_t value) {
static const uint8_t CRC_TABLE[256] = {
0x00, 0x4d, 0x9a, 0xd7, 0x79, 0x34, 0xe3,
0xae, 0xf2, 0xbf, 0x68, 0x25, 0x8b, 0xc6, 0x11, 0x5c, 0xa9, 0xe4, 0x33,
Expand Down Expand Up @@ -113,7 +113,7 @@ void LDS_LDLIDAR_LD14P::checkSum(uint8_t value) {
crc = CRC_TABLE[(crc ^ value) & 0xff];
}

LDS::result_t LDS_LDLIDAR_LD14P::processByte(uint8_t c) {
LDS::result_t LDS_LDROBOT_LD14P::processByte(uint8_t c) {
LDS::result_t result = RESULT_OK;
uint8_t * rx_buffer = (uint8_t *)&scan_packet;

Expand Down Expand Up @@ -237,7 +237,7 @@ LDS::result_t LDS_LDLIDAR_LD14P::processByte(uint8_t c) {
return result;
}

uint16_t LDS_LDLIDAR_LD14P::decodeUInt16(const uint16_t value) const {
uint16_t LDS_LDROBOT_LD14P::decodeUInt16(const uint16_t value) const {
union {
uint16_t i;
char c[2];
Expand All @@ -246,4 +246,4 @@ uint16_t LDS_LDLIDAR_LD14P::decodeUInt16(const uint16_t value) const {
return bint.c[0] == 0x01 ? value : (value << 8) + (value >> 8);
}

const char* LDS_LDLIDAR_LD14P::getModelName() { return "LDLIDAR LD14P"; }
const char* LDS_LDROBOT_LD14P::getModelName() { return "LDROBOT LD14P"; }
2 changes: 1 addition & 1 deletion src/LDS_LDLIDAR_LD14P.h → src/LDS_LDROBOT_LD14P.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#pragma once
#include "LDS.h"

class LDS_LDLIDAR_LD14P : public LDS {
class LDS_LDROBOT_LD14P : public LDS {
public:
virtual void init() override;

Expand Down
2 changes: 1 addition & 1 deletion src/lds_all_models.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@
#include "LDS_DELTA_2A_230400.h"
#include "LDS_DELTA_2B.h"
#include "LDS_DELTA_2G.h"
#include "LDS_LDLIDAR_LD14P.h"
#include "LDS_LDROBOT_LD14P.h"
#include "LDS_CAMSENSE_X1.h"
//#include "LDS_HLS_LFCD2.h"

0 comments on commit 3cd713e

Please sign in to comment.