Robot_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 "fields2cover.h"
9 #include "../test_helpers/robot_data.hpp"
10 #include "../test_helpers/path_planning_checker.hpp"
11 
12 
13 
14 TEST(fields2cover_types_robot, init) {
15  F2CRobot robot_def_const(1., 2.);
16  EXPECT_NEAR(robot_def_const.getWidth(), 1., 1e-5);
17  EXPECT_NEAR(robot_def_const.getCovWidth(), 2., 1e-5);
18 
20  robot.setName("robot test");
21  EXPECT_EQ(robot.getName(), "robot test");
22  robot.setWidth(5.0);
23  EXPECT_NEAR(robot.getWidth(), 5.0, 1e-5);
24  robot.setCovWidth(10.0);
25  EXPECT_NEAR(robot.getCovWidth(), 10., 1e-5);
26 
27  robot.setMinTurningRadius(10.0);
28  EXPECT_NEAR(robot.getMaxCurv(), 0.1, 1e-5);
29  EXPECT_NEAR(robot.getMinTurningRadius(), 10., 1e-5);
30 
31  robot.setMaxCurv(0.4);
32  EXPECT_NEAR(robot.getMaxCurv(), 0.4, 1e-5);
33  EXPECT_NEAR(robot.getMinTurningRadius(), 2.5, 1e-5);
34  robot.setMaxDiffCurv(0.3);
35  EXPECT_NEAR(robot.getMaxDiffCurv(), 0.3, 1e-5);
36 
37  robot.setCruiseVel(2.0);
38  EXPECT_NEAR(robot.getCruiseVel(), 2.0, 1e-5);
39  EXPECT_NEAR(robot.getTurnVel(), 2.0, 1e-5);
40  robot.setTurnVel(5.0);
41  EXPECT_NEAR(robot.getTurnVel(), 5.0, 1e-5);
42 
43 
44  EXPECT_THROW(F2CRobot(0), std::out_of_range);
45  EXPECT_THROW(F2CRobot(-3), std::out_of_range);
46 
47  F2CRobot r1 = robot;
48  EXPECT_NEAR(r1.getWidth(), 5.0, 1e-5);
49 
50  const F2CRobot r2 {robot};
51  EXPECT_EQ(r2.getWidth(), 5.0);
52 }
53 
54 
f2c::types::Robot::getCovWidth
double getCovWidth() const
Definition: Robot.cpp:49
TEST
TEST(fields2cover_types_robot, init)
Definition: Robot_test.cpp:14
2_objective_functions.robot
robot
Definition: 2_objective_functions.py:76
fields2cover.h
f2c::types::Robot
Definition: Robot.h:25
f2c::types::Robot::getWidth
double getWidth() const
Definition: Robot.cpp:41
F2CRobot
f2c::types::Robot F2CRobot
Definition: types.h:36


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