106 lines
2.2 KiB
Markdown
106 lines
2.2 KiB
Markdown
# LiDAR Manager Web (Test3)
|
|
|
|
Chức năng:
|
|
- Đăng ký danh sách cảm biến LiDAR (tên, ip, port)
|
|
- Đăng ký IMU (tên, frame_id, topic, nguồn) và pose trên robot
|
|
- Kéo thả icon LiDAR/IMU trên canvas để set vị trí (robot frame)
|
|
- Nhiều layout — mỗi layout lưu tại `data/models/{id}.json`; catalog trong `data/state.json`
|
|
|
|
## Build
|
|
|
|
```bash
|
|
cd /home/robotics/RD/Test3
|
|
cmake -S . -B build
|
|
cmake --build build -j
|
|
```
|
|
|
|
## Run
|
|
|
|
Chạy mặc định port 8080, phục vụ static từ `www/`, dữ liệu ở `data/state.json`:
|
|
|
|
```bash
|
|
./build/lidar_manager_web
|
|
```
|
|
|
|
Hoặc chỉ định:
|
|
|
|
```bash
|
|
./build/lidar_manager_web 8080 ./www ./data/state.json
|
|
```
|
|
|
|
Mở trình duyệt: `http://localhost:8080/`
|
|
|
|
## Docker (giới hạn 2 CPU, 4 GB RAM)
|
|
|
|
Mô phỏng cấu hình controller tối thiểu SICK (Dual-Core, 4 GB) trên máy dev:
|
|
|
|
```bash
|
|
cd /home/robotics/RD/Test3
|
|
sudo docker compose up --build -d
|
|
# hoặc: sudo ./scripts/docker-up.sh
|
|
```
|
|
|
|
Kiểm tra giới hạn:
|
|
|
|
```bash
|
|
sudo ./scripts/docker-stats.sh
|
|
```
|
|
|
|
Dừng:
|
|
|
|
```bash
|
|
sudo docker compose down
|
|
```
|
|
|
|
Dữ liệu layout vẫn lưu tại `data/` trên host (volume mount).
|
|
|
|
Kiểm tra tài nguyên trong container:
|
|
|
|
```bash
|
|
# Vào shell container
|
|
sudo docker exec -it lidar-manager-limited bash
|
|
# hoặc: sudo ./scripts/docker-shell.sh
|
|
|
|
# Trong container, thử:
|
|
htop # CPU/RAM (q để thoát)
|
|
free -h # RAM
|
|
nproc # số CPU nhìn thấy
|
|
ps aux # process
|
|
cat /proc/meminfo | head
|
|
```
|
|
|
|
```bash
|
|
sudo ./scripts/docker-htop.sh
|
|
sudo ./scripts/docker-stats.sh
|
|
```
|
|
|
|
## Test tự động
|
|
|
|
Chạy toàn bộ: unit C++ (GTest), API smoke (`curl`), pytest integration.
|
|
|
|
```bash
|
|
cd /home/robotics/RD/Test3
|
|
chmod +x scripts/run-tests.sh scripts/api-smoke.sh
|
|
./scripts/run-tests.sh
|
|
```
|
|
|
|
Chỉ unit test C++:
|
|
|
|
```bash
|
|
cmake -S . -B build -DBUILD_TESTING=ON
|
|
cmake --build build -j
|
|
ctest --test-dir build --output-on-failure
|
|
```
|
|
|
|
Chỉ API smoke (server đang chạy, dùng fixture `tests/fixtures/data/`):
|
|
|
|
```bash
|
|
./build/lidar_manager_web 18080 www tests/fixtures/data/state.json &
|
|
./scripts/api-smoke.sh http://127.0.0.1:18080
|
|
```
|
|
|
|
Fixture mission id mặc định: `testmission00001` (`tests/fixtures/data/missions.json`).
|
|
|
|
CI: GitHub Actions workflow `.github/workflows/test.yml`.
|
|
|