@@ -338,90 +338,38 @@ increasing risk/effort. Each item is prefixed with a priority tag:
338338
339339---
340340
341- #### 13.6.1 Enum modernisation
342-
343- **[DONE]** Converted all plain `enum` to `enum class`, with redundant prefixes removed from values:
344-
345- | Old | New |
346- |-----|-----|
347- | `CAbstractNavigator::TState` — `IDLE`, `NAVIGATING`, `SUSPENDED`, `NAV_ERROR` | `enum class TState` — same values (`NAV_ERROR` kept to avoid clash with Windows `ERROR` macro) |
348- | `CAbstractNavigator::TErrorCode` — `ERR_NONE`, `ERR_EMERGENCY_STOP`, `ERR_CANNOT_REACH_TARGET`, `ERR_OTHER` | `enum class TErrorCode` — `NONE`, `EMERGENCY_STOP`, `CANNOT_REACH_TARGET`, `OTHER` |
349- | `CHolonomicND::TSituations` — `SITUATION_TARGET_DIRECTLY`, `SITUATION_SMALL_GAP`, `SITUATION_WIDE_GAP`, `SITUATION_NO_WAY_FOUND` | `enum class TSituations` — `TARGET_DIRECTLY`, `SMALL_GAP`, `WIDE_GAP`, `NO_WAY_FOUND` |
350- | `PTG_collision_behavior_t` — `COLL_BEH_BACK_AWAY`, `COLL_BEH_STOP` | `enum class PTGCollisionBehavior` — `BACK_AWAY`, `STOP` |
351-
352- ---
353-
354- #### 13.6.2 `[[nodiscard]]` annotations
355-
356- **[DONE]** Added `[[nodiscard]]` to:
357-
358- - `CAbstractNavigator`: `getCurrentState()`, `getErrorReason()`,
359- `getFrameTF()`, `isRethrowNavExceptionsEnabled()`, `getDelaysTimeLogger()`
360- - `CParameterizedTrajectoryGenerator`: `getDescription()`, `supportVelCmdNOP()`,
361- `supportSpeedAtTarget()`, `isInitialized()`, `getAlphaValuesCount()`,
362- `getPathCount()`, `getRefDistance()`, `getScorePriority()`,
363- `getClearanceStepCount()`, `getClearanceDecimatedPaths()`, `getPathStepCount()`,
364- `getPathPose()`, `getPathDist()`, `getPathStepDuration()`, `getMaxLinVel()`,
365- `getMaxAngVel()`, `getMaxRobotRadius()`, `isPointInsideRobotShape()`
366- - `CAbstractHolonomicReactiveMethod`: `getAssociatedPTG()`
367- - `CWaypointsNavigator`: `getWaypointsAccessGuard()`
341+ #### 13.6.2 `[[nodiscard]]` annotations (remaining)
368342
369343Still pending: `CAbstractPTGBasedReactive` getters, holonomic `TOptions` getters.
370344
371345---
372346
373- #### 13.6.3 Naming consistency
374-
375- **[PARTIAL]** Done:
376- - `CPTG_DiffDrive_CC/CCS/alpha`: replaced `os::sprintf` + `(int)K` casts with
377- `mrpt::format()` + `static_cast<int>(K)`.
347+ #### 13.6.3 Naming consistency (remaining)
378348
379- Remaining:
380- - **Config structs**: Holonomic classes use `TOptions`; navigator classes use `TParams`.
381- Pick one suffix uniformly.
382- - **STEP-numbered methods**: `STEP1_InitPTGs()` … `STEP8_GenerateLogRecord()` —
383- rename to descriptive names.
384- - **`impl_` prefix**: Standardise virtual hook naming convention.
349+ - **Config structs**: Holonomic classes use `TOptions`; navigator/optimizer/graphslam
350+ classes use `TParams`. Low-value cosmetic change across multiple modules — deferred.
385351
386352---
387353
388- #### 13.6.4 Thread-safety fixes
389-
390- **[DONE]**:
391- - `CAbstractPTGBasedReactive::preDestructor()`: replaced bare
392- `m_nav_cs.lock(); m_nav_cs.unlock()` with `{ std::scoped_lock lck(m_nav_cs); }`.
393- - `CWaypointsNavigator`: replaced `beginWaypointsAccess()` / `endWaypointsAccess()`
394- with `getWaypointsAccessGuard()` returning a `WaypointsAccessGuard` RAII object
395- that holds `std::unique_lock<std::recursive_mutex>` and exposes `waypoints()`.
354+ #### 13.6.4 Thread-safety fixes (remaining)
396355
397- Remaining: global mutable `OUTPUT_DEBUG_PATH_PREFIX` / `COLLISION_BEHAVIOR` statics
356+ Global mutable `OUTPUT_DEBUG_PATH_PREFIX` / `COLLISION_BEHAVIOR` statics
398357have no synchronisation — consider moving to per-instance fields or guarding with mutex.
399358
400359---
401360
402- #### 13.6.5 Return-value modernisation (output-reference cleanup)
403-
404- **[TODO — P1]** Key candidates:
361+ #### 13.6.5 Return-value modernisation (remaining)
405362
406363| Method | Current | Proposed |
407364|--------|---------|----------|
408365| `CRobot2NavInterface::getCurrentPoseAndSpeeds()` | 4 output `&` params | Return `struct PoseAndSpeeds { TPose2D pose; TTwist2D vel; … };` |
409- | `CAbstractHolonomicReactiveMethod::navigate()` | `NavOutput&` | Return `NavOutput` by value |
410- | `CMultiObjectiveMotionOptimizerBase::decide()` | `int&` best index | Return `std::optional<size_t>` (nullopt = no good motion) |
411366| `CParameterizedTrajectoryGenerator::inverseMap_WS2TP()` | `int& k, double& d` output | Return `std::optional<std::pair<uint16_t,double>>` |
412367
413368---
414369
415- #### 13.6.6 Raw-pointer cleanup
416-
417- **[DONE — documented]**: Both `m_associatedPTG` in `CAbstractHolonomicReactiveMethod`
418- and `TCandidateMovementPTG::PTG` are non-owning observer raw pointers. Both are now
419- documented explicitly as such, with lifetime contract stated. Since `nullptr` is a valid
420- state and the PTG lifetime is guaranteed by the owning reactive system, a raw pointer
421- is the correct tool; `std::weak_ptr` would require the entire PTG ownership chain to
422- be changed to shared ownership.
370+ #### 13.6.6 Raw-pointer cleanup (remaining)
423371
424- Remaining: `CAbstractPTGBasedReactive::getHoloMethod()` returns a raw pointer;
372+ `CAbstractPTGBasedReactive::getHoloMethod()` returns a raw pointer;
425373consider returning `CAbstractHolonomicReactiveMethod&` (with assert) for non-nullable
426374use sites.
427375
@@ -435,10 +383,10 @@ logging, obstacle processing, velocity generation, and profiling) is the
435383single largest maintenance burden. Proposed decomposition:
436384
4373851. **Extract `PTGSetManager`** — owns the `vector<CParameterizedTrajectoryGenerator::Ptr>`,
438- handles `STEP1_InitPTGs ()`, `getPTG()`, `getPTG_count()`,
386+ handles `initPTGs ()`, `getPTG()`, `getPTG_count()`,
439387 collision-grid builds.
4403882. **Extract `NavigationLogger`** — owns the `CLogFileRecord`,
441- `m_critZoneLastLog`, log-file path management, `STEP8_GenerateLogRecord ()`.
389+ `m_critZoneLastLog`, log-file path management, `generateLogRecord ()`.
4423903. **Extract `VelocityFilter`** — owns `TSentVelCmd`, the speed-filter
443391 tau, and `filterVelocityCommand()`.
4443924. Keep the main class as a thin orchestrator that wires the above
@@ -462,37 +410,9 @@ abstraction. Each should be broken into named helpers:
462410
463411---
464412
465- #### 13.6.9 Magic numbers → named constants
466-
467- **[DONE]**
468- - `CHolonomicVFF.cpp`: `1e6` → `MAX_FORCE_CAP`, `20.0` → `OBSTACLE_WEIGHT_FACTOR`,
469- `6.0` → `OBSTACLE_NEARNESS_THRESHOLD`.
470- - `CHolonomicND.cpp`: `0.02` → `DIRECT_PATH_SECTOR_FRACTION`,
471- `1.05` → `DIRECT_PATH_DIST_MARGIN`, `0.95` → `DIRECT_PATH_RANGE_FRACTION`,
472- `0.01` → `MIN_TARGET_DIST`.
473- - `CHolonomicFullEval.cpp` (`evalSingleTarget`): `1.02` → `OBSTACLE_PAST_TARGET_MARGIN`,
474- `0.95` → `TARGET_DIST_SAFETY_FRACTION`, `1.05` → `TARGET_CLEARANCE_MARGIN`,
475- `1.01` → `SQRT_DOMAIN_EPS`, `0.1` → `CLEARANCE_WINDOW_HALF_FRACTION`,
476- `0.99` → `FREE_SPACE_THRESHOLD`, `4.0` → `SECTOR_DIST_WEIGHT`,
477- `0.1` → `BLOCKED_DIR_SCORE_PENALTY`.
478-
479- ---
480-
481- #### 13.6.10 Test coverage
413+ #### 13.6.10 Test coverage (remaining)
482414
483- **[PARTIAL]** Added `tests/holonomic_unittest.cpp` covering:
484-
485- - `CHolonomicVFF` in isolation (5 tests: heading accuracy × 3, speed
486- bounds, slow-down near target, behaviour with blocked obstacles).
487- - `CHolonomicND` in isolation (4 tests: heading accuracy × 2, speed
488- bounds, detour when target direction blocked).
489- - `CHolonomicFullEval` in isolation (5 tests: heading accuracy × 3, speed
490- bounds, repeated calls / hysteresis stability). Also fixed two latent
491- bugs: default `TOptions` had 7 factorWeights for `NUM_FACTORS=8`, and
492- factor[7] (heading) dereferenced `ptg` without a null guard.
493- - `ClearanceDiagram` (4 tests: construction, resize, clear, resize-twice).
494-
495- Still zero dedicated tests for:
415+ Zero dedicated unit tests for:
496416
497417- `CWaypointsNavigator` / `TWaypointSequence` state machine.
498418- `CNavigatorManualSequence`.
@@ -501,28 +421,6 @@ Still zero dedicated tests for:
501421
502422---
503423
504- #### 13.6.11 Documentation
505-
506- **[DONE]** `lib_mrpt_nav.md` expanded to a full reference including:
507- navigator state machine, waypoint sequencing (RAII guard API), TP-Space
508- reactive core, holonomic methods table, PTG class table, robot interface
509- guide, and path planning overview.
510-
511- ---
512-
513- #### 13.6.12 Remaining code-quality items
514-
515- **[DONE]** Quick wins completed:
516-
517- - `MRPT_TODO("Optimize getNearestNode() with KD-tree!")` in
518- `PlannerRRT_SE2_TPS.cpp` — converted to plain `// TODO:` comment.
519- - `static size_t SAVE_LOG_SOLVE_COUNT` — kept (used to name debug log
520- files across solve() calls, guarded by `params.save_3d_log_freq > 0`).
521- - `CLogFileRecord::serializeFrom()` raw `new` — replaced with
522- `std::make_shared` (three sites).
523- - C-style casts `(int)K` — replaced with `static_cast<int>(K)` in
524- `CPTG_DiffDrive_CC.cpp`, `CPTG_DiffDrive_CCS.cpp`, `CPTG_DiffDrive_alpha.cpp`.
525-
526424### 13.7 `mrpt_maps` — Miscellaneous
527425
528426- **`CObservationRotatingScan`**: `// TODO: populate organizedPoints?`
0 commit comments