Subversion Repositories shark

Rev

Rev 1333 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1331 giacomo 1
/*
2
 * Project: HARTIK (HA-rd R-eal TI-me K-ernel)
3
 *
4
 * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
5
 *               Gerardo Lamastra <gerardo@sssup.it>
6
 *
7
 * Authors     : Paolo Gai <pj@hartik.sssup.it>
8
 * (see authors.txt for full list of hartik's authors)
9
 *
10
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
11
 *
12
 * http://www.sssup.it
13
 * http://retis.sssup.it
14
 * http://hartik.sssup.it
15
 */
16
 
17
/*
18
 * Copyright (C) 2000 Paolo Gai
19
 *
20
 * This program is free software; you can redistribute it and/or modify
21
 * it under the terms of the GNU General Public License as published by
22
 * the Free Software Foundation; either version 2 of the License, or
23
 * (at your option) any later version.
24
 *
25
 * This program is distributed in the hope that it will be useful,
26
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
27
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
28
 * GNU General Public License for more details.
29
 *
30
 * You should have received a copy of the GNU General Public License
31
 * along with this program; if not, write to the Free Software
32
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
33
 *
34
 */
35
 
36
#include <stdlib.h>
37
#include <string.h>
38
#include <math.h>
39
#include <kernel/kern.h>
40
#include <kernel/func.h>
41
#include <semaphore.h>
42
#include "modules/sem.h"
43
#include "modules/hartport.h"
44
#include <drivers/keyb.h>
45
 
46
#include <servo.h>
47
 
48
/* COM Port Constants */
49
#define COM_PORT COM2
50
#define COM_SPEED 115200
51
 
52
#define com(i) ((i) / 12) ? COM2 : COM1
53
#define pin(i) (i) % 12
54
 
55
/* Angle bounds */
56
#define POS_X_MIN          0
57
#define POS_X_MAX        200
58
#define POS_Y_MIN       -200
59
#define POS_Y_MAX        200
60
#define POS_Z_MIN       -150
61
#define POS_Z_MAX        150
62
 
63
typedef struct { /*describe the position and adc value of a leg*/
64
        int             x;
65
        int             y;
66
        int             z;
67
        int             adc_in;
68
        unsigned char   pwm;
69
} LEG_STATE;
70
 
71
typedef struct { /*describe the position of a leg in servo angles*/
72
        int     a;
73
        int     b;
74
        int     c;
75
} ANGLES_STATE;
76
 
77
typedef struct {
78
        LEG_STATE       leg[6];
79
        char            power;
80
} HEXAPOD_STATE;
81
 
82
/*****************************************/
83
 
84
extern  sem_t           mx_status;
85
extern  HEXAPOD_STATE   status;
86
 
87
void    init_send(void);
88
void    end_send(void);
89
 
90
void    init_key(void);