16 Commits

Author SHA1 Message Date
40488b7632 feat(costmap_2d): direction zones and map readiness
- DirectionalLayer rewritten as a DirectionFieldProvider. It no longer
  derives from StaticLayer and never writes the master grid. It takes an
  OccupancyGrid of direction codes (0 = no constraint, 1..8 =
  direction_index + 1) on direction_topic, validates it against the
  master geometry and global frame, and publishes an immutable
  DirectionField snapshot with a DISABLED / PENDING / READY state and a
  generation counter. Every static map on map_topic returns the layer to
  PENDING until a grid for that map arrives.
- direction_field.h is the core API for planners: grid validation,
  bounds-checked codeAt(), a half-open-cell DDA (traverseGridSegment),
  allowedDirectionMask() and checkSegment().
  LayeredCostmap::getDirectionFieldSnapshot() exposes the snapshot
  without adding data members.
- max_deviation_deg (default 90, valid 0 < x < 180). The field carries
  the value so every planner uses the same rule; 90 keeps the previous
  masks bit for bit.
- StaticLayer ignores an OccupancyGrid addressed to another layer's
  topic instead of logging two unthrottled errors per push.
- StaticLayer and its subclasses report current only after updateCosts
  has written the newest map (markMapWritten, also used by
  CriticalLayer). Readiness flags are written under the master mutex;
  invalid partial updates are rejected with a throttled error.

Full history: branch feature/direction-zone.
2026-11-04 13:24:16 +07:00
757b381659 feat(depth_layer): add occlusion_guard and attach_distance
occlusion_guard (default false): keep a stored point when a nearer object blocks the ray to it, clear a point the camera sees through. attach_distance (default 0.12 m, as before) is now read per source. Both keys are forwarded from the parent costmap parameters. README, params YAML and tests updated.
2026-10-27 13:09:31 +07:00
e40e9c0104 fix(costmap): one parameter flow for every layer; fail on a bad layer
Each layer reads its default file under $PNKX_NAV_CORE_CONFIG_DIR/config,
then overrides a key from "<costmap>/<plugin>".
Costmap2DROBOT::copyParentParameters() copies the shared "<plugin>:"
block there first. This was broken in three ways:
- the copy lists covered only part of what the layers read, so a key set
  in the shared block was dropped without a word;
- DepthCameraObstacleLayer had no default file and read the shared block
  itself;
- a layer that failed to initialize left a half-built costmap that
  reported READY.

Failing loudly:
- costmap_2d_robot.cpp: a failing layer, a malformed plugins: list or a
  missing costmap_params.yaml throws std::runtime_error with the costmap
  and layer name, after releasing layered_costmap_.
  NavigationRuntime::buildCostmaps() turns this into an initialization
  error, so the host never reports READY.
- Static/Obstacle/Voxel/Inflation and DepthCameraObstacleLayer throw when
  their default file cannot be opened.
- A key whose value does not convert to the type the layer reads throws.
  getParam() used to write 0, false or "" into the value, and that was
  copied as if configured.

One flow:
- copyParentParameters() copies every key each layer reads, with the
  layer's type, including a new DepthCameraObstacleLayer branch. Copies no
  layer reads are dropped.
- DepthCameraObstacleLayer::loadParameters() reads
  config/depth_camera_obstacle_layer_params.yaml (new, equal to the C++
  defaults), then "<costmap>/<plugin>". ParamReader is gone, and so is the
  node_handle.cpp:265 warning at start-up.
- VoxelLayer: z_resolution can be overridden; unknown_threshold is
  computed after the final z_voxels; the column keys are range-checked;
  the effective column is logged once at start-up.
- config/obstacle_layer_params.yaml: drop the per-source keys the layer
  never read there.
- depth_camera_obstacle_layer_test: set PNKX_NAV_CORE_CONFIG_DIR; add
  tests for a wrong type and a missing default file.

Squash of fix/config-flow (ae7fce9, f8705e1). Checked on the KIT robot on
22/10/2026:
- the depth layer summary at start-up is unchanged;
- a shared-block key now reaches VoxelLayer;
- FOV_W 3.5, z_voxels 17, a wrong-typed key and a missing default file
  each give INITIALIZATION_FAILED.
2026-10-22 10:49:31 +07:00
a63c084002 Bring main up to the dev_cam_intel line
main had not moved since 11 July, while the depth-camera work continued on
dev_cam_intel for six weeks. The two branches did not diverge by accident: they
ended up holding two different clearing designs for the same layer.

main carried frustum clearing as VoxelLayer members - frustum_clearing_enabled_,
a pixel step and a min/max range - driven from costmap_2d_robot. dev_cam_intel
replaced that with a full-column clearing pass whose configuration lives per
observation, so the layer keeps no frustum state of its own.

This commit takes the dev_cam_intel tree whole. It is the line running on the
robot, the one rb_ws points at, and the one the NUC measurements were taken
against; the frustum design is superseded rather than merged, and stays in
history at 45c8227 if it is ever wanted back.

Squashed deliberately: the nineteen commits behind it are a working diary -
metrics that were added and removed, test toggles, an optimal-run series - and
none of that is worth carrying onto a branch other trees track.
2026-08-27 13:41:42 +07:00
45c8227f5c change topic and msg depth camera 2026-07-11 10:09:55 +07:00
faa57d9c93 change topic and msg depth camera 2026-07-11 09:50:40 +07:00
a2a021c114 add function computeCost file layer.h 2026-07-10 11:27:20 +07:00
b66bd7c751 DuongTD gui zalo 2026-01-10 10:16:51 +07:00
72b2f3c639 Hiep update 2025-12-30 10:24:18 +07:00
0344c31e5b update 2025-12-25 11:06:15 +07:00
10521c1629 update 2025-12-24 17:16:05 +07:00
c53db2280e update load param using node handle 2025-12-11 17:16:46 +07:00
d37daab594 fix file utils 2025-12-08 11:03:49 +07:00
4fb2554291 update file costmap_2d_robot and file config params 2025-12-03 11:36:06 +07:00
64db092d46 update file config and loadParam 2025-12-02 15:02:39 +07:00
cdb9ded893 1738_29102025 2025-10-29 17:38:43 +07:00