add file costmap_2d_robot
This commit is contained in:
@@ -329,23 +329,23 @@ bool Costmap2D::worldToMap(double wx, double wy, unsigned int& mx, unsigned int&
|
||||
|
||||
## 🟠 **VẤN ĐỀ TRONG CMAKELISTS.TXT**
|
||||
|
||||
### 9. **Hardcoded path đến tf2 library**
|
||||
### 9. **Hardcoded path đến tf3 library**
|
||||
|
||||
**File:** `CMakeLists.txt:135`
|
||||
|
||||
```cmake
|
||||
set(TF2_LIBRARY /usr/lib/libtf2.so) # ❌ Hardcoded path
|
||||
set(tf3_LIBRARY /usr/lib/libtf3.so) # ❌ Hardcoded path
|
||||
```
|
||||
|
||||
**Vấn đề:**
|
||||
- Không portable, sẽ fail trên các hệ thống khác
|
||||
- Nên dùng `find_package(tf2)` hoặc `find_library()`
|
||||
- Nên dùng `find_package(tf3)` hoặc `find_library()`
|
||||
|
||||
**Giải pháp:**
|
||||
```cmake
|
||||
find_package(tf2 REQUIRED)
|
||||
find_package(tf3 REQUIRED)
|
||||
# hoặc
|
||||
find_library(TF2_LIBRARY tf2 PATHS /usr/lib /usr/local/lib)
|
||||
find_library(tf3_LIBRARY tf3 PATHS /usr/lib /usr/local/lib)
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
Reference in New Issue
Block a user