Commit Graph

39 Commits

Author SHA1 Message Date
f8705e1c49 fix(costmap): put every layer on one parameter flow
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. 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 bypassed the flow: it had no default file and
read the shared block itself, with the opposite precedence.

- copyParentParameters(): copy every key each layer reads.
  - StaticLayer: add enabled, first_map_only, subscribe_to_updates,
    use_maximum, trinary_costmap and base_frame_id.
  - Obstacle/VoxelLayer: add transform_tolerance,
    footprint_clearing_enabled and combination_method; VoxelLayer also
    gets enabled, max_obstacle_height and track_unknown_space.
  - InflationLayer: add enabled and inflate_unknown.
  - Add a DepthCameraObstacleLayer branch with its layer and per-source
    keys.
  - Drop copies that no layer reads (publish_voxel_map, layer-level
    obstacle_range and raytrace_range).
  - Keys are copied with the type the layer reads. A key that does not
    convert now throws: getParam() used to write 0, false or "" into the
    value, and that was copied as if configured.
- DepthCameraObstacleLayer::loadParameters(): read
  config/depth_camera_obstacle_layer_params.yaml, then "<costmap>/<plugin>",
  like ObstacleLayer. A missing file or block, or a value of the wrong
  type, throws. ParamReader is gone. With the shared block copied in,
  "<costmap>/<plugin>/<source>" exists, and the node_handle.cpp:265
  warning at start-up goes away.
- config/depth_camera_obstacle_layer_params.yaml: new, equal to the C++
  defaults. track_unknown_space is left out, so the layer still follows
  the costmap.
- depth_camera_obstacle_layer_test: point PNKX_NAV_CORE_CONFIG_DIR at the
  package. Add tests for a value of the wrong type and for a missing
  default file.
2026-10-22 10:25:53 +07:00
ae7fce9e77 fix(costmap): refuse to build a costmap with a failed layer
Costmap2DROBOT::getParams() logged a layer that threw from initialize()
and returned. The constructor then finished normally with a half-built
costmap: no failed layer, no layers after it, no footprint and no update
thread. move_base2 reported READY, and the only trace was a message
blaming plugin registration.

- costmap_2d_robot.cpp: a failing layer, a malformed plugins: list and a
  missing costmap_params.yaml now throw std::runtime_error with the
  costmap and layer name, after releasing layered_costmap_ (the
  destructor does not run when the constructor throws).
  NavigationRuntime::buildCostmaps() already turns this into an
  initialization error, so the host never reports READY.
- Static/Obstacle/Voxel/Inflation layers throw when their default file
  cannot be opened, instead of running with no parameters.
- VoxelLayer: z_resolution can be overridden from the costmap config
  like the other column keys; unknown_threshold is computed after the
  final z_voxels, so overriding z_voxels alone keeps it right; z_voxels,
  z_resolution, origin_z and the thresholds are range-checked; the
  effective column is logged once at start-up.
- config/obstacle_layer_params.yaml: drop the per-source keys. The layer
  reads them only under <plugin>/<source>/, so these were never used.
2026-10-22 09:46:11 +07:00
3b89add5ee refactor(obstacle_layer): drop the DepthCameraData startup guard
ObstacleLayer and VoxelLayer no longer carry any depth code, so the check
that rejected a DepthCameraData source or frustum_clearing_enabled goes too.
A DepthCameraData source still fails at startup through the generic
data_type check; frustum_clearing_enabled is now an unknown key.

The README and the LayerType comment now say the gateway feeds
DepthCameraObstacleLayer PointCloud2 only.
2026-10-21 14:10:55 +07:00
64974d48b7 feat(depth): DepthCameraObstacleLayer replaces depth clearing in ObstacleLayer/VoxelLayer
Depth cameras now go through their own costmap layer instead of the
frustum clearing that lived in ObstacleLayer and VoxelLayer.

- Add DepthCameraObstacleLayer. It stores marked points per costmap
  column, clears stored points inside each camera frustum with a kd-tree
  check against the new cloud, keeps points outside the view, groups
  points with Euclidean clustering, and does not mark a 12 cm band at the
  frustum faces.
- The layer follows the CostmapLayer contract: updateWithMax/Overwrite by
  combination_method, reset(), clearArea() with the usual invert
  semantics, footprint clearing, matchSize() and the layer mutex. So
  ClearCostmapRecovery and costmap resets work on it.
- Add LayerType::DEPTH_CAMERA_LAYER, appended last so the existing values
  keep their numbers. The host's SensorGateway must dispatch PointCloud2
  and DepthCameraData to it (move_base2 feature/depth-camera-layer-type).
- Remove the frustum clearing code from Observation, ObservationBuffer,
  ObstacleLayer, VoxelLayer and costmap_2d_robot.cpp.
- ObstacleLayer and VoxelLayer now reject a DepthCameraData source or
  frustum_clearing_enabled: true at startup, with a message that points
  to DepthCameraObstacleLayer.
- Link PCL into the plugins library only. Add 21 unit tests for the layer
  (depth_camera_obstacle_layer_test).

Squashed from feature/depth-observed-volume (2ca0bcc..40dc70e).
2026-10-21 13:16:07 +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
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
81e7874274 Duong update 2026-01-12 15:48:43 +07:00
9d3d31a4f9 include <robot/console.h> 2026-01-10 14:10:41 +07:00
b18aeb39ab replaced printf -> robot::console 2026-01-10 11:38:19 +07:00
384897b750 update from DuongTD 2026-01-08 10:35:27 +07:00
a8fc8cb9a4 Merge branch 'main' of https://git.pnkr.asia/DuongTD/costmap_2d into main 2026-01-06 17:37:52 +07:00
800e5c1735 update obstacle_layer 2026-01-06 17:33:13 +07:00
b6733ae04c update 2025-12-31 15:43:07 +07:00
ae469e3271 add function getTypeLayer 2025-12-31 10:11:12 +07:00
6c682712fe hiep update 2025-12-30 10:42:34 +07:00
72b2f3c639 Hiep update 2025-12-30 10:24:18 +07:00
4246453ae6 hiep sua ten file 2025-12-30 09:56:35 +07:00
2c3d7d586d HiepLM update 2025-12-30 09:08:14 +07:00
b807d2c187 Merge branch 'main' of https://git.pnkr.asia/DuongTD/costmap_2d into main 2025-12-24 14:21:14 +07:00
674fb07ad3 update 2025-12-24 14:19:29 +07:00
c53db2280e update load param using node handle 2025-12-11 17:16:46 +07:00
af43332b28 replace std::shared_ptr to boost::shared_ptr 2025-12-04 14:32:22 +07:00
4fb2554291 update file costmap_2d_robot and file config params 2025-12-03 11:36:06 +07:00
11ff1baa79 fix core dumped err when loadplugin 2025-12-01 17:34:23 +07:00
5ad8e83761 remove file data_convert 2025-11-26 16:27:41 +07:00
2e0a4348dd update file costmap_2d_robot 2025-11-26 15:00:26 +07:00
59ec58a018 add file costmap_2d_robot 2025-11-18 11:44:01 +07:00
0c61984d3e update to tf3 2025-11-17 15:04:11 +07:00
42840e3bbc update file voxel_layer 2025-11-17 10:50:23 +07:00
49a72383c8 update file voxel_layer 2025-11-15 17:36:52 +07:00
bd98bf4e08 update folder plugins 2025-11-13 17:39:09 +07:00
c94de60a7b update file obstacle_layer and file test plugin 2025-11-12 17:38:38 +07:00
19683269c3 update function dataCallBack and file test static layer 2025-11-11 14:28:20 +07:00
498b606e15 them file test static_layer 2025-11-07 17:44:42 +07:00
cdb9ded893 1738_29102025 2025-10-29 17:38:43 +07:00
7c1dcfd352 1720_28102025 2025-10-28 17:21:02 +07:00
5d8981eab6 first commit 2025-10-28 14:44:05 +07:00
63dc18f3f0 1726_24102025 2025-10-24 17:26:44 +07:00