Commit Graph

17 Commits (8d65e926343166bde8266e1185f989135c84fac6)

Author SHA1 Message Date
wenchun 8d65e92634 fix(GUI): 共用 command/position client 啟動預建,修切mode觸發的OOM/CPU暴衝
實飛/SITL 對無人機下第一個控制指令(切 mode)時,python GUI 行程
CPU 衝到 112%、記憶體一路爬向 30GB 被 OOM killer 幹掉。

根因(切 mode 是執行期第一個走 get_or_create_client 的動作):
- get_or_create_client / get_or_create_position_client 原本 per-drone
  於執行期新建 ROS2 node 並 executor.add_node()。
- CPU:add_node 從 asyncio/Qt 執行緒呼叫,同時 _ros_spin_thread 在另一
  執行緒 spin_once 同一個 SingleThreadedExecutor → wait set 損毀 → 空轉。
- 記憶體:執行期新建 node = 新 DDS participant,discovery 撞壞封包 →
  FastRTPS bad_alloc。解釋了「開機沒事、切 mode 才炸」。

兩個 client 都只打單一 service(send_command_long / pos_global_int),
靠 request 的 target_sysid 路由、無 per-drone 狀態 → 每台一個節點無意義。

修法:改成「共用節點 + 啟動預建 + 執行期只重用」。
- communication.py: 兩個 per-drone dict → 單一 command_long_client /
  position_target_client;新增 init_shared_command_clients();
  get_or_create_*(drone_id=None) 回傳共用 client(僅留一次性 lazy fallback)。
- gui.py: executor 設好後、spin thread 啟動前於主執行緒預建;cleanup 改
  銷毀兩個共用節點。

飛行中不再新建 participant + add_node 不再跨執行緒 → 兩症狀同時消。
SITL 切 mode 實測不再暴衝。

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 month ago
ken910606 f141311173 2.7.0 logs 3 months ago
ken910606 5231cffcb2 Update GUI 2.6.0: trajectory, color, window, serial JSON 4 months ago
ken910606 81de964778 Merge branch 'master' of http://140.120.108.238:49308/chiyu1468/AirTrapMine 4 months ago
ken910606 c75537a977 Update GUI 2.5.0: Drone reboot 4 months ago
wenchun 8c62f891a8 fix(GUI): 修正實飛三個關鍵 bug — 高度偏移累加、Leader-Follower 不動、起點重疊
1. mission_planner: origin_alt 固定為 0,避免 GPS 橢球高度疊加到相對高度指令
2. mission_planner: 移除圓弧插值,直接用路徑點作為航點,消除微航點導致飛控無法執行
3. mission_planner: lookup 改為外推(extrapolate),解決偶數 rank 起終點重疊
4. communication: UDP/Serial 的 GLOBAL_POSITION_INT 補上 relative_alt 欄位

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4 months ago
ken910606 0b41ea0a1e Update GUI 2.3.1 4 months ago
ken910606 d2a5f6fad7 Update GUI 2.3.0: JSON in Serial 5 months ago
ken910606 edd15df3fc Update GUI 2.1.0: logs history tab, drone panel attitude, linear twist overview 5 months ago
ken910606 b9d6e0e2e0 Update GUI 2.0.7 group selected list 5 months ago
wenchun 0edc477df8 feat(mission): virtual-leader path following + 固定領隊 + barrier
- mission_planner: Leader-Follower 改用 arc-length 參數化(virtual
  leader),_build_center_path 以同心圓弧連接直線段,銳角退化成 hover
  單點並在該點放 rendezvous barrier,避免暴衝與編隊交叉
- mission_planner: rank 改以輸入順序為準,不再對投影排序,避免浮點噪音
  導致 run-to-run leader 漂移
- mission_group / gui: 新增 leader_drone_id 與「領隊」下拉選單,handle_
  route_confirmed 把指定領隊重排到 rank 0,整個縱隊順序固定如軍隊行進
- mission_executor: rendezvous barrier 釋放邏輯、fallback LOITER、send
  retry;加 barrier_timeout 保護
- command_sender / communication / navigation: 配合 setpoint 送達與
  Ros2 bridge 更新

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
5 months ago
ken910606 fc00ecb762 Update GUI 2.0.6 components and longCommand 5 months ago
ken910606 2c38376f9c Update master with local 2.0.5 5 months ago
ken910606 f28dcca361 Update master with local 2.0.4 5 months ago
ken910606 f34693a400 longCommand 6 months ago
ken910606 71321d4839 Update GUI 2.0.0 from local 6 months ago
ken910606 2937610938 Merge GUI 1.0.1 from ken 6 months ago