Subversion Repositories shark

Rev

Rev 1359 | Blame | Compare with Previous | Last modification | View Log | RSS feed

/*
 * Project: S.Ha.R.K.
 *
 * Coordinators: Giorgio Buttazzo <giorgio@sssup.it>
 *
 * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
 *
 * http://www.sssup.it
 * http://retis.sssup.it
 * http://shark.sssup.it
 */


#include "chimera.h"

void my_close(void *arg)
{
        int i;
        TIME tmp;

        end_send();

        for (i=3; i<MAX_PROC; i++){
                if (!jet_getstat(i, NULL, &tmp, NULL, NULL))
                        kern_printf("Task Name : %s - Max Time  : %d\n", proc_table[i].name, (int)tmp);
        }
}

void action_stand_up(void) {
                                                                                                                             
  static struct action_event e[20];
  int i = 0;
 
  status.power = 1;

  kern_gettime(&(e[i].time));
  ADDUSEC2TIMESPEC( 5000000,&(e[i].time));
                                                                                                                             
  e[i].type = EVT_SET_MASK_LEG_ANGLE;
  e[i].mask = 0x3F;
  e[i].ang.a = 0 * 3600;
  e[i].ang.b = 70 * 3600;
  e[i].ang.c = 0;
  e[i].pwm = 7;
                                                                                                                             
  insert_action_event(&(e[i]));
                                                                                                                             
  kern_gettime(&(e[i+1].time));
  ADDUSEC2TIMESPEC( 6000000,&(e[i+1].time));
                                                                                                                             
  e[i+1].type = EVT_SET_MASK_LEG_ANGLE;
  e[i+1].mask = 0x3F;
  e[i+1].ang.a = 90 * 3600;
  e[i+1].ang.b = 70 * 3600;
  e[i+1].ang.c = 0;
  e[i+1].pwm = 7;    
   
  insert_action_event(&(e[i+1]));

  kern_gettime(&(e[i+2].time));
  ADDUSEC2TIMESPEC( 7000000,&(e[i+2].time));
                                                                                                                             
  e[i+2].type = EVT_SET_MASK_LEG_ANGLE;
  e[i+2].mask = 0x3F;
  e[i+2].ang.a = 90 * 3600;
  e[i+2].ang.b = -50 * 3600;
  e[i+2].ang.c = 0;
  e[i+2].pwm = 7;
                                                                                                                             
  insert_action_event(&(e[i+2]));

  kern_gettime(&(e[i+3].time));
  ADDUSEC2TIMESPEC( 8000000,&(e[i+3].time));
                                                                                                                             
  e[i+3].type = EVT_SET_MASK_LEG_ANGLE;
  e[i+3].mask = 0x3F;
  e[i+3].ang.a = 90 * 3600;
  e[i+3].ang.b = 0 * 3600;
  e[i+3].ang.c = 0;
  e[i+3].pwm = 7;
                                                                                                                             
  insert_action_event(&(e[i+3]));

  kern_gettime(&(e[i+4].time));
  ADDUSEC2TIMESPEC(10000000,&(e[i+4].time));
                                                                                                                             
  e[i+4].type = EVT_SET_MASK_LEG_ANGLE;
  e[i+4].mask = 0x3F;
  e[i+4].ang.a = 90 * 3600;
  e[i+4].ang.b = 0 * 3600;
  e[i+4].ang.c = 0;
  e[i+4].pwm = 7;
                                                                                                                             
  insert_action_event(&(e[i+4]));

}

int main(int argc, char **argv)
{
        TIME seme;

        seme = sys_gettime(NULL);
        srand(seme);

        sys_atrunlevel(my_close, NULL, RUNLEVEL_BEFORE_EXIT);

        clear();

        init_send();            /* Comunication */
        init_key();             /* Keyboard */

        action_stand_up();

        return 0;

}