Skip to content

Commit

Permalink
Cap classes
Browse files Browse the repository at this point in the history
  • Loading branch information
kaiaai committed Jan 20, 2024
1 parent 240219a commit e40b449
Show file tree
Hide file tree
Showing 7 changed files with 29 additions and 29 deletions.
2 changes: 1 addition & 1 deletion examples/lds_basic_esp32/lds_basic_esp32.ino
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#error This example runs on ESP32
#endif

#include <lds_ydlidar_x4.h>
#include <LDS_YDLIDAR_X4.h>

const uint8_t LDS_MOTOR_EN_PIN = 19; // ESP32 Dev Kit LDS enable pin
const uint8_t LDS_MOTOR_PWM_PIN = 15; // LDS motor speed control using PWM
Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name=lds
name=LDS
version=0.1.0
author=Ilia O. <[email protected]>
maintainer=Ilia O. <[email protected]>
Expand Down
2 changes: 1 addition & 1 deletion src/lds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "lds.h"
#include "LDS.h"

LDS::LDS() {
scan_point_callback = NULL;
Expand Down
2 changes: 1 addition & 1 deletion src/lds_lds02rr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#include "lds_lds02rr.h"
#include "LDS_LDS02RR.h"

LDS_LDSRR02::LDS_LDSRR02() : LDS() {
motor_enabled = false;
Expand Down
2 changes: 1 addition & 1 deletion src/lds_lds02rr.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
// limitations under the License.

#pragma once
#include "lds.h"
#include "LDS.h"
#include "PID_v1_0_0.h"

class LDS_LDSRR02 : public LDS {
Expand Down
42 changes: 21 additions & 21 deletions src/lds_ydlidar_x4.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,14 @@
// Copyright 2015 - 2018 EAI TEAM http://www.eaibot.com
// https://github.com/EAIBOT/ydlidar_arduino

#include "lds_ydlidar_x4.h"
#include "LDS_YDLIDAR_X4.h"

LDS_YDLidarX4::LDS_YDLidarX4() : LDS() {
LDS_YDLIDAR_X4::LDS_YDLIDAR_X4() : LDS() {
motor_enabled = false;
target_scan_freq = sampling_rate = ERROR_UNKNOWN;
}

LDS::result_t LDS_YDLidarX4::start() {
LDS::result_t LDS_YDLIDAR_X4::start() {
// Initialize
enableMotor(false);

Expand Down Expand Up @@ -93,29 +93,29 @@ LDS::result_t LDS_YDLidarX4::start() {
return LDS::RESULT_OK;
}

uint32_t LDS_YDLidarX4::getSerialBaudRate() {
uint32_t LDS_YDLIDAR_X4::getSerialBaudRate() {
return 128000;
}

float LDS_YDLidarX4::getCurrentScanFreqHz() {
float LDS_YDLIDAR_X4::getCurrentScanFreqHz() {
return ERROR_NOT_IMPLEMENTED;
}

float LDS_YDLidarX4::getTargetScanFreqHz() {
float LDS_YDLIDAR_X4::getTargetScanFreqHz() {
return target_scan_freq;
}

int LDS_YDLidarX4::getSamplingRateHz() {
int LDS_YDLIDAR_X4::getSamplingRateHz() {
return sampling_rate;
}

void LDS_YDLidarX4::stop() {
void LDS_YDLIDAR_X4::stop() {
if (isActive())
abort();
enableMotor(false);
}

void LDS_YDLidarX4::enableMotor(bool enable) {
void LDS_YDLIDAR_X4::enableMotor(bool enable) {
motor_enabled = enable;

setMotorPin(DIR_INPUT, LDS_MOTOR_PWM_PIN);
Expand All @@ -125,23 +125,23 @@ void LDS_YDLidarX4::enableMotor(bool enable) {
setMotorPin(enable ? VALUE_HIGH : VALUE_LOW, LDS_MOTOR_EN_PIN);
}

bool LDS_YDLidarX4::isActive() {
bool LDS_YDLIDAR_X4::isActive() {
return motor_enabled;
}

LDS::result_t LDS_YDLidarX4::setScanTargetFreqHz(float freq) {
LDS::result_t LDS_YDLIDAR_X4::setScanTargetFreqHz(float freq) {
return ERROR_NOT_IMPLEMENTED;
}

LDS::result_t LDS_YDLidarX4::setScanPIDSamplePeriodMs(uint32_t sample_period_ms) {
LDS::result_t LDS_YDLIDAR_X4::setScanPIDSamplePeriodMs(uint32_t sample_period_ms) {
return ERROR_NOT_IMPLEMENTED;
}

LDS::result_t LDS_YDLidarX4::setScanPIDCoeffs(float Kp, float Ki, float Kd) {
LDS::result_t LDS_YDLIDAR_X4::setScanPIDCoeffs(float Kp, float Ki, float Kd) {
return ERROR_NOT_IMPLEMENTED;
}

LDS::result_t LDS_YDLidarX4::waitScanDot() {
LDS::result_t LDS_YDLIDAR_X4::waitScanDot() {
static int recvPos = 0;
static uint8_t package_Sample_Num = 0;
static int package_recvPos = 0;
Expand Down Expand Up @@ -399,18 +399,18 @@ LDS::result_t LDS_YDLidarX4::waitScanDot() {
return LDS::RESULT_OK;
}

void LDS_YDLidarX4::loop() {
void LDS_YDLIDAR_X4::loop() {
result_t result = waitScanDot();
if (result < 0)
postError(result, "waitScanDot()");
}

LDS::result_t LDS_YDLidarX4::abort() {
LDS::result_t LDS_YDLIDAR_X4::abort() {
// stop the scanPoint operation
return sendCommand(LIDAR_CMD_FORCE_STOP, NULL, 0);
}

LDS::result_t LDS_YDLidarX4::sendCommand(uint8_t cmd, const void * payload, size_t payloadsize) {
LDS::result_t LDS_YDLIDAR_X4::sendCommand(uint8_t cmd, const void * payload, size_t payloadsize) {
//send data to serial
cmd_packet pkt_header;
cmd_packet * header = &pkt_header;
Expand Down Expand Up @@ -439,7 +439,7 @@ LDS::result_t LDS_YDLidarX4::sendCommand(uint8_t cmd, const void * payload, size
return LDS::RESULT_OK;
}

LDS::result_t LDS_YDLidarX4::getDeviceInfo(device_info & info, uint32_t timeout) {
LDS::result_t LDS_YDLIDAR_X4::getDeviceInfo(device_info & info, uint32_t timeout) {
LDS::result_t ans;
uint8_t recvPos = 0;
uint32_t currentTs = millis();
Expand Down Expand Up @@ -473,7 +473,7 @@ LDS::result_t LDS_YDLidarX4::getDeviceInfo(device_info & info, uint32_t timeout)
return ERROR_TIMEOUT;
}

LDS::result_t LDS_YDLidarX4::waitResponseHeader(lidar_ans_header * header, uint32_t timeout) {
LDS::result_t LDS_YDLIDAR_X4::waitResponseHeader(lidar_ans_header * header, uint32_t timeout) {
// wait response header
int recvPos = 0;
uint32_t startTs = millis();
Expand Down Expand Up @@ -506,7 +506,7 @@ LDS::result_t LDS_YDLidarX4::waitResponseHeader(lidar_ans_header * header, uint3
}

// ask the YDLIDAR for its device health
LDS::result_t LDS_YDLidarX4::getHealth(device_health & health, uint32_t timeout) {
LDS::result_t LDS_YDLIDAR_X4::getHealth(device_health & health, uint32_t timeout) {
LDS::result_t ans;
uint8_t recvPos = 0;
uint32_t currentTs = millis();
Expand Down Expand Up @@ -540,7 +540,7 @@ LDS::result_t LDS_YDLidarX4::getHealth(device_health & health, uint32_t timeout)
return ERROR_TIMEOUT;
}

LDS::result_t LDS_YDLidarX4::startScan(bool force, uint32_t timeout ) {
LDS::result_t LDS_YDLIDAR_X4::startScan(bool force, uint32_t timeout ) {
// start the scanPoint operation
LDS::result_t ans;

Expand Down
6 changes: 3 additions & 3 deletions src/lds_ydlidar_x4.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,11 @@
// https://github.com/EAIBOT/ydlidar_arduino

#pragma once
#include "lds.h"
#include "LDS.h"

class LDS_YDLidarX4 : public LDS {
class LDS_YDLIDAR_X4 : public LDS {
public:
LDS_YDLidarX4();
LDS_YDLIDAR_X4();

result_t start();
void stop();
Expand Down

0 comments on commit e40b449

Please sign in to comment.