74 lines
1.2 KiB
C
74 lines
1.2 KiB
C
#ifndef _CONTROL_H
|
|
#define _CONTROL_H
|
|
|
|
#include <glib.h>
|
|
|
|
typedef enum { ACCELERATING, ROLLING, BRAKING } accel_t;
|
|
typedef enum { TURN_HARD_LEFT, TURN_LEFT, TURN_STRAIGT, TURN_RIGHT, TURN_HARD_RIGHT } turn_t;
|
|
|
|
typedef enum { BOLDER, CRATER, MARTIAN } object_t;
|
|
|
|
struct object;
|
|
typedef struct object object;
|
|
|
|
struct vehicle;
|
|
typedef struct vehicle vehicle;
|
|
|
|
struct telemetry;
|
|
typedef struct telemetry telemetry;
|
|
|
|
struct map;
|
|
typedef struct map map;
|
|
|
|
struct trial;
|
|
typedef struct trial trial;
|
|
|
|
typedef unsigned int timestamp;
|
|
|
|
|
|
|
|
struct object {
|
|
object_t type;
|
|
double x, y, rad;
|
|
double dir, speed;
|
|
};
|
|
|
|
struct vehicle {
|
|
accel_t accel;
|
|
turn_t turn;
|
|
double x, y;
|
|
double dir, speed;
|
|
};
|
|
|
|
struct telemetry {
|
|
timestamp ts;
|
|
vehicle vehicle;
|
|
GArray objects;
|
|
};
|
|
|
|
struct map {
|
|
float dx, dy;
|
|
timestamp limit;
|
|
float min_sensor, max_sensor;
|
|
float max_speed, max_turn, max_turn_hard;
|
|
|
|
GList solid_objects;
|
|
};
|
|
|
|
struct trial {
|
|
map map;
|
|
timestamp last_ts;
|
|
GList telemetry_data;
|
|
vehicle vehicle; /* our view */
|
|
};
|
|
|
|
/* trial */
|
|
trial *trial_new();
|
|
void trial_reset_run(trial *trial);
|
|
void trial_wait_for_start(trial *trial);
|
|
void trial_check_input(trial *trial);
|
|
void trial_wait_for_input(trial *trial);
|
|
void trial_free(trial *trial);
|
|
|
|
#endif
|