Changeset 485
- Timestamp:
- 05/06/09 22:30:47 (3 years ago)
- Location:
- trunk/software
- Files:
-
- 1 added
- 8 modified
-
Makefile (modified) (2 diffs)
-
rb/controller.py (modified) (7 diffs)
-
rb/gui/camera.py (modified) (1 diff)
-
rb/gui/gui.glade (modified) (2 diffs)
-
rb/gui/gui.xml (modified) (2 diffs)
-
rb/map.py (added)
-
rb/vision/__init__.py (modified) (1 diff)
-
rb/vision/_vision.c (modified) (1 diff)
-
rb/vision/vision.c (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/software/Makefile
r479 r485 1 1 default: all 2 2 3 all: $(SUBDIRS) rb/gui/gui.xml 3 all: $(SUBDIRS) rb/gui/gui.xml rb/vision/classify_dtree.o 4 4 python setup.py build_ext --inplace 5 5 … … 30 30 # python -m rb.auto 31 31 32 CPPFLAGS = -p -pg -g -Wall -Werror -pedantic -fPIC -O3 $(shell pkg-config --cflags opencv gsl) 33 34 rb/vision/classify_dtree.o: rb/vision/classify_dtree.cpp 35 g++ $(CPPFLAGS) -c -o $@ $+ -
trunk/software/rb/controller.py
r482 r485 1 # Copyright (C) 200 9 Thomas W. Most2 # Copyright (C) 2008 Andy Spencer1 # Copyright (C) 2008-2009 Thomas W. Most 2 # Copyright (C) 2008-2009 Andy Spencer 3 3 # 4 4 # This program is free software: you can redistribute it and/or modify … … 15 15 # along with this program. If not, see <http://www.gnu.org/licenses/>. 16 16 17 import thread 18 from Queue import Queue17 from Queue import Queue, Empty 18 from thread import start_new_thread 19 19 20 20 import gobject 21 21 22 from thread import start_new_thread23 22 import rbconfig 24 23 import rb.drive 25 import rb.gps26 import rb.microstrain27 24 import rb.kalman 28 import rb.vision 29 30 from rb.transcript import TranscriptLogger 25 from rb.transcript import TranscriptLogger 31 26 32 27 … … 110 105 elif nav == 'laptop': 111 106 pass 112 elif nav == 'wiimote':113 pass114 107 115 108 self.navigator = nav 116 117 109 return True 118 110 … … 128 120 129 121 def init_camera(self): 130 self.camera = rb.vision.Camera(self) 122 from rb.vision import Camera 123 self.camera = Camera(self) 131 124 132 125 def init_gps(self): 133 self.gps = rb.gps.GPS(rbconfig.gps_port) 126 from rb.gps import GPS 127 self.gps = GPS(rbconfig.gps_port) 134 128 135 129 def init_microstrain(self): 136 self.microstrain = rb.microstrain.MicroStrain(rbconfig.microstrain_port) 130 from rb.microstrain import MicroStrain 131 self.microstrain = MicroStrain(rbconfig.microstrain_port) 137 132 138 133 … … 147 142 try: 148 143 type, data = self.data_queue.get(timeout=.1) 149 except :144 except Empty: 150 145 pass 151 146 else: … … 166 161 with GTK+ will need to move things to GTK's main loop. 167 162 ''' 168 #print "process(%r, ...) in thread %s" % (type, thread.get_ident())169 170 for interface in [self.auto, self.wiimote, self.shell, self.gui]:171 if interface != False and hasattr(interface, "process"):172 interface.process(type, data)173 174 163 if type == 'gps_fix': 175 164 self.kalman.update_gps(data) … … 180 169 elif type == 'drive_speeds': 181 170 self.kalman.update_drive_speed(data) 171 172 for interface in (self.auto, self.wiimote, self.shell, self.gui): 173 if interface and hasattr(interface, "process"): 174 interface.process(type, data) 175 -
trunk/software/rb/gui/camera.py
r484 r485 25 25 26 26 def expose_cb(self, da, event): 27 print "expose" 27 # This rescales and redraws the image at every expose event, which 28 # is pretty awful. This could pretty easily be changed to at least 29 # keep the scaled image around between exposes. 28 30 if not self.pixbuf: 29 31 return 30 32 # TODO: Scale 31 33 drawable = da.window 32 gc = gtk.gdk.GC(drawable)33 34 alloc = self.get_allocation() 35 new_w = alloc.width 36 new_h = alloc.height 37 scaled_pixbuf = self.pixbuf.scale_simple(new_w, new_h, gtk.gdk.INTERP_NEAREST) 34 38 drawable.draw_pixbuf( 35 gc, self.pixbuf, 39 drawable.new_gc(), 40 scaled_pixbuf, 36 41 0, 0, # src_x, src_y, 37 alloc.x, alloc.x, 38 alloc.width, alloc.height, 39 gtk.gdk.RGB_DITHER_NONE, 40 1, 1, # x_dither, y_dither 42 0, 0, # dest_x, dest_y, 43 alloc.width, alloc.height 41 44 ) -
trunk/software/rb/gui/gui.glade
r482 r485 1 1 <?xml version="1.0" encoding="UTF-8" standalone="no"?> 2 2 <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd"> 3 <!--Generated with glade3 3.4.5 on Thu Apr 30 07:14:522009 -->3 <!--Generated with glade3 3.4.5 on Wed May 6 22:08:34 2009 --> 4 4 <glade-interface> 5 5 <widget class="GtkWindow" id="window"> … … 359 359 </widget> 360 360 <packing> 361 <property name="expand">False</property> 361 362 <property name="position">1</property> 362 363 </packing> -
trunk/software/rb/gui/gui.xml
r482 r485 1 1 <?xml version="1.0"?> 2 <!--Generated with glade3 3.4.5 on Thu Apr 30 07:14:522009 -->2 <!--Generated with glade3 3.4.5 on Wed May 6 22:08:34 2009 --> 3 3 <interface> 4 4 <object class="GtkAdjustment" id="adjustment1"> … … 365 365 </object> 366 366 <packing> 367 <property name="expand">False</property> 367 368 <property name="position">1</property> 368 369 </packing> -
trunk/software/rb/vision/__init__.py
r484 r485 40 40 if __name__ == "__main__": 41 41 test() 42 -
trunk/software/rb/vision/_vision.c
r484 r485 83 83 CvSeqReader reader; 84 84 cvStartReadSeq(seq, &reader, 0); 85 for(int i = 0; i < seq->total; i++) { 85 int i; 86 for(i = 0; i < seq->total; i++) { 86 87 int data[3]; 87 88 CV_READ_SEQ_ELEM(data, reader); -
trunk/software/rb/vision/vision.c
r484 r485 52 52 CvMat* mat= cvCreateMat( 3, 3, CV_32F ); 53 53 CvPoint2D32f from[] = { 54 cvPoint2D32f( 0 , size.height*0.12),55 cvPoint2D32f( 0 , size.height-1),56 cvPoint2D32f( size.width-1, size.height-1),57 cvPoint2D32f( size.width-1, size.height*0.12)54 cvPoint2D32f(1208, 1172), 55 cvPoint2D32f(1196, 1224), 56 cvPoint2D32f(1295, 1178), 57 cvPoint2D32f(1294, 1231) 58 58 }; 59 59 CvPoint2D32f to[] = { 60 cvPoint2D32f( 0 , -62),61 cvPoint2D32f( size.width*0.33, size.height-1),62 cvPoint2D32f( size.width*0.67, size.height-1),63 cvPoint2D32f( size.width-1 , -62)60 cvPoint2D32f(1210, 1170), 61 cvPoint2D32f(1210, 1250), 62 cvPoint2D32f(1290, 1170), 63 cvPoint2D32f(1290, 1250) 64 64 }; 65 65 cvGetPerspectiveTransform(from, to, mat);

