Rev 1337 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
1331 | giacomo | 1 | /* |
2 | * Project: S.Ha.R.K. |
||
3 | * |
||
4 | * Coordinators: Giorgio Buttazzo <giorgio@sssup.it> |
||
5 | * |
||
6 | * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
||
7 | * |
||
8 | * http://www.sssup.it |
||
9 | * http://retis.sssup.it |
||
10 | * http://shark.sssup.it |
||
11 | */ |
||
12 | |||
13 | /* |
||
14 | * Copyright (C) 2000 Paolo Gai |
||
15 | * |
||
16 | * This program is free software; you can redistribute it and/or modify |
||
17 | * it under the terms of the GNU General Public License as published by |
||
18 | * the Free Software Foundation; either version 2 of the License, or |
||
19 | * (at your option) any later version. |
||
20 | * |
||
21 | * This program is distributed in the hope that it will be useful, |
||
22 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
23 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
24 | * GNU General Public License for more details. |
||
25 | * |
||
26 | * You should have received a copy of the GNU General Public License |
||
27 | * along with this program; if not, write to the Free Software |
||
28 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
29 | * |
||
30 | */ |
||
31 | |||
32 | #include "chimera.h" |
||
33 | |||
34 | void my_close(void *arg) |
||
35 | { |
||
36 | int i; |
||
37 | TIME tmp; |
||
38 | |||
39 | end_send(); |
||
40 | |||
41 | for (i=3; i<MAX_PROC; i++){ |
||
42 | if (!jet_getstat(i, NULL, &tmp, NULL, NULL)) |
||
43 | kern_printf("Task Name : %s - Max Time : %d\n", proc_table[i].name, (int)tmp); |
||
44 | } |
||
45 | } |
||
46 | |||
1333 | giacomo | 47 | void action_stand_up(void) { |
48 | |||
1334 | giacomo | 49 | static struct action_event e[20]; |
1339 | giacomo | 50 | int i = 0; |
51 | |||
52 | status.power = 1; |
||
53 | |||
54 | kern_gettime(&(e[i].time)); |
||
55 | ADDUSEC2TIMESPEC(10000000,&(e[i].time)); |
||
1333 | giacomo | 56 | |
1339 | giacomo | 57 | e[i].type = EVT_SET_MASK_LEG_ANGLE; |
58 | e[i].mask = 31; |
||
59 | e[i].ang.a = 0 * 3600; |
||
60 | e[i].ang.b = 80 * 3600; |
||
61 | e[i].ang.c = 0; |
||
62 | e[i].pwm = 7; |
||
1333 | giacomo | 63 | |
1339 | giacomo | 64 | insert_action_event(&(e[i])); |
1333 | giacomo | 65 | |
1339 | giacomo | 66 | kern_gettime(&(e[i+1].time)); |
67 | ADDUSEC2TIMESPEC(11000000,&(e[i+1].time)); |
||
1333 | giacomo | 68 | |
1339 | giacomo | 69 | e[i+1].type = EVT_SET_MASK_LEG_ANGLE; |
70 | e[i+1].mask = 31; |
||
71 | e[i+1].ang.a = 90 * 3600; |
||
72 | e[i+1].ang.b = 80 * 3600; |
||
73 | e[i+1].ang.c = 0; |
||
74 | e[i+1].pwm = 7; |
||
75 | |||
76 | insert_action_event(&(e[i+1])); |
||
77 | |||
78 | kern_gettime(&(e[i+2].time)); |
||
79 | ADDUSEC2TIMESPEC(12000000,&(e[i+2].time)); |
||
1333 | giacomo | 80 | |
1339 | giacomo | 81 | e[i+2].type = EVT_SET_MASK_LEG_ANGLE; |
82 | e[i+2].mask = 31; |
||
83 | e[i+2].ang.a = 90 * 3600; |
||
84 | e[i+2].ang.b = -50 * 3600; |
||
85 | e[i+2].ang.c = 0; |
||
86 | e[i+2].pwm = 7; |
||
87 | |||
88 | insert_action_event(&(e[i+2])); |
||
1334 | giacomo | 89 | |
1339 | giacomo | 90 | kern_gettime(&(e[i+3].time)); |
91 | ADDUSEC2TIMESPEC(13000000,&(e[i+3].time)); |
||
1333 | giacomo | 92 | |
1339 | giacomo | 93 | e[i+3].type = EVT_SET_MASK_LEG_ANGLE; |
94 | e[i+3].mask = 31; |
||
95 | e[i+3].ang.a = 90 * 3600; |
||
96 | e[i+3].ang.b = 0 * 3600; |
||
97 | e[i+3].ang.c = 0; |
||
98 | e[i+3].pwm = 7; |
||
1334 | giacomo | 99 | |
1339 | giacomo | 100 | insert_action_event(&(e[i+3])); |
1336 | giacomo | 101 | |
1339 | giacomo | 102 | kern_gettime(&(e[i+4].time)); |
103 | ADDUSEC2TIMESPEC(15000000,&(e[i+4].time)); |
||
1334 | giacomo | 104 | |
1339 | giacomo | 105 | e[i+4].type = EVT_SET_MASK_LEG_ANGLE; |
106 | e[i+4].mask = 31; |
||
107 | e[i+4].ang.a = 90 * 3600; |
||
108 | e[i+4].ang.b = 0 * 3600; |
||
109 | e[i+4].ang.c = 0; |
||
110 | e[i+4].pwm = 7; |
||
111 | |||
112 | insert_action_event(&(e[i+4])); |
||
1335 | giacomo | 113 | |
1333 | giacomo | 114 | } |
115 | |||
1331 | giacomo | 116 | int main(int argc, char **argv) |
117 | { |
||
118 | TIME seme; |
||
119 | |||
120 | seme = sys_gettime(NULL); |
||
121 | srand(seme); |
||
122 | |||
123 | sys_atrunlevel(my_close, NULL, RUNLEVEL_BEFORE_EXIT); |
||
124 | |||
1335 | giacomo | 125 | clear(); |
126 | |||
1331 | giacomo | 127 | init_send(); /* Comunication */ |
128 | init_key(); /* Keyboard */ |
||
129 | |||
1333 | giacomo | 130 | action_stand_up(); |
131 | |||
1331 | giacomo | 132 | return 0; |
133 | } |