Revision 436
started adding support for getting position data
updated the makefile to support the position data stuff
removed a sleep in ColonetServer that didn't need to be there
trunk/code/projects/colonet/ColonetServer/includes/PositionMonitor.h | ||
---|---|---|
1 |
/** |
|
2 |
* @file PositionMonitor.h |
|
3 |
* |
|
4 |
* @author Jason Knichel |
|
5 |
* |
|
6 |
* @date 2/4/08 |
|
7 |
*/ |
|
8 |
|
|
9 |
#ifndef POSITIONMONITOR_H |
|
10 |
#define POSITIONMONITOR_H |
|
11 |
|
|
12 |
#include <vision.h> |
|
13 |
|
|
14 |
#define MAX_POSITIONS 20 |
|
15 |
|
|
16 |
class PositionMonitor { |
|
17 |
public: |
|
18 |
PositionMonitor(); |
|
19 |
~PositionMonitor(); |
|
20 |
|
|
21 |
int startMonitoring(); |
|
22 |
int stopMonitoring(); |
|
23 |
int getPositions(); |
|
24 |
|
|
25 |
private: |
|
26 |
VisionPosition * positions; |
|
27 |
}; |
|
28 |
|
|
29 |
#endif |
trunk/code/projects/colonet/ColonetServer/ColonetServer.cpp | ||
---|---|---|
104 | 104 |
} |
105 | 105 |
|
106 | 106 |
while(1) { |
107 |
usleep(10000); |
|
108 | 107 |
|
109 | 108 |
connection_pool.perform_select(listen_socket); |
110 | 109 |
|
trunk/code/projects/colonet/ColonetServer/Makefile | ||
---|---|---|
1 | 1 |
# ColonetServer makefile |
2 | 2 |
|
3 | 3 |
CC = g++ |
4 |
CFLAGS = -Wall -Wshadow -Wextra -g -pg
|
|
4 |
CFLAGS = -Wall -Wshadow -Wextra -g |
|
5 | 5 |
|
6 |
COLONETCPPFILES = Main.cpp ColonetServer.cpp ConnectionPool.cpp Command.cpp colonet_wireless.cpp includes/*.h
|
|
6 |
COLONETCPPFILES = Main.cpp ColonetServer.cpp ConnectionPool.cpp Command.cpp colonet_wireless.cpp PositionMonitor.cpp
|
|
7 | 7 |
COLONETCPPOBJECTS = $(COLONETCPPFILES:.cpp=.o) |
8 | 8 |
COLONETFILES = options.c |
9 | 9 |
COLONETOBJECTS = $(COLONETFILES:.c=.o) |
10 | 10 |
LOGGINGFILES = Log.cpp |
11 | 11 |
LOGGINGOBJECTS = $(LOGGINGFILES:.cpp=.o) |
12 | 12 |
9 |
13 |
VPATH = ../lib:../lib/colonet_wireless |
|
14 |
INCLUDE_DIRS = ../lib/colonet_wireless ../lib ../../libwireless/lib ../lib/colonet_wireless includes |
|
15 |
LIBRARY_DIRS = ../lib ../../libwireless/lib ../lib/colonet_wireless |
|
13 |
COLONETHEADERFILES = includes/*.h |
|
16 | 14 |
|
15 |
VPATH = ../lib:../lib/colonet_wireless:../vision |
|
16 |
INCLUDE_DIRS = ../lib/colonet_wireless ../lib ../../libwireless/lib ../lib/colonet_wireless includes ../vision |
|
17 |
LIBRARY_DIRS = ../lib ../../libwireless/lib ../lib/colonet_wireless ../vision |
|
18 |
|
|
17 | 19 |
#this takes the include directory and puts a -I in front of each directory name before being used in a gcc statement |
18 | 20 |
INCLUDE_DIRS_FOR_GCC = $(patsubst %, -I %, $(INCLUDE_DIRS)) |
19 | 21 |
#this takes the library directory and puts a -L in front of each directory name so it can be used in a gcc statement |
... | ... | |
31 | 33 |
../../libwireless/lib/libwireless_colonet.a: ../../libwireless/lib/*.c ../../libwireless/lib/*.h |
32 | 34 |
cd ../../libwireless/lib; make colonet |
33 | 35 |
|
34 |
ColonetServer: ../../libwireless/lib/libwireless_colonet.a $(COLONETCPPFILES) $(COLONETFILES) $(LOGGINGFILES) |
|
36 |
ColonetServer: ../../libwireless/lib/libwireless_colonet.a $(COLONETCPPFILES) $(COLONETFILES) $(LOGGINGFILES) $(COLONETHEADERFILES)
|
|
35 | 37 |
@echo "---begin compilation---" |
36 | 38 |
@echo "" |
37 | 39 |
@echo "---create object files---" |
... | ... | |
41 | 43 |
@echo "---finish creating object files---" |
42 | 44 |
@echo "" |
43 | 45 |
@echo "---link files---" |
44 |
$(CC) $(CFLAGS) $(COLONETOBJECTS) $(COLONETCPPOBJECTS) $(LOGGINGOBJECTS) $(LIBRARY_DIRS_FOR_GCC) -lpthread -lwireless_colonet $(INCLUDE_DIRS_FOR_GCC) -o $@ |
|
46 |
$(CC) $(CFLAGS) $(COLONETOBJECTS) $(COLONETCPPOBJECTS) $(LOGGINGOBJECTS) $(LIBRARY_DIRS_FOR_GCC) -ggdb `pkg-config opencv --cflags --libs` ../vision/vision.o -lpthread -lwireless_colonet $(INCLUDE_DIRS_FOR_GCC) -o $@
|
|
45 | 47 |
@echo "---finish linking files---" |
46 | 48 |
@echo "" |
47 | 49 |
@echo "---finish compilation---" |
trunk/code/projects/colonet/ColonetServer/PositionMonitor.cpp | ||
---|---|---|
1 |
/** |
|
2 |
* @file PositionMonitor.cpp |
|
3 |
* |
|
4 |
* @author Jason Knichel |
|
5 |
* |
|
6 |
* @date 2/4/08 |
|
7 |
*/ |
|
8 |
|
|
9 |
//TODO: make this file asynchronous |
|
10 |
|
|
11 |
#include "includes/PositionMonitor.h" |
|
12 |
#include <stdlib.h> |
|
13 |
#include <vision.h> |
|
14 |
|
|
15 |
PositionMonitor::PositionMonitor() { |
|
16 |
//TODO: don't hardcode this file name |
|
17 |
//TODO: check for error returned from init |
|
18 |
vision_init("/var/www/colonet.jpg"); |
|
19 |
positions = NULL; |
|
20 |
} |
|
21 |
|
|
22 |
PositionMonitor::~PositionMonitor() { |
|
23 |
} |
|
24 |
|
|
25 |
int PositionMonitor::startMonitoring() { |
|
26 |
return 0; |
|
27 |
} |
|
28 |
|
|
29 |
int PositionMonitor::stopMonitoring() { |
|
30 |
return 0; |
|
31 |
} |
|
32 |
|
|
33 |
int PositionMonitor::getPositions() { |
|
34 |
if (positions) |
|
35 |
free(positions); |
|
36 |
|
|
37 |
//TODO: check for error returned |
|
38 |
vision_get_robot_positions(&positions); |
|
39 |
|
|
40 |
return 0; |
|
41 |
} |
Also available in: Unified diff