10 #define MAX_FILENAME 512
11 #define MAX_PROCESSING_THREADS 8
12 #define MAX_IMAGE_BUFFERS 25
15 #define SODA "/root/develop/allthings_obc2014/src/soda/soda"
23 static pthread_mutex_t
mut = PTHREAD_MUTEX_INITIALIZER;
25 int main(
int argc,
char *argv[])
32 printf(
"CATIA:\tStarting Camera Application Triggering Image Analysis\n");
36 printf(
"CATIA:\tfailed to open /dev/ttySAC0\n");
39 pthread_mutex_init(&
mut, NULL);
55 if (read(
fd, &c, 1) > 0) {
57 }
else if (errno != 11) {
58 printf(
"CATIA:\nSerial error: %d\n" , errno);
73 printf(
"CATIA:\tSHOT %d,%d\n", shoot->
data.nr, shoot->
data.phi);
100 printf(
"CATIA:\tShutdown\n");
110 pthread_mutex_lock(&
mut);
112 pthread_mutex_unlock(&
mut);
113 printf(
"CATIA-%d:\tShooting: too fast\n", shoot->
data.nr);
122 pthread_mutex_unlock(&
mut);
124 printf(
"CATIA-%d:\tShooting: start\n", shoot->
data.nr);
126 printf(
"CATIA-%d:\tShooting: got image %s\n", shoot->
data.nr, filename);
128 pthread_mutex_lock(&
mut);
130 pthread_mutex_unlock(&
mut);
133 sprintf(soda_call,
"%s %s %d %d %d %d %d %d %d %d %d %d",
SODA, filename,
135 shoot->
data.vground, shoot->
data.course, shoot->
data.groundalt);
136 printf(
"CATIA-%d:\tCalling '%s'\n", shoot->
data.nr, soda_call);
137 short int ret = system(soda_call);
138 printf(
"CATIA-%d:\tShooting: soda return %d of image %s\n", shoot->
data.nr, ret, filename);
140 pthread_mutex_lock(&
mut);
142 pthread_mutex_unlock(&
mut);
153 printf(
"CATIA:\thandle_msg_buffer: Send %d\n",
image_idx);
169 struct mora_status_struct status_msg;
170 char *buffer = (
char *) &status_msg;
172 pthread_mutex_lock(&
mut);
176 status_msg.extra = 0;
177 pthread_mutex_unlock(&
mut);
int main(int argc, char *argv[])
static volatile int shooting_idx
static volatile int image_idx
static pthread_mutex_t mut
static char image_buffer[MAX_IMAGE_BUFFERS][IMAGE_SIZE]
static volatile int shooting_thread_count
#define MAX_IMAGE_BUFFERS
static void * handle_msg_shoot(void *ptr)
static void send_msg_image_buffer(void)
static volatile int image_count
static volatile int is_shooting
static void send_msg_status(void)
#define MAX_PROCESSING_THREADS
static volatile int shooting_count
void chdk_pipe_init(void)
Initialize the CHDK pipe.
void chdk_pipe_shoot(char *filename)
Shoot an image.
void chdk_pipe_deinit(void)
Deinitialize CHDK pipe.
#define MORA_PAYLOAD_MSG_SIZE
#define MORA_STATUS_MSG_SIZE
#define MoraHeader(msg_id, payload_len)
#define MoraPutUint8(_byte)
struct dc_shot_union::@293 data
#define MORA_BUFFER_EMPTY
#define MORA_SHOOT_MSG_SIZE
uint8_t bin[MORA_SHOOT_MSG_SIZE]
void parse_mora(struct mora_transport *t, uint8_t c)
struct mora_transport mora_protocol
PX4IO interface protocol.
int serial_init(char *port_name)
void socket_init(int is_server)
int socket_recv(char *buffer, int len)