Subversion Repositories Projects

Compare Revisions

Regard whitespace Rev 966 → Rev 1043

/LoCoHead/headtracker.c
1,3 → 1,10
//////////////////////////////////////
// LocoHead - Mathias Kreider, 2011 //
// //
// headtracker.c //
// I2C, angular and filter functions//
//////////////////////////////////////
 
#include "vector.h"
#include <math.h>
#include <inttypes.h>
/LoCoHead/main.c
1,3 → 1,10
//////////////////////////////////////
// LocoHead - Mathias Kreider, 2011 //
// //
// main.c //
// Main, PPM and Debug functions //
//////////////////////////////////////
 
#include <avr/io.h>
#include <math.h>
#include <stdlib.h>
69,7 → 76,7
 
int main()
{
_delay_ms(500); //delay for VCC stabilization
_delay_ms(500); //delay for VCC stabilisation
ppm_init();
129,7 → 136,7
read_data(&a_avg, &m_avg);
 
//get angle - startoffset
//calculate servo pulselength from sensor data
int heading_us = thr_filter(get_us(get_heading(&a_avg, &m_avg, &p) - heading_start, HDG_MIN, HDG_MAX, HDG_US_MIN, HDG_US_MAX),&thr_in, &thr_out);
int pitch_us = get_us(get_perpendicular(&a_avg, &down, &p) - pitch_start, PIT_MIN, PIT_MAX, PIT_US_MIN, PIT_US_MAX);
int roll_us = get_us(get_perpendicular(&a_avg, &down, &right) - roll_start, ROL_MIN, ROL_MAX, ROL_US_MIN, ROL_US_MAX);;