etrobocon2018 feat.KatLab  770af34cce41ae9c30c41303275e1add2daae0c3 (with uncommitted changes)
 全て クラス 名前空間 ファイル 関数 変数 列挙型 列挙値 フレンド マクロ定義 ページ
SelfLocalization.h
[詳解]
1 /*****************************
2  * self_localization.h
3  *
4  * Author Hiroki Tachiyama
5  * Katayama Laboratory
6  * Department of Computer Secience and Systems Engineering
7  * Faculty of Engineering, University of Miyazaki
8  *
9  * Created at: Fri Jul 7 23:07:58 JST 2017
10  *
11  * Coryrights (c) 2017 Katayama Laboratory
12  *
13  *****************************/
14 #ifndef __SELF_LOCALIZATION__
15 #define __SELF_LOCALIZATION__
16 
17 #include <cerrno>
18 #include <cmath>
19 #include <cstdint>
20 #include <cstdio>
21 
22 class MotorAngle {
23  public:
24  std::int32_t current_angle;
25  std::int32_t old_angle;
26  std::int32_t rotation_angle;
28  float wheel_across;
29  MotorAngle(std::int32_t degree)
30  {
31  rotation_angle = 0;
32  wheel_across = 9.8;
33  moving_distance = 0;
34  old_angle = current_angle = degree;
35  }
36  void update(std::int32_t update_degree)
37  {
39  current_angle = update_degree;
41  moving_distance = wheel_across * M_PI * (rotation_angle / 360.0);
42  }
43 };
44 
46  private:
47  MotorAngle left, right;
48  float between_wheels;
49  float moving_distance_mean;
50  float turning_angle;
51  float current_x, current_y, current_angle;
52  bool is_below_of_normal_border;
53  float start_x, start_y, goal_x, goal_y;
54  static FILE* fp;
55  static bool isSave;
56  bool is_below_normal_vector;
57 
58  // member methods
59  public:
61  SelfLocalization(std::int32_t left_motor_sl, std::int32_t right_motor_sl, bool save = true);
62  void update(std::int32_t left_motor_sl, std::int32_t right_motor_sl);
64  bool approached_target_coordinates(float target_x, float target_y, float target_radius);
65  float getPointX();
66  float getPointY();
67  bool is_over_target_line_of_x(float target_x);
68  bool is_over_target_line_of_y(float target_y);
69  bool is_below_target_line_of_x(float target_x);
70  bool is_below_target_line_of_y(float target_y);
71  float calculate_between_ev3_and_border(float _start_x, float _start_y, float _goal_x,
72  float _goal_y, float _current_x, float _current_y);
73  void file_close();
74  void init_normal_vector(float _start_x, float _start_y, float _goal_x, float _goal_y,
75  float _current_x, float _current_y);
76  bool is_over_normal_vector(float _current_x, float _current_y);
78 
79  private:
80  //残りのメソッドかな?
81 };
82 
83 #endif
std::int32_t rotation_angle
void init_normal_vector(float _start_x, float _start_y, float _goal_x, float _goal_y, float _current_x, float _current_y)
float wheel_across
void update(std::int32_t update_degree)
bool approached_target_coordinates(float target_x, float target_y, float target_radius)
void update(std::int32_t left_motor_sl, std::int32_t right_motor_sl)
bool is_below_target_line_of_x(float target_x)
void writing_current_coordinates()
float calculate_between_ev3_and_border(float _start_x, float _start_y, float _goal_x, float _goal_y, float _current_x, float _current_y)
float moving_distance
std::int32_t old_angle
MotorAngle(std::int32_t degree)
std::int32_t current_angle
bool is_below_target_line_of_y(float target_y)
bool is_over_target_line_of_x(float target_x)
bool is_over_normal_vector(float _current_x, float _current_y)
bool is_over_target_line_of_y(float target_y)
SelfLocalization(std::int32_t left_motor_sl, std::int32_t right_motor_sl, bool save=true)