63 lines
2.1 KiB
C++
63 lines
2.1 KiB
C++
#ifndef VORONOI_ROUTE_PARAMS_H_
|
|
#define VORONOI_ROUTE_PARAMS_H_
|
|
|
|
#include <string>
|
|
#include <vector>
|
|
|
|
#include "voronoi_route/map_convert.h"
|
|
#include "voronoi_route/types.h"
|
|
#include "voronoi_route/voronoi_route.h"
|
|
|
|
namespace voronoi_route {
|
|
|
|
/**
|
|
* @brief Operator-facing parameters, in metres — the contents of `voronoi_route_params.yaml`.
|
|
*
|
|
* The library computes in cells; convert with the map's resolution at load time. Defaults here
|
|
* are the ones in the packaged YAML; a missing key keeps the default and the loader says so.
|
|
*/
|
|
struct RouteParams {
|
|
// graph
|
|
double min_edge_length_m = 0.3;
|
|
double spur_clearance_ratio = 1.2;
|
|
double min_component_length_m = 2.0;
|
|
double min_clearance_m = 0.3;
|
|
double attach_max_radius_m = 10.0;
|
|
int graph_rebuild_min_changed_cells = 200;
|
|
double full_rebuild_fraction = 0.02;
|
|
// corridor
|
|
double half_width_min_m = 1.5;
|
|
double clearance_scale = 0.8;
|
|
double half_width_max_m = 6.0;
|
|
// bundle
|
|
bool write_gvd = true;
|
|
bool write_dist = true;
|
|
bool write_preview = true;
|
|
bool write_graph_image = true;
|
|
bool write_graph_overlay = false;
|
|
// obstacle: luật "ô nào là vật cản" của riêng gói này, không đọc chéo sang config gói khác.
|
|
bool track_unknown_space = true;
|
|
int lethal_cost_threshold = 100;
|
|
int unknown_cost_value = -1;
|
|
bool trinary_costmap = true;
|
|
// obstacle.unknown: false traversable, true obstacle — quyết định thẳng, không suy từ khoá nào khác.
|
|
bool unknown_is_obstacle = false;
|
|
// obstacle.roi_margin_m: < 0 = off
|
|
double roi_margin_m = 0.5;
|
|
|
|
VoronoiRoute::Config toConfig(double resolution_m) const;
|
|
CorridorParams toCorridor(double resolution_m) const;
|
|
/** Obstacle rule for this map's resolution, resolved from the fields above only. */
|
|
ObstacleRule toObstacleRule(double resolution_m) const;
|
|
};
|
|
|
|
/**
|
|
* @brief Clamp out-of-range values to something safe and describe each fix. Empty vector = all
|
|
* good. Never throws: a bad number in a YAML must not stop a map from being compiled.
|
|
*/
|
|
std::vector<std::string> validateRouteParams(RouteParams* p);
|
|
|
|
} // namespace voronoi_route
|
|
|
|
#endif // VORONOI_ROUTE_PARAMS_H_
|