Project

General

Profile

Statistics
| Revision:

root / branches / encoders / code / projects / libdragonfly / odometry.h @ 1345

History | View | Annotate | Download (1.25 KB)

1 1345 chihsiuh
2
/**
3
 * @file odometry.h
4
 * @brief Code for estimating the robots pose.
5
 *
6
 * Offers simple position and orientation information.
7
 *
8
 * @author Colony Project, CMU Robotics Club
9
 **/
10
11
#ifndef __ODOMETRY_C__
12
#define __ODOMETRY_C__
13
14
/**
15
 * @addtogroup odometry
16
 * @{
17
 **/
18
19
//Odometry resolution, *64 microseconds.
20
#define ODOMETRY_CLK 255u
21
#define TIME_SCALE 64
22
23
//Wheel = 2.613 in.
24
//Circumference = 208.508133 mm
25
//Distance per encoder click (circumference / 1024)  = 203.621224 um.
26
//Robot width = 5.3745 in. = 136.5123 mm
27
28
#define ROBOT_WIDTH_UM 137000  //um
29
#define CLICK_DISTANCE_UM 204 //um
30
31
#define DISTANCE_SCALE 2.10526316 //Magic constant.
32
#define ANGLE_SCALE 1.12823207 //Magic constant.
33
34
/** @brief Retrieve the robots estimated x position*/
35
long odometry_dx(void);
36
37
/** @brief Retrieve the robots estimated y position*/
38
long odometry_dy(void);
39
40
/** @brief Retrieve the robots estimated orientation*/
41
double odometry_angle(void);
42
43
/** @brief Initialize odometry. MUST be called before
44
 * the other functions work.**/
45
void odometry_init(void);
46
47
/** @brief Reset position and orientation to the origin facing
48
 * the x axis.*/
49
void odometry_reset(void);
50
51
/** @brief Report estimated velocity [mm/s].*/
52
long odometry_velocity(void);
53
54
/**@}**/ //end group
55
56
#endif