path_length_test.cpp
Go to the documentation of this file.
1 //=============================================================================
2 // Copyright (C) 2021-2024 Wageningen University - All Rights Reserved
3 // Author: Gonzalo Mier
4 // BSD-3 License
5 //=============================================================================
6 
7 #include <gtest/gtest.h>
8 #include <utility>
11 #include "fields2cover/types.h"
12 
13 TEST(fields2cover_obj_pathLength, computeCost) {
15  robot.setMinTurningRadius(1.5);
17  F2CPoint start(0.0, 0.0), end(-3.0, 0.0);
19 
20  auto path = turn.createTurn(robot,
21  start, boost::math::constants::half_pi<double>(),
22  end, 3.0 * boost::math::constants::half_pi<double>());
23 
24  EXPECT_NEAR(obj.computeCost(path), 3 * M_PI / 2.0, 1e-2);
25  EXPECT_NEAR(obj.computeCostWithMinimizingSign(path), 3 * M_PI / 2.0, 1e-2);
26 }
27 
28 TEST(fields2cover_obj_pathLength, params_check) {
29  f2c::obj::PathLength objective;
30  EXPECT_TRUE(objective.isMinimizing());
31  EXPECT_FALSE(objective.isMaximizing());
32 }
33 
f2c::pp::DubinsCurves
Dubins' curves planner.
Definition: dubins_curves.h:17
types.h
2_objective_functions.path
path
Definition: 2_objective_functions.py:88
path_length.h
1_basic_types.end
end
Definition: 1_basic_types.py:76
TEST
TEST(fields2cover_obj_pathLength, computeCost)
Definition: path_length_test.cpp:13
2_objective_functions.robot
robot
Definition: 2_objective_functions.py:76
7_decomposition.obj
obj
Definition: 7_decomposition.py:32
f2c::obj::BaseObjective::isMaximizing
virtual bool isMaximizing() const
Return true if the objective is to maximize the cost function.
Definition: base_objective.h:52
f2c::obj::PathLength
Compute the length of the coverage path, including turns.
Definition: path_length.h:16
f2c::types::Point
Definition: Point.h:21
f2c::types::Robot
Definition: Robot.h:25
dubins_curves.h
f2c::pp::TurningBase::createTurn
F2CPath createTurn(const F2CRobot &robot, const F2CPoint &start_pos, double start_angle, const F2CPoint &end_pos, double end_angle)
Create a turn that goes from one point with a certain angle to another point.
Definition: turning_base.cpp:30
f2c::obj::BaseObjective::isMinimizing
virtual bool isMinimizing() const
Return true if the objective is to minimize the cost function.
Definition: base_objective.h:50


fields2cover
Author(s):
autogenerated on Fri Apr 25 2025 02:18:31