Subversion Repositories shark

Compare Revisions

Ignore whitespace Rev 1334 → Rev 1333

/demos/trunk/chimera/chimera.c
50,45 → 50,28
 
void action_stand_up(void) {
static struct action_event e[20];
static struct action_event e[6];
int i,temp;
for (i=0;i<3;i++) {
for (i=0;i<5;i++) {
kern_gettime(&(e[i].time));
ADDUSEC2TIMESPEC(10000000,&(e[i].time));
temp = i*1000000;
ADDUSEC2TIMESPEC(temp,&(e[i].time));
kern_gettime(&(e[i].time));
ADDUSEC2TIMESPEC(10000000,&(e[i].time));
temp = i*1000000;
ADDUSEC2TIMESPEC(temp,&(e[i].time));
e[i].type = EVT_SET_MASK_LEG_ANGLE;
e[i].mask = 1 << i;
*(int *)(e[i].data) = 45 * 3600;
*(int *)(e[i].data + 4) = 0;
*(int *)(e[i].data + 8) = 0;
*(unsigned char *)(e[i].data + 12) = 7;
e[i].type = EVT_SET_MASK_LEG_ANGLE;
e[i].mask = 1 << i;
*(int *)(e[i].data) = 45 * 3600;
*(int *)(e[i].data + 4) = 0;
*(int *)(e[i].data + 8) = 0;
*(int *)(e[i].data + 12) = 0;
*(unsigned char *)(e[i].data + 16) = 7;
insert_action_event(&(e[i]));
insert_action_event(&(e[i]));
}
 
for (i=0;i<3;i++) {
kern_gettime(&(e[6+i].time));
ADDUSEC2TIMESPEC(20000000,&(e[6+i].time));
temp = i*1000000;
ADDUSEC2TIMESPEC(temp,&(e[6+i].time));
e[6+i].type = EVT_SET_MASK_LEG_ANGLE;
e[6+i].mask = 1 << i;
*(int *)(e[6+i].data) = 0 * 3600;
*(int *)(e[6+i].data + 4) = 0;
*(int *)(e[6+i].data + 8) = 0;
*(unsigned char *)(e[i].data + 12) = 7;
insert_action_event(&(e[6+i]));
}
}
 
int main(int argc, char **argv)
/demos/trunk/chimera/send.c
177,10 → 177,10
status.ang[i].a = angles[i].a = *(int *)(e->data);
status.ang[i].b = angles[i].b = *(int *)(e->data+4);
status.ang[i].c = angles[i].c = *(int *)(e->data+8);
status.cfg[i].pwm = *(unsigned char *)(e->data+12);
status.cfg[i].pwm = *(unsigned char *)(e->data+16);
 
//#ifdef DEBUG_SEND
printf_xy(3,2,WHITE,"%8d: Update leg %2d angle",(int)kern_gettime(NULL),i);
cprintf("Update leg %d angle\n",i);
//#endif
 
 
/demos/trunk/chimera/keys.c
51,17 → 51,17
case KEY_Q:
//sem_wait(&mx_status);
status.cfg[active_leg].pwm ^= 0x1;
status.leg[active_leg].pwm ^= 0x1;
//sem_post(&mx_status);
break;
case KEY_W:
//sem_wait(&mx_status);
status.cfg[active_leg].pwm ^= 0x2;
status.leg[active_leg].pwm ^= 0x2;
//sem_post(&mx_status);
break;
case KEY_E:
//sem_wait(&mx_status);
status.cfg[active_leg].pwm ^= 0x4;
status.leg[active_leg].pwm ^= 0x4;
//sem_post(&mx_status);
break;
/demos/trunk/chimera/action.c
43,8 → 43,6
 
f = kern_fsave();
 
e->status = EVT_STATUS_WAIT;
 
if (!t) {
first_action_event = e;
67,6 → 65,11
 
t = first_action_event;
 
while(t) {
cprintf("Time %d:%d\n",t->time.tv_sec,t->time.tv_nsec);
t = t->next;
}
 
kern_frestore(f);
 
return 0;
120,7 → 123,6
 
if (TIMESPEC_A_GT_B(time,&(t->time))) {
first_action_event = t->next;
t->status = EVT_STATUS_EXEC;
kern_frestore(f);
return t;
}