Commit 9e867241 authored by Timothy Stack's avatar Timothy Stack

Fix dependencies and add version info. Send an MTP_SNAPSHOT packet to

the vmc-clients when a robot is lost.  Bump merge tolerance up.
parent 1d5c28a9
...@@ -40,7 +40,7 @@ CFLAGS += -I${SRCDIR}/../../lib/libtb ...@@ -40,7 +40,7 @@ CFLAGS += -I${SRCDIR}/../../lib/libtb
LDFLAGS = -L../mtp -L${OBJDIR}/lib/libtb -L${OBJDIR}/event/lib LDFLAGS = -L../mtp -L${OBJDIR}/lib/libtb -L${OBJDIR}/event/lib
LIBS += -lmtp -ltb -lm LIBS += -lmtp -ltb -lm -lz
ifeq ($(HAVE_MEZZANINE),yes) ifeq ($(HAVE_MEZZANINE),yes)
CFLAGS += -I${SRCDIR}/../mezzanine/libmezz CFLAGS += -I${SRCDIR}/../mezzanine/libmezz
...@@ -48,15 +48,30 @@ LDFLAGS += -L../mezzanine/libmezz ...@@ -48,15 +48,30 @@ LDFLAGS += -L../mezzanine/libmezz
LIBS += -lmezz LIBS += -lmezz
endif endif
DEPS = \
../mtp/mtp.h \
../mtp/mtp_xdr.h \
visionTrack.h \
robotObject.h \
vmcd.h
visionTrack.o: $(DEPS)
robotObject.o: $(DEPS)
vmcd.o: $(DEPS)
test_vmc-client.sh: vmc-client test_vmc-client.sh: vmc-client
test_vmcd.sh: vmcd test_vmcd.sh: vmcd
vmc-client: vmc-client.o vmc-client-version.c: vmc-client.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
vmc-client: vmc-client.o vmc-client-version.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< vmc-client-version.c $(LIBS)
vmcd: vmcd.o visionTrack.o robotObject.o ../mtp/libmtp.a vmcd-version.c: vmcd.o visionTrack.o robotObject.o ../mtp/libmtp.a
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ vmcd.o visionTrack.o robotObject.o $(LIBS) vmcd: vmcd.o visionTrack.o robotObject.o ../mtp/libmtp.a vmcd-version.c
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ \
vmcd.o visionTrack.o robotObject.o vmcd-version.c $(LIBS)
file_dumper: file_dumper.o file_dumper: file_dumper.o
$(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS) $(CC) $(CFLAGS) $(LDFLAGS) -o $@ $< $(LIBS)
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
/** /**
* @file visionTrack.h * @file visionTrack.h
*
*/ */
#include "mtp.h" #include "mtp.h"
...@@ -27,13 +26,14 @@ ...@@ -27,13 +26,14 @@
* The maximum distance in meters for which a track is considered the same from * The maximum distance in meters for which a track is considered the same from
* one frame to the next. * one frame to the next.
*/ */
#define MERGE_TOLERANCE 0.03 #define MERGE_TOLERANCE 0.075
/** /**
* The maximum number of frames that a track can miss before it is considered * The maximum number of frames that a track can miss before it is considered
* lost. * lost.
*/ */
#define MAX_TRACK_AGE 5 #define MAX_TRACK_AGE 5
/** /**
* Structure used to keep a moving average of last N positions. * Structure used to keep a moving average of last N positions.
*/ */
......
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
#include "config.h" #include "config.h"
#include <math.h> #include <math.h>
#include <time.h>
#include <float.h> #include <float.h>
#include <stdio.h> #include <stdio.h>
#include <errno.h> #include <errno.h>
...@@ -196,7 +197,7 @@ static void dump_vision_track(struct vision_track *vt) ...@@ -196,7 +197,7 @@ static void dump_vision_track(struct vision_track *vt)
((struct robot_object *)vt->vt_userdata)->ro_name); ((struct robot_object *)vt->vt_userdata)->ro_name);
} }
void dump_vision_list(struct lnMinList *list) void dump_vision_list(struct lnMinList *list)
{ {
struct vision_track *vt; struct vision_track *vt;
...@@ -473,13 +474,34 @@ static int handle_emc_packet(mtp_packet_t *mp) ...@@ -473,13 +474,34 @@ static int handle_emc_packet(mtp_packet_t *mp)
return retval; return retval;
} }
static void send_snapshots(void)
{
int lpc;
for (lpc = 0; lpc < vmc_client_count; lpc++) {
struct vmc_client *vc = &vmc_clients[lpc];
mtp_send_packet2(vc->vc_handle,
MA_Opcode, MTP_SNAPSHOT,
MA_Role, MTP_ROLE_VMC,
MA_TAG_DONE);
}
}
int main(int argc, char *argv[]) int main(int argc, char *argv[])
{ {
int lpc, current_client = 0, retval = EXIT_SUCCESS; int lpc, current_client = 0, retval = EXIT_SUCCESS;
time_t start_time;
fd_set readfds; fd_set readfds;
roInit(); roInit();
time(&start_time);
info("VMCD %s\n"
" start:\t%s",
build_info,
ctime(&start_time));
FD_ZERO(&readfds); FD_ZERO(&readfds);
lnNewList(&vt_pool); lnNewList(&vt_pool);
...@@ -617,6 +639,7 @@ int main(int argc, char *argv[]) ...@@ -617,6 +639,7 @@ int main(int argc, char *argv[])
/* connect to all specified clients */ /* connect to all specified clients */
for (lpc = 0; lpc < vmc_client_count; lpc++) { for (lpc = 0; lpc < vmc_client_count; lpc++) {
struct camera_config *cc = &vmc_config.cameras.cameras_val[lpc];
struct vmc_client *vc = &vmc_clients[lpc]; struct vmc_client *vc = &vmc_clients[lpc];
if ((vc->vc_handle = mtp_create_handle2(vc->vc_hostname, if ((vc->vc_handle = mtp_create_handle2(vc->vc_hostname,
...@@ -624,16 +647,12 @@ int main(int argc, char *argv[]) ...@@ -624,16 +647,12 @@ int main(int argc, char *argv[])
NULL)) == NULL) { NULL)) == NULL) {
pfatal("mtp_create_handle"); pfatal("mtp_create_handle");
} }
else { else if (mtp_send_packet2(vc->vc_handle,
struct mtp_packet mp; MA_Opcode, MTP_CONFIG_VMC_CLIENT,
MA_Role, MTP_ROLE_VMC,
mtp_init_packet(&mp, MA_X, cc->fixed_x,
MA_Opcode, MTP_CONFIG_VMC_CLIENT, MA_Y, cc->fixed_y,
MA_Role, MTP_ROLE_VMC, MA_TAG_DONE) != MTP_PP_SUCCESS) {
MA_X, vmc_config.cameras.cameras_val[lpc].fixed_x,
MA_Y, vmc_config.cameras.cameras_val[lpc].fixed_y,
MA_TAG_DONE);
if (mtp_send_packet(vc->vc_handle, &mp) != MTP_PP_SUCCESS)
pfatal("could not configure vmc-client"); pfatal("could not configure vmc-client");
} }
} }
...@@ -687,6 +706,7 @@ int main(int argc, char *argv[]) ...@@ -687,6 +706,7 @@ int main(int argc, char *argv[])
if (current_client == vmc_client_count) { if (current_client == vmc_client_count) {
struct vision_track *vt; struct vision_track *vt;
struct robot_object *ro; struct robot_object *ro;
int sent_snapshot = 0;
/* We've got all of the camera tracks, start processing. */ /* We've got all of the camera tracks, start processing. */
frame_count += 1; frame_count += 1;
...@@ -767,6 +787,11 @@ int main(int argc, char *argv[]) ...@@ -767,6 +787,11 @@ int main(int argc, char *argv[])
info("sending wiggle request for %d\n", ro->ro_id); info("sending wiggle request for %d\n", ro->ro_id);
dump_info(); dump_info();
if (!sent_snapshot) {
send_snapshots();
sent_snapshot = 1;
}
mtp_init_packet(&wmp, mtp_init_packet(&wmp,
MA_Opcode, MTP_WIGGLE_REQUEST, MA_Opcode, MTP_WIGGLE_REQUEST,
......
...@@ -22,4 +22,9 @@ struct vmc_client { ...@@ -22,4 +22,9 @@ struct vmc_client {
float vc_bottom; float vc_bottom;
}; };
/**
* Version information.
*/
extern char build_info[];
#endif #endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment