root / scout / libscout / src / behaviors / Odometry.h @ bb64f5e5
History | View | Annotate | Download (1.21 KB)
1 | f79fbce2 | Priya | #ifndef _ODOMETRY_H_
|
---|---|---|---|
2 | #define _ODOMETRY_H_
|
||
3 | |||
4 | #include "../Behavior.h" |
||
5 | d140fd71 | Yuyang | #include "../Sensors.h" |
6 | 30a3768e | Priya | #include "messages/ScoutPosition.h" |
7 | bb64f5e5 | Priya | #include "../helper_classes/ScoutPosition.h" |
8 | f79fbce2 | Priya | |
9 | ddfeb111 | Priya | #define WHEEL_RADIUS .2 |
10 | f79fbce2 | Priya | #define WHEEL_CIRCUM (2*M_PI*WHEEL_RADIUS) |
11 | ddfeb111 | Priya | #define WHEEL_BASE 1.2 |
12 | #define ENCODER_COUNT (2*WHEEL_RADIUS*350*M_PI/WHEEL_BASE) |
||
13 | f79fbce2 | Priya | #define DIST_PER_TICK (WHEEL_CIRCUM/ENCODER_COUNT)
|
14 | |||
15 | class Odometry : Behavior{ |
||
16 | |||
17 | public:
|
||
18 | |||
19 | /** Set up the odometry node and prepare communcations over ROS */
|
||
20 | d140fd71 | Yuyang | Odometry(std::string scoutname, Sensors* sensors); |
21 | f79fbce2 | Priya | |
22 | /** Query encoders and estimate position based on encoder reading */
|
||
23 | void get_position();
|
||
24 | |||
25 | /** Gets scout position and prints to screen */
|
||
26 | void run();
|
||
27 | |||
28 | private:
|
||
29 | |||
30 | /** ROS publisher and client declaration */
|
||
31 | ros::NodeHandle node; |
||
32 | 30a3768e | Priya | ros::Publisher scout_position; |
33 | f79fbce2 | Priya | ros::ServiceClient query_encoders_client; |
34 | 30a3768e | Priya | messages::ScoutPosition position; |
35 | |||
36 | std::string name; |
||
37 | f79fbce2 | Priya | |
38 | float msg_time_in;
|
||
39 | 31be19a6 | Priya | |
40 | 3db79f25 | Priya | int motor_fl_dist;
|
41 | int motor_fr_dist;
|
||
42 | int motor_bl_dist;
|
||
43 | int motor_br_dist;
|
||
44 | f79fbce2 | Priya | |
45 | 3db79f25 | Priya | unsigned int motor_fl_ticks; |
46 | unsigned int motor_fr_ticks; |
||
47 | unsigned int motor_bl_ticks; |
||
48 | unsigned int motor_br_ticks; |
||
49 | 31be19a6 | Priya | float scout_theta;
|
50 | |||
51 | f79fbce2 | Priya | pos* scout_pos; |
52 | }; |
||
53 | |||
54 | #endif |