Skip to content

Commit

Permalink
Adds angular_tolerance to the build configurations for malidrive Road…
Browse files Browse the repository at this point in the history
…Networks in the applications.

Signed-off-by: Agustin Alba Chicar <ag.albachicar@gmail.com>
  • Loading branch information
agalbachicar committed Apr 16, 2024
1 parent 89b5ea6 commit fa5c410
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 38 deletions.
4 changes: 2 additions & 2 deletions src/applications/maliput_derive_lane_s_routes.cc
Original file line number Diff line number Diff line change
Expand Up @@ -318,8 +318,8 @@ int main(int argc, char* argv[]) {
auto rn = LoadRoadNetwork(
maliput_implementation,
{FLAGS_num_lanes, FLAGS_length, FLAGS_lane_width, FLAGS_shoulder_width, FLAGS_maximum_height}, {yaml_file},
{xodr_file, GetLinearToleranceFlag(), GetMaxLinearToleranceFlag(), FLAGS_build_policy, FLAGS_num_threads,
FLAGS_simplification_policy, FLAGS_standard_strictness_policy, FLAGS_omit_nondrivable_lanes,
{xodr_file, GetLinearToleranceFlag(), GetMaxLinearToleranceFlag(), GetAngularToleranceFlag(), FLAGS_build_policy,
FLAGS_num_threads, FLAGS_simplification_policy, FLAGS_standard_strictness_policy, FLAGS_omit_nondrivable_lanes,
FLAGS_rule_registry_file, FLAGS_road_rule_book_file, FLAGS_traffic_light_book_file, FLAGS_phase_ring_book_file,
FLAGS_intersection_book_file},
{FLAGS_osm_file, FLAGS_linear_tolerance, FLAGS_angular_tolerance, maliput::math::Vector2::FromStr(FLAGS_origin),
Expand Down
14 changes: 7 additions & 7 deletions src/applications/maliput_dynamic_environment.cc
Original file line number Diff line number Diff line change
Expand Up @@ -174,13 +174,13 @@ int Main(int argc, char* argv[]) {
auto rn = LoadRoadNetwork(
maliput_implementation,
{FLAGS_num_lanes, FLAGS_length, FLAGS_lane_width, FLAGS_shoulder_width, FLAGS_maximum_height}, {FLAGS_yaml_file},
{FLAGS_xodr_file_path, GetLinearToleranceFlag(), GetMaxLinearToleranceFlag(), FLAGS_build_policy,
FLAGS_num_threads, FLAGS_simplification_policy, FLAGS_standard_strictness_policy, FLAGS_omit_nondrivable_lanes,
FLAGS_rule_registry_file, FLAGS_road_rule_book_file, FLAGS_traffic_light_book_file, FLAGS_phase_ring_book_file,
FLAGS_intersection_book_file},
{FLAGS_osm_file, FLAGS_linear_tolerance, FLAGS_angular_tolerance, maliput::math::Vector2::FromStr(FLAGS_origin),
FLAGS_rule_registry_file, FLAGS_road_rule_book_file, FLAGS_traffic_light_book_file, FLAGS_phase_ring_book_file,
FLAGS_intersection_book_file});
{FLAGS_xodr_file_path, GetLinearToleranceFlag(), GetMaxLinearToleranceFlag(), GetAngularToleranceFlag(),
FLAGS_build_policy, FLAGS_num_threads, FLAGS_simplification_policy, FLAGS_standard_strictness_policy,
FLAGS_omit_nondrivable_lanes, FLAGS_rule_registry_file, FLAGS_road_rule_book_file, FLAGS_traffic_light_book_file,
FLAGS_phase_ring_book_file, FLAGS_intersection_book_file},
{FLAGS_osm_file, FLAGS_linear_tolerance, FLAGS_max_linear_tolerance,
maliput::math::Vector2::FromStr(FLAGS_origin), FLAGS_rule_registry_file, FLAGS_road_rule_book_file,
FLAGS_traffic_light_book_file, FLAGS_phase_ring_book_file, FLAGS_intersection_book_file});
log()->info("RoadNetwork loaded successfully.");

const std::unique_ptr<const Timer> timer = CreateTimer(TimerType::kChronoTimer);
Expand Down
5 changes: 5 additions & 0 deletions src/applications/maliput_gflags.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@
return gflags::GetCommandLineFlagInfoOrDie("max_linear_tolerance").is_default \
? std::nullopt \
: std::make_optional<double>(FLAGS_max_linear_tolerance); \
} \
std::optional<double> GetAngularToleranceFlag() { \
return gflags::GetCommandLineFlagInfoOrDie("angular_tolerance").is_default \
? std::nullopt \
: std::make_optional<double>(FLAGS_angular_tolerance); \
}
#endif // MALIDRIVE_PROPERTIES_FLAGS

Expand Down
14 changes: 7 additions & 7 deletions src/applications/maliput_measure_load_time.cc
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,13 @@ int Main(int argc, char* argv[]) {
maliput_implementation,
{FLAGS_num_lanes, FLAGS_length, FLAGS_lane_width, FLAGS_shoulder_width, FLAGS_maximum_height},
{FLAGS_yaml_file},
{FLAGS_xodr_file_path, GetLinearToleranceFlag(), GetMaxLinearToleranceFlag(), FLAGS_build_policy,
FLAGS_num_threads, FLAGS_simplification_policy, FLAGS_standard_strictness_policy, FLAGS_omit_nondrivable_lanes,
FLAGS_rule_registry_file, FLAGS_road_rule_book_file, FLAGS_traffic_light_book_file, FLAGS_phase_ring_book_file,
FLAGS_intersection_book_file},
{FLAGS_osm_file, FLAGS_linear_tolerance, FLAGS_angular_tolerance, maliput::math::Vector2::FromStr(FLAGS_origin),
FLAGS_rule_registry_file, FLAGS_road_rule_book_file, FLAGS_traffic_light_book_file, FLAGS_phase_ring_book_file,
FLAGS_intersection_book_file}));
{FLAGS_xodr_file_path, GetLinearToleranceFlag(), GetMaxLinearToleranceFlag(), GetAngularToleranceFlag(),
FLAGS_build_policy, FLAGS_num_threads, FLAGS_simplification_policy, FLAGS_standard_strictness_policy,
FLAGS_omit_nondrivable_lanes, FLAGS_rule_registry_file, FLAGS_road_rule_book_file,
FLAGS_traffic_light_book_file, FLAGS_phase_ring_book_file, FLAGS_intersection_book_file},
{FLAGS_osm_file, FLAGS_linear_tolerance, FLAGS_max_linear_tolerance,
maliput::math::Vector2::FromStr(FLAGS_origin), FLAGS_rule_registry_file, FLAGS_road_rule_book_file,
FLAGS_traffic_light_book_file, FLAGS_phase_ring_book_file, FLAGS_intersection_book_file}));
}
const double mean_time = (std::accumulate(times.begin(), times.end(), 0.)) / static_cast<double>(times.size());
maliput::log()->info("\tMean time was: ", mean_time, "s out of ", FLAGS_iterations, " iterations.\n");
Expand Down
14 changes: 7 additions & 7 deletions src/applications/maliput_query.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1099,13 +1099,13 @@ int Main(int argc, char* argv[]) {
auto rn = LoadRoadNetwork(
maliput_implementation,
{FLAGS_num_lanes, FLAGS_length, FLAGS_lane_width, FLAGS_shoulder_width, FLAGS_maximum_height}, {FLAGS_yaml_file},
{FLAGS_xodr_file_path, GetLinearToleranceFlag(), GetMaxLinearToleranceFlag(), FLAGS_build_policy,
FLAGS_num_threads, FLAGS_simplification_policy, FLAGS_standard_strictness_policy, FLAGS_omit_nondrivable_lanes,
FLAGS_rule_registry_file, FLAGS_road_rule_book_file, FLAGS_traffic_light_book_file, FLAGS_phase_ring_book_file,
FLAGS_intersection_book_file},
{FLAGS_osm_file, FLAGS_linear_tolerance, FLAGS_angular_tolerance, maliput::math::Vector2::FromStr(FLAGS_origin),
FLAGS_rule_registry_file, FLAGS_road_rule_book_file, FLAGS_traffic_light_book_file, FLAGS_phase_ring_book_file,
FLAGS_intersection_book_file});
{FLAGS_xodr_file_path, GetLinearToleranceFlag(), GetMaxLinearToleranceFlag(), GetAngularToleranceFlag(),
FLAGS_build_policy, FLAGS_num_threads, FLAGS_simplification_policy, FLAGS_standard_strictness_policy,
FLAGS_omit_nondrivable_lanes, FLAGS_rule_registry_file, FLAGS_road_rule_book_file, FLAGS_traffic_light_book_file,
FLAGS_phase_ring_book_file, FLAGS_intersection_book_file},
{FLAGS_osm_file, FLAGS_linear_tolerance, FLAGS_max_linear_tolerance,
maliput::math::Vector2::FromStr(FLAGS_origin), FLAGS_rule_registry_file, FLAGS_road_rule_book_file,
FLAGS_traffic_light_book_file, FLAGS_phase_ring_book_file, FLAGS_intersection_book_file});
MALIPUT_DEMAND(rn != nullptr);
log()->info("RoadNetwork loaded successfully.");

