From 1606818c77e6d211a9f68f0f01581ebc96b913a6 Mon Sep 17 00:00:00 2001 From: Chi Huu Huynh <73843190+Chi-EEE@users.noreply.github.com> Date: Thu, 7 Dec 2023 16:40:30 +0000 Subject: [PATCH] Move files and make library directory for RPLidar --- Car-Application.code-workspace | 14 ++++---- .../backend}/.vscode/c_cpp_properties.json | 0 .../backend}/.vscode/settings.json | 0 {backend => app/backend}/Doxyfile | 0 .../backend}/include/utils/Utility.hpp | 0 .../j/json-schema-validator-/port/xmake.lua | 0 .../j/json-schema-validator-/xmake.lua | 0 .../repository/packages/p/pca9685/xmake.lua | 0 .../repository/packages/w/wiringpi/xmake.lua | 0 {backend => app/backend}/settings/config.json | 0 .../src/controllers/DynamicController.hpp | 0 .../src/controllers/RoomController.hpp | 0 .../src/controllers/WebSocketChat.hpp | 0 {backend => app/backend}/src/main.cpp | 0 {backend => app/backend}/src/room/Room.hpp | 0 .../backend}/src/room/RoomManager.hpp | 0 {backend => app/backend}/src/room/User.hpp | 0 .../backend}/src/room/UserType.hpp | 0 {backend => app/backend}/src/test.py | 0 {backend => app/backend}/xmake.lua | 0 {frontend => app/frontend}/.gitignore | 0 {frontend => app/frontend}/.npmrc | 0 {frontend => app/frontend}/README.md | 0 {frontend => app/frontend}/package.json | 0 {frontend => app/frontend}/pnpm-lock.yaml | 0 {frontend => app/frontend}/src/app.d.ts | 0 {frontend => app/frontend}/src/app.html | 0 .../frontend}/src/lib/LidarStream.svelte | 0 .../frontend/src/lib/WebSocketStore.ts | 0 {frontend => app/frontend}/src/lib/index.ts | 0 .../frontend}/src/routes/+layout.js | 0 .../frontend}/src/routes/+page.svelte | 0 .../frontend}/src/routes/room/[slug]/+page.js | 0 .../src/routes/room/[slug]/+page.svelte | 0 {frontend => app/frontend}/static/favicon.png | Bin {frontend => app/frontend}/svelte.config.js | 0 {frontend => app/frontend}/tsconfig.json | 0 {frontend => app/frontend}/vite.config.ts | 0 {lidar => app/raspberry_pi}/.gitignore | 0 .../.vscode/c_cpp_properties.json | 0 {raspberry_pi => app/raspberry_pi}/Doxyfile | 0 {raspberry_pi => app/raspberry_pi}/SETUP.md | 0 {raspberry_pi => app/raspberry_pi}/WHY.md | 0 .../raspberry_pi}/include/global/Config.hpp | 0 .../include/rplidar/ExpressPacket.hpp | 0 .../raspberry_pi}/include/rplidar/RPLidar.cpp | 4 +-- .../raspberry_pi}/include/rplidar/RPLidar.h | 0 .../j/json-schema-validator-/port/xmake.lua | 0 .../j/json-schema-validator-/xmake.lua | 0 .../repository/packages/p/pca9685/xmake.lua | 0 .../repository/packages/w/wiringpi/xmake.lua | 0 .../raspberry_pi}/settings/config.jsonc | 0 .../src/car/display/CarConsole.hpp | 0 .../src/car/system/CarSystem.cpp | 0 .../raspberry_pi}/src/car/system/CarSystem.h | 0 .../src/car/system/lidar/LidarDevice.hpp | 0 .../src/car/system/lidar/LidarDummy.hpp | 0 .../src/car/system/lidar/LidarScanner.hpp | 0 .../car/system/messaging/MessagingSystem.hpp | 0 .../system/messaging/commands/MoveCommand.hpp | 0 .../system/messaging/commands/TurnCommand.hpp | 0 .../raspberry_pi}/src/main.cpp | 0 {raspberry_pi => app/raspberry_pi}/xmake.lua | 0 .../RPLidar}/include/ExpressPacket.hpp | 0 .../RPLidar}/include/RPLidar.h | 0 .../RPLidar/src}/RPLidar.cpp | 0 libraries/RPLidar/test/test.cpp | 32 ++++++++++++++++++ libraries/RPLidar/xmake.lua | 16 +++++++++ {raspberry_pi => old/lidar}/.gitignore | 0 {lidar => old/lidar}/src/main.cpp | 0 {lidar => old/lidar}/xmake.lua | 0 71 files changed, 56 insertions(+), 10 deletions(-) rename {backend => app/backend}/.vscode/c_cpp_properties.json (100%) rename {backend => app/backend}/.vscode/settings.json (100%) rename {backend => app/backend}/Doxyfile (100%) rename {backend => app/backend}/include/utils/Utility.hpp (100%) rename {backend => app/backend}/repository/packages/j/json-schema-validator-/port/xmake.lua (100%) rename {backend => app/backend}/repository/packages/j/json-schema-validator-/xmake.lua (100%) rename {backend => app/backend}/repository/packages/p/pca9685/xmake.lua (100%) rename {backend => app/backend}/repository/packages/w/wiringpi/xmake.lua (100%) rename {backend => app/backend}/settings/config.json (100%) rename {backend => app/backend}/src/controllers/DynamicController.hpp (100%) rename {backend => app/backend}/src/controllers/RoomController.hpp (100%) rename {backend => app/backend}/src/controllers/WebSocketChat.hpp (100%) rename {backend => app/backend}/src/main.cpp (100%) rename {backend => app/backend}/src/room/Room.hpp (100%) rename {backend => app/backend}/src/room/RoomManager.hpp (100%) rename {backend => app/backend}/src/room/User.hpp (100%) rename {backend => app/backend}/src/room/UserType.hpp (100%) rename {backend => app/backend}/src/test.py (100%) rename {backend => app/backend}/xmake.lua (100%) rename {frontend => app/frontend}/.gitignore (100%) rename {frontend => app/frontend}/.npmrc (100%) rename {frontend => app/frontend}/README.md (100%) rename {frontend => app/frontend}/package.json (100%) rename {frontend => app/frontend}/pnpm-lock.yaml (100%) rename {frontend => app/frontend}/src/app.d.ts (100%) rename {frontend => app/frontend}/src/app.html (100%) rename {frontend => app/frontend}/src/lib/LidarStream.svelte (100%) rename frontend/src/lib/WebsocketStore.ts => app/frontend/src/lib/WebSocketStore.ts (100%) rename {frontend => app/frontend}/src/lib/index.ts (100%) rename {frontend => app/frontend}/src/routes/+layout.js (100%) rename {frontend => app/frontend}/src/routes/+page.svelte (100%) rename {frontend => app/frontend}/src/routes/room/[slug]/+page.js (100%) rename {frontend => app/frontend}/src/routes/room/[slug]/+page.svelte (100%) rename {frontend => app/frontend}/static/favicon.png (100%) rename {frontend => app/frontend}/svelte.config.js (100%) rename {frontend => app/frontend}/tsconfig.json (100%) rename {frontend => app/frontend}/vite.config.ts (100%) rename {lidar => app/raspberry_pi}/.gitignore (100%) rename {raspberry_pi => app/raspberry_pi}/.vscode/c_cpp_properties.json (100%) rename {raspberry_pi => app/raspberry_pi}/Doxyfile (100%) rename {raspberry_pi => app/raspberry_pi}/SETUP.md (100%) rename {raspberry_pi => app/raspberry_pi}/WHY.md (100%) rename {raspberry_pi => app/raspberry_pi}/include/global/Config.hpp (100%) rename {raspberry_pi => app/raspberry_pi}/include/rplidar/ExpressPacket.hpp (100%) rename {raspberry_pi => app/raspberry_pi}/include/rplidar/RPLidar.cpp (99%) rename {raspberry_pi => app/raspberry_pi}/include/rplidar/RPLidar.h (100%) rename {raspberry_pi => app/raspberry_pi}/repository/packages/j/json-schema-validator-/port/xmake.lua (100%) rename {raspberry_pi => app/raspberry_pi}/repository/packages/j/json-schema-validator-/xmake.lua (100%) rename {raspberry_pi => app/raspberry_pi}/repository/packages/p/pca9685/xmake.lua (100%) rename {raspberry_pi => app/raspberry_pi}/repository/packages/w/wiringpi/xmake.lua (100%) rename {raspberry_pi => app/raspberry_pi}/settings/config.jsonc (100%) rename {raspberry_pi => app/raspberry_pi}/src/car/display/CarConsole.hpp (100%) rename {raspberry_pi => app/raspberry_pi}/src/car/system/CarSystem.cpp (100%) rename {raspberry_pi => app/raspberry_pi}/src/car/system/CarSystem.h (100%) rename {raspberry_pi => app/raspberry_pi}/src/car/system/lidar/LidarDevice.hpp (100%) rename {raspberry_pi => app/raspberry_pi}/src/car/system/lidar/LidarDummy.hpp (100%) rename {raspberry_pi => app/raspberry_pi}/src/car/system/lidar/LidarScanner.hpp (100%) rename {raspberry_pi => app/raspberry_pi}/src/car/system/messaging/MessagingSystem.hpp (100%) rename {raspberry_pi => app/raspberry_pi}/src/car/system/messaging/commands/MoveCommand.hpp (100%) rename {raspberry_pi => app/raspberry_pi}/src/car/system/messaging/commands/TurnCommand.hpp (100%) rename {raspberry_pi => app/raspberry_pi}/src/main.cpp (100%) rename {raspberry_pi => app/raspberry_pi}/xmake.lua (100%) rename {backend => libraries/RPLidar}/include/ExpressPacket.hpp (100%) rename {backend => libraries/RPLidar}/include/RPLidar.h (100%) rename {backend/include => libraries/RPLidar/src}/RPLidar.cpp (100%) create mode 100644 libraries/RPLidar/test/test.cpp create mode 100644 libraries/RPLidar/xmake.lua rename {raspberry_pi => old/lidar}/.gitignore (100%) rename {lidar => old/lidar}/src/main.cpp (100%) rename {lidar => old/lidar}/xmake.lua (100%) diff --git a/Car-Application.code-workspace b/Car-Application.code-workspace index 46369724..195545b1 100644 --- a/Car-Application.code-workspace +++ b/Car-Application.code-workspace @@ -4,19 +4,16 @@ "path": "." }, { - "path": "backend" + "path": "app/backend" }, { - "path": "frontend" + "path": "app/frontend" }, { - "path": "raspberry_pi" + "path": "app/raspberry_pi" }, { - "path": "tcp" - }, - { - "path": "legacy" + "path": "old/legacy" } ], "settings": { @@ -111,7 +108,8 @@ "source_location": "cpp", "shared_mutex": "cpp", "cinttypes": "cpp", - "filesystem": "cpp" + "filesystem": "cpp", + "variant": "cpp" } } } \ No newline at end of file diff --git a/backend/.vscode/c_cpp_properties.json b/app/backend/.vscode/c_cpp_properties.json similarity index 100% rename from backend/.vscode/c_cpp_properties.json rename to app/backend/.vscode/c_cpp_properties.json diff --git a/backend/.vscode/settings.json b/app/backend/.vscode/settings.json similarity index 100% rename from backend/.vscode/settings.json rename to app/backend/.vscode/settings.json diff --git a/backend/Doxyfile b/app/backend/Doxyfile similarity index 100% rename from backend/Doxyfile rename to app/backend/Doxyfile diff --git a/backend/include/utils/Utility.hpp b/app/backend/include/utils/Utility.hpp similarity index 100% rename from backend/include/utils/Utility.hpp rename to app/backend/include/utils/Utility.hpp diff --git a/backend/repository/packages/j/json-schema-validator-/port/xmake.lua b/app/backend/repository/packages/j/json-schema-validator-/port/xmake.lua similarity index 100% rename from backend/repository/packages/j/json-schema-validator-/port/xmake.lua rename to app/backend/repository/packages/j/json-schema-validator-/port/xmake.lua diff --git a/backend/repository/packages/j/json-schema-validator-/xmake.lua b/app/backend/repository/packages/j/json-schema-validator-/xmake.lua similarity index 100% rename from backend/repository/packages/j/json-schema-validator-/xmake.lua rename to app/backend/repository/packages/j/json-schema-validator-/xmake.lua diff --git a/backend/repository/packages/p/pca9685/xmake.lua b/app/backend/repository/packages/p/pca9685/xmake.lua similarity index 100% rename from backend/repository/packages/p/pca9685/xmake.lua rename to app/backend/repository/packages/p/pca9685/xmake.lua diff --git a/backend/repository/packages/w/wiringpi/xmake.lua b/app/backend/repository/packages/w/wiringpi/xmake.lua similarity index 100% rename from backend/repository/packages/w/wiringpi/xmake.lua rename to app/backend/repository/packages/w/wiringpi/xmake.lua diff --git a/backend/settings/config.json b/app/backend/settings/config.json similarity index 100% rename from backend/settings/config.json rename to app/backend/settings/config.json diff --git a/backend/src/controllers/DynamicController.hpp b/app/backend/src/controllers/DynamicController.hpp similarity index 100% rename from backend/src/controllers/DynamicController.hpp rename to app/backend/src/controllers/DynamicController.hpp diff --git a/backend/src/controllers/RoomController.hpp b/app/backend/src/controllers/RoomController.hpp similarity index 100% rename from backend/src/controllers/RoomController.hpp rename to app/backend/src/controllers/RoomController.hpp diff --git a/backend/src/controllers/WebSocketChat.hpp b/app/backend/src/controllers/WebSocketChat.hpp similarity index 100% rename from backend/src/controllers/WebSocketChat.hpp rename to app/backend/src/controllers/WebSocketChat.hpp diff --git a/backend/src/main.cpp b/app/backend/src/main.cpp similarity index 100% rename from backend/src/main.cpp rename to app/backend/src/main.cpp diff --git a/backend/src/room/Room.hpp b/app/backend/src/room/Room.hpp similarity index 100% rename from backend/src/room/Room.hpp rename to app/backend/src/room/Room.hpp diff --git a/backend/src/room/RoomManager.hpp b/app/backend/src/room/RoomManager.hpp similarity index 100% rename from backend/src/room/RoomManager.hpp rename to app/backend/src/room/RoomManager.hpp diff --git a/backend/src/room/User.hpp b/app/backend/src/room/User.hpp similarity index 100% rename from backend/src/room/User.hpp rename to app/backend/src/room/User.hpp diff --git a/backend/src/room/UserType.hpp b/app/backend/src/room/UserType.hpp similarity index 100% rename from backend/src/room/UserType.hpp rename to app/backend/src/room/UserType.hpp diff --git a/backend/src/test.py b/app/backend/src/test.py similarity index 100% rename from backend/src/test.py rename to app/backend/src/test.py diff --git a/backend/xmake.lua b/app/backend/xmake.lua similarity index 100% rename from backend/xmake.lua rename to app/backend/xmake.lua diff --git a/frontend/.gitignore b/app/frontend/.gitignore similarity index 100% rename from frontend/.gitignore rename to app/frontend/.gitignore diff --git a/frontend/.npmrc b/app/frontend/.npmrc similarity index 100% rename from frontend/.npmrc rename to app/frontend/.npmrc diff --git a/frontend/README.md b/app/frontend/README.md similarity index 100% rename from frontend/README.md rename to app/frontend/README.md diff --git a/frontend/package.json b/app/frontend/package.json similarity index 100% rename from frontend/package.json rename to app/frontend/package.json diff --git a/frontend/pnpm-lock.yaml b/app/frontend/pnpm-lock.yaml similarity index 100% rename from frontend/pnpm-lock.yaml rename to app/frontend/pnpm-lock.yaml diff --git a/frontend/src/app.d.ts b/app/frontend/src/app.d.ts similarity index 100% rename from frontend/src/app.d.ts rename to app/frontend/src/app.d.ts diff --git a/frontend/src/app.html b/app/frontend/src/app.html similarity index 100% rename from frontend/src/app.html rename to app/frontend/src/app.html diff --git a/frontend/src/lib/LidarStream.svelte b/app/frontend/src/lib/LidarStream.svelte similarity index 100% rename from frontend/src/lib/LidarStream.svelte rename to app/frontend/src/lib/LidarStream.svelte diff --git a/frontend/src/lib/WebsocketStore.ts b/app/frontend/src/lib/WebSocketStore.ts similarity index 100% rename from frontend/src/lib/WebsocketStore.ts rename to app/frontend/src/lib/WebSocketStore.ts diff --git a/frontend/src/lib/index.ts b/app/frontend/src/lib/index.ts similarity index 100% rename from frontend/src/lib/index.ts rename to app/frontend/src/lib/index.ts diff --git a/frontend/src/routes/+layout.js b/app/frontend/src/routes/+layout.js similarity index 100% rename from frontend/src/routes/+layout.js rename to app/frontend/src/routes/+layout.js diff --git a/frontend/src/routes/+page.svelte b/app/frontend/src/routes/+page.svelte similarity index 100% rename from frontend/src/routes/+page.svelte rename to app/frontend/src/routes/+page.svelte diff --git a/frontend/src/routes/room/[slug]/+page.js b/app/frontend/src/routes/room/[slug]/+page.js similarity index 100% rename from frontend/src/routes/room/[slug]/+page.js rename to app/frontend/src/routes/room/[slug]/+page.js diff --git a/frontend/src/routes/room/[slug]/+page.svelte b/app/frontend/src/routes/room/[slug]/+page.svelte similarity index 100% rename from frontend/src/routes/room/[slug]/+page.svelte rename to app/frontend/src/routes/room/[slug]/+page.svelte diff --git a/frontend/static/favicon.png b/app/frontend/static/favicon.png similarity index 100% rename from frontend/static/favicon.png rename to app/frontend/static/favicon.png diff --git a/frontend/svelte.config.js b/app/frontend/svelte.config.js similarity index 100% rename from frontend/svelte.config.js rename to app/frontend/svelte.config.js diff --git a/frontend/tsconfig.json b/app/frontend/tsconfig.json similarity index 100% rename from frontend/tsconfig.json rename to app/frontend/tsconfig.json diff --git a/frontend/vite.config.ts b/app/frontend/vite.config.ts similarity index 100% rename from frontend/vite.config.ts rename to app/frontend/vite.config.ts diff --git a/lidar/.gitignore b/app/raspberry_pi/.gitignore similarity index 100% rename from lidar/.gitignore rename to app/raspberry_pi/.gitignore diff --git a/raspberry_pi/.vscode/c_cpp_properties.json b/app/raspberry_pi/.vscode/c_cpp_properties.json similarity index 100% rename from raspberry_pi/.vscode/c_cpp_properties.json rename to app/raspberry_pi/.vscode/c_cpp_properties.json diff --git a/raspberry_pi/Doxyfile b/app/raspberry_pi/Doxyfile similarity index 100% rename from raspberry_pi/Doxyfile rename to app/raspberry_pi/Doxyfile diff --git a/raspberry_pi/SETUP.md b/app/raspberry_pi/SETUP.md similarity index 100% rename from raspberry_pi/SETUP.md rename to app/raspberry_pi/SETUP.md diff --git a/raspberry_pi/WHY.md b/app/raspberry_pi/WHY.md similarity index 100% rename from raspberry_pi/WHY.md rename to app/raspberry_pi/WHY.md diff --git a/raspberry_pi/include/global/Config.hpp b/app/raspberry_pi/include/global/Config.hpp similarity index 100% rename from raspberry_pi/include/global/Config.hpp rename to app/raspberry_pi/include/global/Config.hpp diff --git a/raspberry_pi/include/rplidar/ExpressPacket.hpp b/app/raspberry_pi/include/rplidar/ExpressPacket.hpp similarity index 100% rename from raspberry_pi/include/rplidar/ExpressPacket.hpp rename to app/raspberry_pi/include/rplidar/ExpressPacket.hpp diff --git a/raspberry_pi/include/rplidar/RPLidar.cpp b/app/raspberry_pi/include/rplidar/RPLidar.cpp similarity index 99% rename from raspberry_pi/include/rplidar/RPLidar.cpp rename to app/raspberry_pi/include/rplidar/RPLidar.cpp index b7387903..9f0755aa 100644 --- a/raspberry_pi/include/rplidar/RPLidar.cpp +++ b/app/raspberry_pi/include/rplidar/RPLidar.cpp @@ -175,8 +175,8 @@ namespace rplidar { tl::expected, std::string> RPLidar::_read_descriptor() { // Read descriptor packet - std::vector descriptor(DESCRIPTOR_LEN); - this->_serial->read(descriptor.data(), DESCRIPTOR_LEN); + std::string descriptor(DESCRIPTOR_LEN, '\0'); + this->_serial->read(reinterpret_cast(&descriptor[0]), DESCRIPTOR_LEN); spdlog::debug("Received descriptor: {}", spdlog::to_hex(descriptor)); if (descriptor.size() != DESCRIPTOR_LEN) diff --git a/raspberry_pi/include/rplidar/RPLidar.h b/app/raspberry_pi/include/rplidar/RPLidar.h similarity index 100% rename from raspberry_pi/include/rplidar/RPLidar.h rename to app/raspberry_pi/include/rplidar/RPLidar.h diff --git a/raspberry_pi/repository/packages/j/json-schema-validator-/port/xmake.lua b/app/raspberry_pi/repository/packages/j/json-schema-validator-/port/xmake.lua similarity index 100% rename from raspberry_pi/repository/packages/j/json-schema-validator-/port/xmake.lua rename to app/raspberry_pi/repository/packages/j/json-schema-validator-/port/xmake.lua diff --git a/raspberry_pi/repository/packages/j/json-schema-validator-/xmake.lua b/app/raspberry_pi/repository/packages/j/json-schema-validator-/xmake.lua similarity index 100% rename from raspberry_pi/repository/packages/j/json-schema-validator-/xmake.lua rename to app/raspberry_pi/repository/packages/j/json-schema-validator-/xmake.lua diff --git a/raspberry_pi/repository/packages/p/pca9685/xmake.lua b/app/raspberry_pi/repository/packages/p/pca9685/xmake.lua similarity index 100% rename from raspberry_pi/repository/packages/p/pca9685/xmake.lua rename to app/raspberry_pi/repository/packages/p/pca9685/xmake.lua diff --git a/raspberry_pi/repository/packages/w/wiringpi/xmake.lua b/app/raspberry_pi/repository/packages/w/wiringpi/xmake.lua similarity index 100% rename from raspberry_pi/repository/packages/w/wiringpi/xmake.lua rename to app/raspberry_pi/repository/packages/w/wiringpi/xmake.lua diff --git a/raspberry_pi/settings/config.jsonc b/app/raspberry_pi/settings/config.jsonc similarity index 100% rename from raspberry_pi/settings/config.jsonc rename to app/raspberry_pi/settings/config.jsonc diff --git a/raspberry_pi/src/car/display/CarConsole.hpp b/app/raspberry_pi/src/car/display/CarConsole.hpp similarity index 100% rename from raspberry_pi/src/car/display/CarConsole.hpp rename to app/raspberry_pi/src/car/display/CarConsole.hpp diff --git a/raspberry_pi/src/car/system/CarSystem.cpp b/app/raspberry_pi/src/car/system/CarSystem.cpp similarity index 100% rename from raspberry_pi/src/car/system/CarSystem.cpp rename to app/raspberry_pi/src/car/system/CarSystem.cpp diff --git a/raspberry_pi/src/car/system/CarSystem.h b/app/raspberry_pi/src/car/system/CarSystem.h similarity index 100% rename from raspberry_pi/src/car/system/CarSystem.h rename to app/raspberry_pi/src/car/system/CarSystem.h diff --git a/raspberry_pi/src/car/system/lidar/LidarDevice.hpp b/app/raspberry_pi/src/car/system/lidar/LidarDevice.hpp similarity index 100% rename from raspberry_pi/src/car/system/lidar/LidarDevice.hpp rename to app/raspberry_pi/src/car/system/lidar/LidarDevice.hpp diff --git a/raspberry_pi/src/car/system/lidar/LidarDummy.hpp b/app/raspberry_pi/src/car/system/lidar/LidarDummy.hpp similarity index 100% rename from raspberry_pi/src/car/system/lidar/LidarDummy.hpp rename to app/raspberry_pi/src/car/system/lidar/LidarDummy.hpp diff --git a/raspberry_pi/src/car/system/lidar/LidarScanner.hpp b/app/raspberry_pi/src/car/system/lidar/LidarScanner.hpp similarity index 100% rename from raspberry_pi/src/car/system/lidar/LidarScanner.hpp rename to app/raspberry_pi/src/car/system/lidar/LidarScanner.hpp diff --git a/raspberry_pi/src/car/system/messaging/MessagingSystem.hpp b/app/raspberry_pi/src/car/system/messaging/MessagingSystem.hpp similarity index 100% rename from raspberry_pi/src/car/system/messaging/MessagingSystem.hpp rename to app/raspberry_pi/src/car/system/messaging/MessagingSystem.hpp diff --git a/raspberry_pi/src/car/system/messaging/commands/MoveCommand.hpp b/app/raspberry_pi/src/car/system/messaging/commands/MoveCommand.hpp similarity index 100% rename from raspberry_pi/src/car/system/messaging/commands/MoveCommand.hpp rename to app/raspberry_pi/src/car/system/messaging/commands/MoveCommand.hpp diff --git a/raspberry_pi/src/car/system/messaging/commands/TurnCommand.hpp b/app/raspberry_pi/src/car/system/messaging/commands/TurnCommand.hpp similarity index 100% rename from raspberry_pi/src/car/system/messaging/commands/TurnCommand.hpp rename to app/raspberry_pi/src/car/system/messaging/commands/TurnCommand.hpp diff --git a/raspberry_pi/src/main.cpp b/app/raspberry_pi/src/main.cpp similarity index 100% rename from raspberry_pi/src/main.cpp rename to app/raspberry_pi/src/main.cpp diff --git a/raspberry_pi/xmake.lua b/app/raspberry_pi/xmake.lua similarity index 100% rename from raspberry_pi/xmake.lua rename to app/raspberry_pi/xmake.lua diff --git a/backend/include/ExpressPacket.hpp b/libraries/RPLidar/include/ExpressPacket.hpp similarity index 100% rename from backend/include/ExpressPacket.hpp rename to libraries/RPLidar/include/ExpressPacket.hpp diff --git a/backend/include/RPLidar.h b/libraries/RPLidar/include/RPLidar.h similarity index 100% rename from backend/include/RPLidar.h rename to libraries/RPLidar/include/RPLidar.h diff --git a/backend/include/RPLidar.cpp b/libraries/RPLidar/src/RPLidar.cpp similarity index 100% rename from backend/include/RPLidar.cpp rename to libraries/RPLidar/src/RPLidar.cpp diff --git a/libraries/RPLidar/test/test.cpp b/libraries/RPLidar/test/test.cpp new file mode 100644 index 00000000..55ff8dd4 --- /dev/null +++ b/libraries/RPLidar/test/test.cpp @@ -0,0 +1,32 @@ +#include + +int main() +{ + auto lidar = RPLidar("COM3"); + + auto info = lidar.get_info(); + std::cout << fmt::format("model: {}, firmware: ({}, {}), hardware: {}, serialnumber: {}\n", info.model, info.firmware.first, info.firmware.second, info.hardware, info.serialNumber); + + auto health = lidar.get_health(); + std::cout << fmt::format("({}, {})\n", health.status, health.errorCode); + + std::function()> scanGenerator = lidar.iter_scans(); + for (int i = 0; i < 10; i++) + { + std::vector scan = scanGenerator(); + std::cout << "Got " << scan.size() << " Measures!\n"; + for (const Measure &measure : scan) + { + // Access individual measurements in the scan + bool newScan = measure.newScan; + int quality = measure.quality; + float angle = measure.angle; + float distance = measure.distance; + } + } + + lidar.stop(); + lidar.stop_motor(); + lidar.disconnect(); + return 0; +} \ No newline at end of file diff --git a/libraries/RPLidar/xmake.lua b/libraries/RPLidar/xmake.lua new file mode 100644 index 00000000..c4c94cfe --- /dev/null +++ b/libraries/RPLidar/xmake.lua @@ -0,0 +1,16 @@ +add_requires("serial", "spdlog") + +target("RPLidar") + set_kind("static") + add_files("src/*.cpp") + add_headerfiles("include/(**.h)") + add_headerfiles("include/(**.hpp)") + add_includedirs("include") + add_packages("serial", "spdlog") + +target("test") + set_kind("binary") + add_files("test/*.cpp") + add_includedirs("include") + add_deps("RPLidar") + add_links("RPLidar") \ No newline at end of file diff --git a/raspberry_pi/.gitignore b/old/lidar/.gitignore similarity index 100% rename from raspberry_pi/.gitignore rename to old/lidar/.gitignore diff --git a/lidar/src/main.cpp b/old/lidar/src/main.cpp similarity index 100% rename from lidar/src/main.cpp rename to old/lidar/src/main.cpp diff --git a/lidar/xmake.lua b/old/lidar/xmake.lua similarity index 100% rename from lidar/xmake.lua rename to old/lidar/xmake.lua