Skip to content

Commit

Permalink
we won with this shit, awww yeahhhhh
Browse files Browse the repository at this point in the history
  • Loading branch information
scotthew1 committed Apr 11, 2014
1 parent 02a105c commit c5c16f7
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 10 deletions.
25 changes: 18 additions & 7 deletions beaglebone/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ def forwardMovement():
# next = vc.findShapes()
cornerFrame = vc.trackCorners()

vc.drawGrid( cornerFrame )
vc.writeFrame( cornerFrame )
vc.drawGrid( lineFrame )
vc.writeFrame( lineFrame )
vc.saveFrameToBuf()

frame = cornerFrame
frame = lineFrame

nudgeMotor = None
nudgeTime = None
Expand Down Expand Up @@ -94,8 +94,8 @@ def mainLoop():
while vc.frameBuf.size() < 5 and vc.lastFlowPnts is None and vc.captureFrame():
lineFrame, intersect, horz = vc.findLines()
cornerFrame = vc.trackCorners()
vc.drawGrid( cornerFrame )
vc.writeFrame( cornerFrame )
vc.drawGrid( lineFrame )
vc.writeFrame( lineFrame )
if intersect:
vc.saveFrameToBuf()

Expand All @@ -106,8 +106,19 @@ def mainLoop():
Log.warning( "could not find directions, trying again.." )
vc.reset()
continue
directions.append( 'Down' )
nextTurn = random.choice( directions )

# next = vc.findShapes()
# if next == 'Destination':
# nextTurn = next
# elif next in directions:
# nextTurn = next
# else:
# nextTurn = random.choice( directions )

Log.info( "Nest turn is: " + nextTurn )

Log.debug( "sending start" )
cl.flush()
cl.start( 13 )
Expand Down Expand Up @@ -233,8 +244,8 @@ def mainLoop():
vc = VideoCapture( outfile=args.outfile, fourcc=args.fourcc )
cl.setup()

# print "starting in 10 seconds..."
# delay( 10000 )
print "starting in 10 seconds..."
delay( 10000 )

# spend some frames letting the camera warm up
for i in range(10):
Expand Down
8 changes: 5 additions & 3 deletions beaglebone/videoLib.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ def __init__( self, infile=None, outfile=None, fourcc="XVID", preview=False ):
Log.info( "opening videoWriter" )
f = fourcc
fourcc = cv.CV_FOURCC( f[0], f[1], f[2], f[3] )
self.writer = cv2.VideoWriter( outfile, fourcc, 20.0, (self.width,self.height) )
self.writer = cv2.VideoWriter( outfile, fourcc, 10.0, (self.width,self.height) )
else:
self.writer = None

Expand Down Expand Up @@ -616,7 +616,7 @@ def findShapes( self ):
# LED light show?
Log.info("Destination detected")
direction = 'Destination'
elif greencount >= 680:
elif greencount >= 100:
# Log.debug( "%s" % greencount )
# convert to grayscale
gray = cv2.cvtColor(crop,cv2.COLOR_BGR2GRAY)
Expand Down Expand Up @@ -669,8 +669,10 @@ def findShapes( self ):
for i in corners:
x,y = i.ravel()
cv2.circle(crop,(x,y),3,255,-1)
else:
direction = 'Up'

return totalgreen
return direction

# Function to mask out the signs on the road this is done to make sure the we don't mess up the line detection.
def maskcolors( self ):
Expand Down

0 comments on commit c5c16f7

Please sign in to comment.