-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Ilia O.
authored and
Ilia O.
committed
Aug 17, 2024
1 parent
6bbe362
commit 4b5899f
Showing
3 changed files
with
96 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
// Copyright 2023-2024 REMAKE.AI, KAIA.AI, MAKERSPET.COM | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// Based on https://github.com/YDLIDAR/lidarCar/ | ||
|
||
#include "LDS_YDLIDAR_SCL.h" | ||
|
||
const char* LDS_YDLIDAR_SCL::getModelName() { return "YDLIDAR SCL"; } | ||
|
||
LDS::result_t LDS_YDLIDAR_SCL::start() { | ||
enableMotor(true); | ||
postInfo(INFO_MODEL, getModelName()); | ||
return LDS::RESULT_OK; | ||
} | ||
|
||
uint32_t LDS_YDLIDAR_SCL::getSerialBaudRate() { | ||
return 115200; | ||
} | ||
|
||
float LDS_YDLIDAR_SCL::getTargetScanFreqHz() { | ||
return DEFAULT_VALUE; | ||
} | ||
|
||
int LDS_YDLIDAR_SCL::getSamplingRateHz() { | ||
return 3000; | ||
} | ||
|
||
float LDS_YDLIDAR_SCL::getCurrentScanFreqHz() { | ||
return LDS_YDLIDAR_X4::getCurrentScanFreqHz(); | ||
} | ||
|
||
LDS::result_t LDS_YDLIDAR_SCL::stop() { | ||
enableMotor(false); | ||
return RESULT_OK; | ||
} | ||
|
||
void LDS_YDLIDAR_SCL::enableMotor(bool enable) { | ||
motor_enabled = enable; | ||
|
||
if (enable) { | ||
// Drive PWM | ||
//setMotorPin(DIR_INPUT, LDS_MOTOR_PWM_PIN); | ||
setMotorPin(DIR_OUTPUT_CONST, LDS_MOTOR_PWM_PIN); | ||
setMotorPin(VALUE_HIGH, LDS_MOTOR_PWM_PIN); | ||
} else { | ||
setMotorPin(DIR_OUTPUT_CONST, LDS_MOTOR_PWM_PIN); | ||
setMotorPin(VALUE_LOW, LDS_MOTOR_PWM_PIN); | ||
} | ||
|
||
// Entire LDS on/off | ||
//setMotorPin(enable ? VALUE_HIGH : VALUE_LOW, LDS_MOTOR_PWM_PIN); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// Copyright 2023-2024 REMAKE.AI, KAIA.AI, MAKERSPET.COM | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// Based on https://github.com/YDLIDAR/lidarCar/ | ||
|
||
#pragma once | ||
#include "LDS_YDLIDAR_X4.h" | ||
|
||
class LDS_YDLIDAR_SCL : public LDS_YDLIDAR_X4 { | ||
public: | ||
virtual result_t start() override; | ||
virtual result_t stop() override; | ||
virtual const char* getModelName() override; | ||
|
||
virtual float getCurrentScanFreqHz() override; | ||
virtual uint32_t getSerialBaudRate() override; | ||
virtual float getTargetScanFreqHz() override; | ||
virtual int getSamplingRateHz() override; | ||
protected: | ||
virtual void enableMotor(bool enable) override; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters