added a first implementation to main
fixed compilation (apart from trial->alive)
This commit is contained in:
parent
4fd79e8035
commit
6ec6d6015b
11
src/main.c
11
src/main.c
@ -1,10 +1,12 @@
|
|||||||
|
|
||||||
#include "control.h"
|
#include "control.h"
|
||||||
|
#include "path.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
int main(int argc, char **argv) {
|
int main(int argc, char **argv) {
|
||||||
trial *t;
|
trial *t;
|
||||||
|
path *p;
|
||||||
|
|
||||||
if (argc <= 2) {
|
if (argc <= 2) {
|
||||||
fprintf(stderr, "Syntax: %s hostname port\n", argv[0]);
|
fprintf(stderr, "Syntax: %s hostname port\n", argv[0]);
|
||||||
@ -15,6 +17,15 @@ int main(int argc, char **argv) {
|
|||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*create trivial path towards the origin*/
|
||||||
|
p = path_new(&t->map,&t->vehicle);
|
||||||
|
|
||||||
|
while(t->alive){
|
||||||
|
trial_wait_for_input(t);
|
||||||
|
path_execute(t,p);
|
||||||
|
}
|
||||||
|
|
||||||
|
path_free(p);
|
||||||
trial_free(t);
|
trial_free(t);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1,19 +1,24 @@
|
|||||||
#ifndef _PATH_H
|
#ifndef _PATH_H
|
||||||
#define _PATH_H
|
#define _PATH_H
|
||||||
|
|
||||||
|
#include "control.h"
|
||||||
|
|
||||||
|
|
||||||
struct path;
|
struct path;
|
||||||
typedef struct path path;
|
typedef struct path path;
|
||||||
|
|
||||||
|
struct command;
|
||||||
|
typedef struct command command;
|
||||||
|
|
||||||
struct command{
|
struct command{
|
||||||
timestamp ts;
|
timestamp ts;
|
||||||
accel_t accel;
|
accel_t accel;
|
||||||
turn_t turn;
|
turn_t turn;
|
||||||
}
|
};
|
||||||
|
|
||||||
struct path {
|
struct path {
|
||||||
GQueue* commands;
|
GQueue* commands;
|
||||||
}
|
};
|
||||||
|
|
||||||
command *command_new(timestamp ts, accel_t a, turn_t t);
|
command *command_new(timestamp ts, accel_t a, turn_t t);
|
||||||
void command_free(command* c);
|
void command_free(command* c);
|
||||||
|
@ -6,6 +6,7 @@
|
|||||||
main_source = '''
|
main_source = '''
|
||||||
main.c
|
main.c
|
||||||
control.c
|
control.c
|
||||||
|
path.c
|
||||||
'''
|
'''
|
||||||
|
|
||||||
def build(bld):
|
def build(bld):
|
||||||
|
Loading…
Reference in New Issue
Block a user