hostsim enhancements
[aversive.git] / projects / microb2010 / sensorboard / beacon.h
1 /*  
2  *  Copyright Droids Corporation (2008)
3  * 
4  *  This program is free software; you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation; either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  This program is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with this program; if not, write to the Free Software
16  *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
17  *
18  *  Revision : $Id: beacon.h,v 1.2 2009-05-27 20:04:07 zer0 Exp $
19  *
20  */
21
22 struct beacon {
23         int32_t beacon_speed;
24         
25         int32_t opponent_angle;
26         int32_t opponent_dist;
27         int32_t prev_opponent_angle;
28         int32_t prev_opponent_dist;
29         int32_t robot_x;
30         int32_t robot_y;
31         int32_t robot_angle;
32         int32_t opponent_x;
33         int32_t opponent_y;
34 };
35
36 /* real encoder value: 3531.75 so, multiple by 4 to have round
37  * value */
38 #define BEACON_STEP_TOUR (14127L)
39 #define BEACON_OFFSET_CALIBRE 40
40
41 extern struct beacon beacon;
42
43 void beacon_dump(void);
44 void beacon_init(void);
45 void beacon_calibre_pos(void);
46 void beacon_start(void);
47 void beacon_stop(void);
48 void beacon_calc(void *dummy);
49 void beacon_angle_dist_to_x_y(int32_t angle, int32_t dist, int32_t *x, int32_t *y);
50
51 void beacon_reset_pos(void);
52 void beacon_set_consign(int32_t val);
53
54 int32_t encoders_spi_get_beacon_speed(void *dummy);
55 int32_t encoders_spi_update_beacon_speed(void *number);
56 int32_t encoders_spi_get_value_beacon(void *number);
57
58