Expand Down
14 changes: 7 additions & 7 deletions src/applications/maliput_to_obj.cc
Original file line number Diff line number Diff line change
Expand Up @@ -114,13 +114,13 @@ int Main(int argc, char* argv[]) {
auto rn = LoadRoadNetwork(
maliput_implementation,
{FLAGS_num_lanes, FLAGS_length, FLAGS_lane_width, FLAGS_shoulder_width, FLAGS_maximum_height}, {FLAGS_yaml_file},
{FLAGS_xodr_file_path, GetLinearToleranceFlag(), GetMaxLinearToleranceFlag(), FLAGS_build_policy,
FLAGS_num_threads, FLAGS_simplification_policy, FLAGS_standard_strictness_policy, FLAGS_omit_nondrivable_lanes,
FLAGS_rule_registry_file, FLAGS_road_rule_book_file, FLAGS_traffic_light_book_file, FLAGS_phase_ring_book_file,
FLAGS_intersection_book_file},
{FLAGS_osm_file, FLAGS_linear_tolerance, FLAGS_angular_tolerance, maliput::math::Vector2::FromStr(FLAGS_origin),
FLAGS_rule_registry_file, FLAGS_road_rule_book_file, FLAGS_traffic_light_book_file, FLAGS_phase_ring_book_file,
FLAGS_intersection_book_file});
{FLAGS_xodr_file_path, GetLinearToleranceFlag(), GetMaxLinearToleranceFlag(), GetAngularToleranceFlag(),
FLAGS_build_policy, FLAGS_num_threads, FLAGS_simplification_policy, FLAGS_standard_strictness_policy,
FLAGS_omit_nondrivable_lanes, FLAGS_rule_registry_file, FLAGS_road_rule_book_file, FLAGS_traffic_light_book_file,
FLAGS_phase_ring_book_file, FLAGS_intersection_book_file},
{FLAGS_osm_file, FLAGS_linear_tolerance, FLAGS_max_linear_tolerance,
maliput::math::Vector2::FromStr(FLAGS_origin), FLAGS_rule_registry_file, FLAGS_road_rule_book_file,
FLAGS_traffic_light_book_file, FLAGS_phase_ring_book_file, FLAGS_intersection_book_file});
log()->info("RoadNetwork loaded successfully.");

// Creates the destination directory if it does not already exist.
Expand Down
14 changes: 7 additions & 7 deletions src/applications/maliput_to_string.cc
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,13 @@ int Main(int argc, char* argv[]) {
auto rn = LoadRoadNetwork(
maliput_implementation,
{FLAGS_num_lanes, FLAGS_length, FLAGS_lane_width, FLAGS_shoulder_width, FLAGS_maximum_height}, {FLAGS_yaml_file},
{FLAGS_xodr_file_path, GetLinearToleranceFlag(), GetMaxLinearToleranceFlag(), FLAGS_build_policy,
FLAGS_num_threads, FLAGS_simplification_policy, FLAGS_standard_strictness_policy, FLAGS_omit_nondrivable_lanes,
FLAGS_rule_registry_file, FLAGS_road_rule_book_file, FLAGS_traffic_light_book_file, FLAGS_phase_ring_book_file,
FLAGS_intersection_book_file},
{FLAGS_osm_file, FLAGS_linear_tolerance, FLAGS_angular_tolerance, maliput::math::Vector2::FromStr(FLAGS_origin),
FLAGS_rule_registry_file, FLAGS_road_rule_book_file, FLAGS_traffic_light_book_file, FLAGS_phase_ring_book_file,
FLAGS_intersection_book_file});
{FLAGS_xodr_file_path, GetLinearToleranceFlag(), GetMaxLinearToleranceFlag(), GetAngularToleranceFlag(),
FLAGS_build_policy, FLAGS_num_threads, FLAGS_simplification_policy, FLAGS_standard_strictness_policy,
FLAGS_omit_nondrivable_lanes, FLAGS_rule_registry_file, FLAGS_road_rule_book_file, FLAGS_traffic_light_book_file,
FLAGS_phase_ring_book_file, FLAGS_intersection_book_file},
{FLAGS_osm_file, FLAGS_linear_tolerance, FLAGS_max_linear_tolerance,
maliput::math::Vector2::FromStr(FLAGS_origin), FLAGS_rule_registry_file, FLAGS_road_rule_book_file,
FLAGS_traffic_light_book_file, FLAGS_phase_ring_book_file, FLAGS_intersection_book_file});
log()->info("RoadNetwork loaded successfully.");
if (FLAGS_check_invariants) {
log()->info("Checking invariants...");
Expand Down
4 changes: 3 additions & 1 deletion src/integration/tools.cc
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,9 @@ std::unique_ptr<api::RoadNetwork> CreateMalidriveRoadNetwork(const MalidriveBuil
road_network_configuration.emplace("max_linear_tolerance",
std::to_string(build_properties.max_linear_tolerance.value()));
}
road_network_configuration.emplace("angular_tolerance", std::to_string(malidrive::constants::kAngularTolerance));
if (build_properties.angular_tolerance.has_value()) {
road_network_configuration.emplace("angular_tolerance", std::to_string(build_properties.angular_tolerance.value()));
}
road_network_configuration.emplace("scale_length", std::to_string(malidrive::constants::kScaleLength));
road_network_configuration.emplace("inertial_to_backend_frame_translation", "{0., 0., 0.}");
road_network_configuration.emplace("build_policy", build_properties.build_policy);
Expand Down
1 change: 1 addition & 0 deletions src/integration/tools.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ struct MalidriveBuildProperties {
std::string xodr_file_path{""};
std::optional<double> linear_tolerance{std::nullopt};
std::optional<double> max_linear_tolerance{std::nullopt};
std::optional<double> angular_tolerance{std::nullopt};
std::string build_policy{"sequential"};
int number_of_threads{0};
std::string simplification_policy{"none"};
Expand Down

0 comments on commit fa5c410

Please sign in to comment.