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