Project

General

Profile

Revision 889

Forgot to add these files to the repository.

View differences:

trunk/code/projects/mapping/odometry/main.c
1
#include <dragonfly_lib.h>
2
#include "odometry.h"
3

  
4
int main(void)
5
{
6
	dragonfly_init(ALL_ON);
7
	odometry_init();
8
	int angle;
9
	while(1){
10
		usb_puts("X: ");
11
		usb_puti(odometry_dx());	
12
		usb_puts(" Y: ");
13
		usb_puti(odometry_dy());	
14
		usb_puts(" Theta: ");
15
		angle = (int)(odometry_angle()*150.0);	
16
		usb_puti(angle);	
17
		usb_puts("\n\r");
18
		delay_ms(500);
19
	}
20
	return 0;
21
}
22

  
23

  
trunk/code/projects/mapping/odometry/odometry.h
1

  
2
#ifndef __ODOMETRY_C__
3
#define __ODOMETRY_C__
4

  
5
//Odometry resolution, *64 microseconds.
6
#define ODOMETRY_CLK 160  //= approx. 10 ms
7

  
8
//Wheel = 2.613 in.  
9
//Circumference = 208.508133 mm
10
//Distance per encoder click (circumference / 1024)  = 203.621224 um.
11
//Robot width = 5.3745 in. = 136.5123 mm
12

  
13
#define ROBOT_WIDTH_MM 137    //mm
14
#define CLICK_DISTANCE_UM 204 //um
15

  
16
//Standard measures will be mm and us
17

  
18
int odometry_dx(void);
19
int odometry_dy(void);
20
float odometry_angle(void);
21
void odometry_init(void);
22
void odometry_reset(void);
23

  
24
#endif

Also available in: Unified diff