Go to most recent revision |
Blame |
Last modification |
View Log
| RSS feed
/*
* Project: S.Ha.R.K.
*
* Coordinators:
* Giorgio Buttazzo <giorgio@sssup.it>
* Paolo Gai <pj@gandalf.sssup.it>
*
* Authors :
* Paolo Gai <pj@gandalf.sssup.it>
* Massimiliano Giorgi <massy@gandalf.sssup.it>
* Luca Abeni <luca@gandalf.sssup.it>
* (see the web pages for full authors list)
*
* ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy)
*
* http://www.sssup.it
* http://retis.sssup.it
* http://shark.sssup.it
*/
/**
------------
CVS : $Id: auto.h,v 1.1.1.1 2002-09-02 09:37:42 pj Exp $
File: $File$
Revision: $Revision: 1.1.1.1 $
Last update: $Date: 2002-09-02 09:37:42 $
------------
**/
/*
* Copyright (C) 2000 Marco Dallera and Marco Fiocca
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*
*/
/*
* AUTO
*
* Another Unuseful Track simulatOr
*
* Authors: Marco Dallera
* Marco Fiocca
*
*/
/* ------------------- */
/* Useful structures */
/* ------------------- */
#ifndef __CAR_H_
#define __CAR_H_
#include <modules/cabs.h>
#include <kernel/func.h>
#include <kernel/model.h>
#include <kernel/types.h>
#include <drivers/keyb.h>
#include <drivers/glib.h>
#include <semaphore.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "const.h"
#define degree_to_rad(a) ((M_PI/180.0)*(a))
#define rad_to_degree(a) ((180.0/M_PI)*(a))
typedef struct {
int x;
int y;
} point;
typedef struct {
float x,y;
} point_f;
typedef struct {
float mod;
float phase;
} vector;
typedef struct {
point_f pos;
float orient;
} car_status;
typedef struct {
int left_border;
int right_border;
int distance;
float curve;
point opps_list[MAX_CAR_NUMBER];
int opps_number;
int collision;
int flag;
} road_info;
typedef struct {
int left,center,right;
} road_strip;
typedef struct {
PID sensor_pid,control_pid;
int number;
char driver[MAX_DRIVER_NAME_LENGTH];
float max_speed, min_acc, max_acc;
float rage;
CAB road_status_cab;
CAB car_status_cab;
int color;
} car_params;
typedef struct {
char name[MAX_TRACK_NAME_LENGTH]; // il nome del file
point pole_pos; // la posizione di partenza
float pole_orient; // la direzione di partenza
int lap; // il senso di marcia: CLOCK, ANTICLOCK
int selected; // it's a flag marking the actually selected track
} track;
typedef struct {
int min;
int sec;
int dec;
} time;
extern car_params cars[MAX_CAR_NUMBER];
extern char track_img[TRACK_WIDTH*TRACK_HEIGHT];
extern track track_list[TRACK_NUMBER];
/* ---------------------------------------- */
/* Functions definition */
/* ---------------------------------------- */
/* CABs R/W functions */
int set_car_status(car_status, CAB); // sends the new status according to the control law
car_status get_car_status(CAB); // reads car status from a CAB
int set_road_info(road_info, CAB); // sends the new road informations
road_info get_road_info(CAB); // reads road status values from a CAB
/* Keyboard functions */
void keyb_handler();
void endfun(KEY_EVT *);
void my_close(void *);
/* Display functions */
void bar_display(point p1, int width, int height, int border, float var, float max, int color, char *name);
void bidir_bar_display(point p1, int width, int height, int border, float var, float max, int color, char *name);
void cmd_display();
/* Closing function */
void byebye();
void error_msg();
/* Tasks */
TASK sensor(); // Camera car task
TASK control(); // Car controller task
TASK manual(); // Manual driving task
TASK actuator(); // Graphic drawing task
TASK info(); // Car informations display task
/* Tasks management */
void hard_car_create();
void soft_car_create();
void killcar();
/* Tracks management */
int track_init();
#endif