From c1b52ec3a71dea78ea5d4ee6c4e05676c7710593 Mon Sep 17 00:00:00 2001 From: asehoubo Date: Thu, 22 Mar 2018 12:29:56 +0100 Subject: [PATCH 1/4] API for Makers project --- make.sh | 1 + src/ai/CMakeLists.txt | 4 +++ src/ai/makers/algo1.cpp | 27 +++++++++++++++++ src/ai/makers/algo1.h | 31 +++++++++++++++++++ src/ai/makers/avoid_obstacle.cpp | 10 +++++++ src/ai/makers/avoid_obstacle.h | 43 +++++++++++++++++++++++++++ src/ai/makers/test_algo1.cpp | 32 ++++++++++++++++++++ src/ai/makers/test_avoid_obstacle.cpp | 16 ++++++++++ 8 files changed, 164 insertions(+) create mode 100755 make.sh create mode 100644 src/ai/makers/algo1.cpp create mode 100644 src/ai/makers/algo1.h create mode 100644 src/ai/makers/avoid_obstacle.cpp create mode 100644 src/ai/makers/avoid_obstacle.h create mode 100644 src/ai/makers/test_algo1.cpp create mode 100644 src/ai/makers/test_avoid_obstacle.cpp diff --git a/make.sh b/make.sh new file mode 100755 index 00000000..5a0b5830 --- /dev/null +++ b/make.sh @@ -0,0 +1 @@ +./workspace build:debug && ./workspace tests:debug diff --git a/src/ai/CMakeLists.txt b/src/ai/CMakeLists.txt index 8a854bf9..94b6979d 100644 --- a/src/ai/CMakeLists.txt +++ b/src/ai/CMakeLists.txt @@ -43,6 +43,8 @@ set (SOURCES core/export_to_plot.cpp core/logger.cpp referee/Referee.cpp + makers/avoid_obstacle.cpp + makers/algo1.cpp ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/../../bin/) @@ -73,6 +75,8 @@ if(CATKIN_ENABLE_TESTING) control/test_pid.cpp control/test_robot_control.cpp ai/robot_behavior/test_robot_behavior.cpp + makers/test_avoid_obstacle.cpp + makers/test_algo1.cpp ) foreach(test_source ${TEST_SOURCES}) diff --git a/src/ai/makers/algo1.cpp b/src/ai/makers/algo1.cpp new file mode 100644 index 00000000..d08ca650 --- /dev/null +++ b/src/ai/makers/algo1.cpp @@ -0,0 +1,27 @@ +#include "algo1.h" + +Algo1::Algo1( double discretisation_size ): + discretisation_size( discretisation_size ) +{ +} + +void Algo1::set_constraint( + double width_field, double height_field, + const rhoban_geometry::Point & starting_linear_position, + const Vector2d & starting_linear_velocity, + const rhoban_geometry::Point & ending_linear_position, + const Vector2d & ending_linear_velocity, + double robot_radius, + const std::list< Obstacle > & obstacles, + double minimal_radius_curve +){ +} + +/* + This function take a parameter u in [0, 1.0] and return the postion + of the robot. +*/ +rhoban_geometry::Point Algo1::linear_position( double u ) const { + return rhoban_geometry::Point( 0.0, 0.0 ); +} + diff --git a/src/ai/makers/algo1.h b/src/ai/makers/algo1.h new file mode 100644 index 00000000..90954ec0 --- /dev/null +++ b/src/ai/makers/algo1.h @@ -0,0 +1,31 @@ +#ifndef __ALGO1__H_ +#define __ALGO1__H_ + +#include "avoid_obstacle.h" + +class Algo1 : Avoid_obstacle { + public: + double discretisation_size; + + + Algo1( double discretisation_size); + + virtual void set_constraint( + double width_field, double height_field, + const rhoban_geometry::Point & starting_linear_position, + const Vector2d & starting_linear_velocity, + const rhoban_geometry::Point & ending_linear_position, + const Vector2d & ending_linear_velocity, + double robot_radius, + const std::list< Obstacle > & obstacles, + double minimal_radius_curve + ); + + /* + This function take a parameter u in [0, 1.0] and return the postion + of the robot. + */ + virtual rhoban_geometry::Point linear_position( double u ) const; +}; + +#endif diff --git a/src/ai/makers/avoid_obstacle.cpp b/src/ai/makers/avoid_obstacle.cpp new file mode 100644 index 00000000..2a7acf79 --- /dev/null +++ b/src/ai/makers/avoid_obstacle.cpp @@ -0,0 +1,10 @@ +#include "avoid_obstacle.h" + +Obstacle::Obstacle( double radius, const rhoban_geometry::Point & linear_position ): + radius(radius), + linear_position(linear_position) +{ } + +Avoid_obstacle::~Avoid_obstacle(){ +} + diff --git a/src/ai/makers/avoid_obstacle.h b/src/ai/makers/avoid_obstacle.h new file mode 100644 index 00000000..4cdedb43 --- /dev/null +++ b/src/ai/makers/avoid_obstacle.h @@ -0,0 +1,43 @@ +#ifndef __AVOID_OBSTACLE__H__ +#define __AVOID_OBSTACLE__H__ + +#include +#include +#include + + +struct Obstacle { + double radius; + rhoban_geometry::Point linear_position; + + Obstacle( double radius, const rhoban_geometry::Point & linear_position ); +}; + +class Avoid_obstacle { + public: + + /* + This function is used to configurate the datas of the obstacle and of some constraint + on the robot in order to compute a move for the robot. + */ + virtual void set_constraint( + double width_field, double height_field, + const rhoban_geometry::Point & starting_linear_position, + const Vector2d & starting_linear_velocity, + const rhoban_geometry::Point & ending_linear_position, + const Vector2d & ending_linear_velocity, + double robot_radius, + const std::list< Obstacle > & obstacles, + double minimal_radius_curve + ) = 0; + + /* + This function take a parameter u in [0, 1.0] and return the postion + of the robot. + */ + virtual rhoban_geometry::Point linear_position( double u ) const = 0; + + virtual ~Avoid_obstacle(); +}; + +#endif diff --git a/src/ai/makers/test_algo1.cpp b/src/ai/makers/test_algo1.cpp new file mode 100644 index 00000000..714c3572 --- /dev/null +++ b/src/ai/makers/test_algo1.cpp @@ -0,0 +1,32 @@ +#include +#include "algo1.h" + +TEST(test_algo1, constructors){ + { + Algo1 algo1( 3.0 ); + EXPECT_EQ( algo1.discretisation_size, 3.0 ); + } +} + +TEST(test_algo1, linear_position){ + { + Algo1 algo1( 3.0 ); + EXPECT_EQ( + algo1.linear_position(0.0), + rhoban_geometry::Point( 0.0, 0.0 ) + ); + EXPECT_EQ( + algo1.linear_position(0.5), + rhoban_geometry::Point( 0.0, 0.0 ) + ); + EXPECT_EQ( + algo1.linear_position(1.0), + rhoban_geometry::Point( 0.0, 0.0 ) + ); + } +} + +int main(int argc, char **argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} diff --git a/src/ai/makers/test_avoid_obstacle.cpp b/src/ai/makers/test_avoid_obstacle.cpp new file mode 100644 index 00000000..cc9c4613 --- /dev/null +++ b/src/ai/makers/test_avoid_obstacle.cpp @@ -0,0 +1,16 @@ +#include +#include "avoid_obstacle.h" + +TEST(test_avoid_obstacle, obstacle_constructor){ + { + Obstacle obstacle( 2.0, rhoban_geometry::Point(3.0, 4.0) ); + EXPECT_EQ( obstacle.radius, 2.0 ); + EXPECT_EQ( obstacle.linear_position, rhoban_geometry::Point(3.0, 4.0) ); + } +} + + +int main(int argc, char **argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} From 8668d24f9fd62ae7b811699d5557ebc77eac606e Mon Sep 17 00:00:00 2001 From: Victoire Date: Thu, 26 Apr 2018 10:12:05 +0200 Subject: [PATCH 2/4] =?UTF-8?q?ajout=20de=20discr=C3=A9tisation=20espace?= =?UTF-8?q?=20et=20astar?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ai/makers/Astar.cpp | 126 ++++++++++++++++++ src/ai/makers/Astar.h | 42 ++++++ src/ai/makers/Obstacle.h | 13 ++ src/ai/makers/space_discretization.cpp | 24 ++++ src/ai/makers/space_discretization.h | 50 ++++++++ src/ai/makers/test_Astar.cpp | 135 ++++++++++++++++++++ src/ai/makers/test_space_discretization.cpp | 39 ++++++ 7 files changed, 429 insertions(+) create mode 100644 src/ai/makers/Astar.cpp create mode 100644 src/ai/makers/Astar.h create mode 100644 src/ai/makers/Obstacle.h create mode 100644 src/ai/makers/space_discretization.cpp create mode 100644 src/ai/makers/space_discretization.h create mode 100644 src/ai/makers/test_Astar.cpp create mode 100644 src/ai/makers/test_space_discretization.cpp diff --git a/src/ai/makers/Astar.cpp b/src/ai/makers/Astar.cpp new file mode 100644 index 00000000..2942f515 --- /dev/null +++ b/src/ai/makers/Astar.cpp @@ -0,0 +1,126 @@ +#include "Astar.h" + +Grid::Grid(int X, int Y, double eX, double eY, pair s, pair g, vector< pair > o):X(X),Y(Y),edgeX(eX),edgeY(eY),start(s),goal(g){ + vector< pair >::const_iterator it; + for(it = o.begin(); it != o.end(); ++it){ + obstacles[(*it)] = 1; + } +} + +int Grid::heuristic_cost_estimate(pair p1, pair p2){ + return abs(p1.first-p2.first)+abs(p1.second-p2.second); +} + +vector< pair > Grid::findN(pair p){ + vector< pair > v; + if(p.first+1 <= X){ + v.push_back(make_pair(p.first+1,p.second)); + } + if(p.second+1 <= Y){ + v.push_back(make_pair(p.first,p.second+1)); + } + if(p.first-1 >= 1){ + v.push_back(make_pair(p.first-1,p.second)); + } + if(p.second-1 >= 1){ + v.push_back(make_pair(p.first,p.second-1)); + } + if(p.first+1 <= X && p.second+1 <= Y){ + v.push_back(make_pair(p.first+1,p.second+1)); + } + if(p.first+1 <= X && p.second-1 >= 1){ + v.push_back(make_pair(p.first+1,p.second-1)); + } + if(p.first-1 >= 1 && p.second+1 <= Y){ + v.push_back(make_pair(p.first-1,p.second+1)); + } + if(p.first-1 >= 1 && p.second-1 >= 1){ + v.push_back(make_pair(p.first-1,p.second-1)); + } + return v; +} + +int Grid::dist_between(pair p1, pair p2){ + if(abs(p1.first-p2.first)+abs(p1.second-p2.second)==1){ + return 10; + } + else{ + return 14; + } +} + +vector< pair > Grid::reconstruct_path(map< pair, pair > m, pair p){ + vector< pair > vp; + vp.push_back(p); + while(m.find(p) != m.end()){ + p = m[p]; + vp.push_back(p); + } + return vp; +} + +vector< pair > Grid::A(){ + set< pair > closedSet; + set< pair > openSet; + openSet.insert(start); + map< pair, pair > cameFrom; + map< pair, int> gScore; + for(int i = 1; i <= X; i++){ + for(int j = 1; j <= Y; j++){ + gScore[make_pair(i,j)] = INFINITY; + } + } + gScore[start] = 0; + map,int> fScore; + for(int i = 1; i <= X; i++){ + for(int j = 1; j <= Y; j++){ + fScore[make_pair(i,j)] = INFINITY; + } + } + fScore[start] = heuristic_cost_estimate(start,goal); + pair current; + int min; + vector< pair > neighbors; + int tentative_gScore; + while(!openSet.empty()){ + min = INFINITY; + for(set< pair >::const_iterator is = openSet.begin(); is != openSet.end(); ++is){ + if(fScore[(*is)] < min){ + min = fScore[(*is)]; + current = (*is); + } + } + if(current == goal){ + return reconstruct_path(cameFrom,current); + } + openSet.erase(current); + closedSet.insert(current); + neighbors = findN(current); + for(vector< pair >::const_iterator in = neighbors.begin(); in != neighbors.end(); ++in){ + if(closedSet.find(*in)!=closedSet.end() || obstacles.find(*in)!=obstacles.end()){ + continue; + } + if(openSet.find(*in)==openSet.end()){ + openSet.insert(*in); + } + tentative_gScore = gScore[current] + dist_between(current,*in); + if(tentative_gScore < gScore[*in]){ + cameFrom[*in] = current; + gScore[*in] = tentative_gScore; + fScore[*in] = gScore[*in] + heuristic_cost_estimate(*in,goal); + } + } + } + vector< pair > b; + return b; +} + +vector< pair > Grid::Astar(){ + vector< pair > p = A(); + vector< pair > d; + for(vector< pair >::iterator it = p.begin(); it!=p.end(); ++it){ + d.push_back(make_pair(((it->first)-1)*edgeX+edgeX/2,((it->second)-1)*edgeY+edgeY/2)); + } + return d; +} + diff --git a/src/ai/makers/Astar.h b/src/ai/makers/Astar.h new file mode 100644 index 00000000..77b1b9e1 --- /dev/null +++ b/src/ai/makers/Astar.h @@ -0,0 +1,42 @@ +#ifndef __ASTAR_H__ +#define __ASTAR_H__ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +using namespace std; + +class Grid{ +public: + int X; + int Y; + double edgeX; + double edgeY; + pair start; + pair goal; + map,int> obstacles; + + Grid(int X, int Y, double eX, double eY, pair s, pair g, vector< pair > o); + + int heuristic_cost_estimate(pair p1, pair p2); + + vector< pair > findN(pair p); + + int dist_between(pair p1, pair p2); + + vector< pair > reconstruct_path(map< pair, pair > m, pair p); + + vector< pair > A(); + + vector< pair > Astar(); +}; + +#endif /* __ASTAR_H__ */ diff --git a/src/ai/makers/Obstacle.h b/src/ai/makers/Obstacle.h new file mode 100644 index 00000000..61e21291 --- /dev/null +++ b/src/ai/makers/Obstacle.h @@ -0,0 +1,13 @@ +#ifndef __OBSTACLE_H__ +#define __OBSTACLE_H__ + +typedef struct Obstacle Obstacle; + +struct Obstacle { + double radius; + rhoban_geometry::Point linear_position; + + Obstacle( double radius, const rhoban_geometry::Point & linear_position ); +}; + +#endif /* __OBSTACLE_H__ */ diff --git a/src/ai/makers/space_discretization.cpp b/src/ai/makers/space_discretization.cpp new file mode 100644 index 00000000..21f9d548 --- /dev/null +++ b/src/ai/makers/space_discretization.cpp @@ -0,0 +1,24 @@ +#include "space_discretization.h" + +int Space_discretization::getX(){ + return X; +} + +int Space_discretization::getY(){ + return Y; +} + +double Space_discretization::getEX(){ + return edgeX; +} + +double Space_discretization::getEY(){ + return edgeY; +} + +void Space_discretization::print_space_discretization(){ + cout << "X : " << Space_discretization::getX() << endl; + cout << "Y : " << Space_discretization::getY() << endl; + cout << "edgeX : " << Space_discretization::getEX() << endl; + cout << "edgeY : " << Space_discretization::getEY() << endl; +} \ No newline at end of file diff --git a/src/ai/makers/space_discretization.h b/src/ai/makers/space_discretization.h new file mode 100644 index 00000000..03617cda --- /dev/null +++ b/src/ai/makers/space_discretization.h @@ -0,0 +1,50 @@ +#ifndef __SPACE_DISCRETIZATION_H__ +#define __SPACE_DISCRETIZATION_H__ + +#include +#include +#include +#include +#include +#include + + + +using namespace std; + +class Space_discretization{ + int X; + int Y; + double edgeX; + double edgeY; +public: + // constructor 1 + Space_discretization(int X, int Y, double eX, double eY):X(X), Y(Y), edgeX(eX), edgeY(eY){} + + // constructor 2 + Space_discretization(double W, double H, double edge){ + X = (int)(W/edge); + Y = (int)(H/edge); + edgeX = W/X; + edgeY = H/Y; + } + + // constructor 3 + // We suppose that H is always <= W + Space_discretization(double W, double H){ + double e = H/W; + X = (int)(W/e); + Y = (int)(H/e); + edgeX = W/X; + edgeY = H/Y; + } + + int getX(); + int getY(); + double getEX(); + double getEY(); + void print_space_discretization(); + +}; + +#endif /* __SPACE_DISCRETIZATION_H__*/ \ No newline at end of file diff --git a/src/ai/makers/test_Astar.cpp b/src/ai/makers/test_Astar.cpp new file mode 100644 index 00000000..73ce5d30 --- /dev/null +++ b/src/ai/makers/test_Astar.cpp @@ -0,0 +1,135 @@ +#include +#include "Astar.h" + +TEST(test_Astar, constructor){ + { + vector< pair > v; + for(int i = 1; i < 7; i++){ + v.push_back(make_pair(3,i)); + } + Grid Grid(6,7,1.0,2.0,make_pair(2,5),make_pair(5,2),v); + EXPECT_EQ(Grid.X,6); + EXPECT_EQ(Grid.Y,7); + EXPECT_EQ(Grid.edgeX,1.0); + EXPECT_EQ(Grid.edgeY,2.0); + EXPECT_EQ(Grid.start,make_pair(2,5)); + EXPECT_EQ(Grid.goal,make_pair(5,2)); + int j = 1; + for(map,int>::iterator it = (Grid.obstacles).begin(); it != (Grid.obstacles).end(); it++){ + EXPECT_EQ(it->first,make_pair(3,j)); + j++; + } + } +} + +TEST(test_Astar, heuristic_cost_estimate){ + { + vector< pair > v; + for(int i = 1; i < 7; i++){ + v.push_back(make_pair(3,i)); + } + Grid Grid(6,7,1.0,1.0,make_pair(2,5),make_pair(5,2),v); + EXPECT_EQ(Grid.heuristic_cost_estimate(make_pair(2,5),make_pair(5,2)),6); + EXPECT_EQ(Grid.heuristic_cost_estimate(make_pair(5,2),make_pair(2,5)),6); + EXPECT_EQ(Grid.heuristic_cost_estimate(make_pair(2,5),make_pair(2,5)),0); + } +} + +TEST(test_Astar, findN){ + { + vector< pair > v; + for(int i = 1; i < 7; i++){ + v.push_back(make_pair(3,i)); + } + Grid Grid(6,7,1.0,1.0,make_pair(2,5),make_pair(5,2),v); + vector< pair > p = Grid.findN(make_pair(2,5)); + EXPECT_EQ(p.size(),8); + vector< pair >::iterator jt, jf, jk; + int a, b; + jt = p.begin(); + jf = p.end(); + for(int k = -1; k<= 1; k++){ + for(int l = -1; l<= 1; l++){ + a = 2+k; + b = 5+l; + if(a!=2 && b!=5){ + jk = find(jt,jf,make_pair(a,b)); + EXPECT_NE(jk,jf); + } + } + } + jk = find(jt,jf,make_pair(4,5)); + EXPECT_EQ(jk,jf); + } +} + +TEST(test_Astar, dist_between){ + { + vector< pair > v; + for(int i = 1; i < 7; i++){ + v.push_back(make_pair(3,i)); + } + Grid Grid(6,7,1.0,1.0,make_pair(2,5),make_pair(5,2),v); + EXPECT_EQ(Grid.dist_between(make_pair(2,3),make_pair(2,4)),10); + EXPECT_EQ(Grid.dist_between(make_pair(2,3),make_pair(3,5)),14); + } +} + +TEST(test_Astar, A){ + { + vector< pair > v; + v.push_back(make_pair(4,2)); + v.push_back(make_pair(4,3)); + v.push_back(make_pair(4,5)); + Grid Grid(6,7,1.0,2.0,make_pair(2,5),make_pair(5,2),v); + vector< pair > a = Grid.A(); + vector< pair > g; + g.push_back(make_pair(2,5)); + g.push_back(make_pair(3,5)); + g.push_back(make_pair(4,4)); + g.push_back(make_pair(5,3)); + g.push_back(make_pair(5,2)); + EXPECT_EQ(a.size(),5); + vector< pair >::iterator je, jt, jf, jk, jg; + je = a.begin(); + jt = a.end(); + for(jf = g.begin(); jf!= g.end(); ++jf){ + jk = find(je,jt,*jf); + EXPECT_NE(jk,jt); + } + EXPECT_EQ(find(je,jt,make_pair(1,1)),jt); + } +} + + +TEST(test_Astar, Astar){ + { + vector< pair > v; + v.push_back(make_pair(4,2)); + v.push_back(make_pair(4,3)); + v.push_back(make_pair(4,5)); + Grid Grid(6,7,1.0,2.0,make_pair(2,5),make_pair(5,2),v); + vector< pair > a = Grid.Astar(); + vector< pair > g; + g.push_back(make_pair(1.5,9.0)); + g.push_back(make_pair(2.5,9.0)); + g.push_back(make_pair(3.5,7.0)); + g.push_back(make_pair(4.5,5.0)); + g.push_back(make_pair(4.5,3.0)); + EXPECT_EQ(a.size(),5); + vector< pair >::iterator je, jt, jf, jk; + je = a.begin(); + jt = a.end(); + for(jf = g.begin(); jf!= g.end(); ++jf){ + jk = find(je,jt,*jf); + EXPECT_NE(jk,jt); + } + EXPECT_EQ(find(je,jt,make_pair(0.5,0.5)),jt); + } +} + +int main(int argc, char **argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} + diff --git a/src/ai/makers/test_space_discretization.cpp b/src/ai/makers/test_space_discretization.cpp new file mode 100644 index 00000000..6184a86b --- /dev/null +++ b/src/ai/makers/test_space_discretization.cpp @@ -0,0 +1,39 @@ +#include +#include "space_discretization.h" + +TEST(test_space_discretization, getX){ + { + EXPECT_EQ(Space_discretization(1,2,0.2,0.3).getX(),1); + EXPECT_EQ(Space_discretization(10.0,2.0,0.2).getX(),50); + EXPECT_EQ(Space_discretization(10.0,2.0).getX(),50); + } +} + +TEST(test_space_discretization, getY){ + { + EXPECT_EQ(Space_discretization(1,2,0.2,0.3).getY(),2); + EXPECT_EQ(Space_discretization(10.0,2.0,0.2).getY(),10); + EXPECT_EQ(Space_discretization(10.0,2.0).getY(),10); + } +} + +TEST(test_space_discretization, getEX){ + { + EXPECT_EQ(Space_discretization(1,2,0.2,0.3).getEX(),0.2); + EXPECT_EQ(Space_discretization(10.0,2.0,0.2).getEX(),0.2); + EXPECT_EQ(Space_discretization(10.0,2.0).getEX(),0.2); + } +} + +TEST(test_space_discretization, getEY){ + { + EXPECT_EQ(Space_discretization(1,2,0.2,0.3).getEY(),0.3); + EXPECT_EQ(Space_discretization(10.0,2.0,0.2).getEY(),0.2); + EXPECT_EQ(Space_discretization(10.0,2.0).getEY(),0.2); + } +} + +int main(int argc, char **argv) { + ::testing::InitGoogleTest(&argc, argv); + return RUN_ALL_TESTS(); +} \ No newline at end of file From d9936803567101506f20a200b64a82ff63e3b382 Mon Sep 17 00:00:00 2001 From: Victoire Date: Thu, 26 Apr 2018 10:46:46 +0200 Subject: [PATCH 3/4] update de CMakelists --- src/ai/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/ai/CMakeLists.txt b/src/ai/CMakeLists.txt index 94b6979d..859e25a3 100644 --- a/src/ai/CMakeLists.txt +++ b/src/ai/CMakeLists.txt @@ -45,6 +45,8 @@ set (SOURCES referee/Referee.cpp makers/avoid_obstacle.cpp makers/algo1.cpp + makers/space_discretization.cpp + makers/Astar.cpp ) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/../../bin/) @@ -77,6 +79,8 @@ if(CATKIN_ENABLE_TESTING) ai/robot_behavior/test_robot_behavior.cpp makers/test_avoid_obstacle.cpp makers/test_algo1.cpp + makers/test_space_discretization.cpp + makers/test_Astar.cpp ) foreach(test_source ${TEST_SOURCES}) From acf53ce8b37c9c24763b741e12a8bc50b3063746 Mon Sep 17 00:00:00 2001 From: Victoire Date: Thu, 26 Apr 2018 10:49:08 +0200 Subject: [PATCH 4/4] mise des obstacles dans obstacle.h --- src/ai/makers/avoid_obstacle.h | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/src/ai/makers/avoid_obstacle.h b/src/ai/makers/avoid_obstacle.h index 4cdedb43..41a8f96b 100644 --- a/src/ai/makers/avoid_obstacle.h +++ b/src/ai/makers/avoid_obstacle.h @@ -4,14 +4,7 @@ #include #include #include - - -struct Obstacle { - double radius; - rhoban_geometry::Point linear_position; - - Obstacle( double radius, const rhoban_geometry::Point & linear_position ); -}; +#include "Obstacle.h" class Avoid_obstacle { public: