Tinman  1.0
bot.h
Go to the documentation of this file.
1 // Copyright (C) 2014 ISAAC LACOBA MOLINA
2 // Tinman author: Isaac Lacoba Molina
3 //
4 // This program is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
8 //
9 // This program is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
13 //
14 // You should have received a copy of the GNU General Public License
15 // along with this program. If not, see <http://www.gnu.org/licenses/>.
16 
17 #ifndef BOT_H
18 #define BOT_H
19 #include <cmath>
20 
21 
22 #include "controller.h"
23 #include "physics.h"
24 
25 class Race;
26 
27 class BotController: public Controller {
28  int index_;
29  std::shared_ptr<Race> race_;
33  const float collide_limit_ = 0.16;
34  const float stuck_limit_ = 0.54;
35 
36 public:
38  virtual ~BotController();
39  void update(float delta);
40  void exec(Tinman::Action action);
41  void configure();
42 
43  void add_race(std::shared_ptr<Race> race);
44 
45  private:
46  void perform_action(btVector3 next_destination);
47  void go_to_waypoint();
48  bool detect_obstacles(float delta);
49 };
50 #endif
Definition: controller.h:10
void add_race(std::shared_ptr< Race > race)
Definition: bot.cpp:16
std::shared_ptr< Physics > shared
Definition: physics.h:33
void update(float delta)
Definition: bot.cpp:27
int index_
Definition: bot.h:28
Physics::shared physics_
Definition: bot.h:30
Section previous_segment_
Definition: bot.h:31
Definition: track.h:33
void perform_action(btVector3 next_destination)
Section current_segment_
Definition: bot.h:31
const float stuck_limit_
Definition: bot.h:34
const float collide_limit_
Definition: bot.h:33
std::shared_ptr< Car > shared
Definition: car.h:44
std::shared_ptr< Race > race_
Definition: bot.h:29
void go_to_waypoint()
Definition: bot.cpp:68
bool detect_obstacles(float delta)
Definition: bot.cpp:35
Definition: race.h:29
void configure()
Definition: bot.cpp:23
virtual ~BotController()
Definition: bot.cpp:13
void exec(Tinman::Action action)
Definition: bot.cpp:136
float colliding_
Definition: bot.h:32
BotController(Physics::shared physics, Car::shared car)
Definition: bot.cpp:5
Definition: bot.h:27
float stucked_
Definition: bot.h:32