Skip to content

Commit

Permalink
Tests fixed.
Browse files Browse the repository at this point in the history
  • Loading branch information
pvaiko committed Apr 25, 2017
1 parent bf74be6 commit 769907f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions headland.lua
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ function calculateHeadlandTrack( polygon, targetOffset, minDistanceBetweenPoints

--print( string.format( "** Before target=%.2f, current=%.2f, delta=%.2f", targetOffset, currentOffset, deltaOffset))
if currentOffset >= targetOffset then return polygon end

deltaOffset = math.min( deltaOffset, targetOffset - currentOffset )
currentOffset = currentOffset + deltaOffset

Expand Down
12 changes: 6 additions & 6 deletions test.lua
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ calculatePolygonData( field.boundary )
field.vehicle = { location = {x=-5, y=5}, heading = 0 }
field.nHeadlandPasses = 2
field.width = 3
generateCourseForField( field, 2, 3, true, field.vehicle.location, 0, true, 0, 0, 0.5, 30, false )
generateCourseForField( field, 2, 3, true, field.vehicle.location, 0, 0, 0, 0.5, 30, false, true )
writeCourseToFile( field, "CoursePlay_Courses\\test\\course0101.xml" )
--------------------------------------------------------------
-- Smoke test
Expand All @@ -213,11 +213,11 @@ for i, fieldName in ipairs( { "pickles/8", "pickles/9", "pickles/23" }) do
for width = 3, 6 do
print( string.format( "\nGenerating course for field %s with width %d", fieldName, width ))
local field = loadFieldFromPickle( fieldName )
generateCourseForField( field, width, 5, false, field.vehicle.location, 0, true, 0, 0, 0.5, 30, false )
generateCourseForField( field, width, 2, false, field.vehicle.location, 20, true, 1, 3, 0.5, 30, true )
generateCourseForField( field, width, 5, false, field.vehicle.location, 0, 0, 0, 0.5, 30, false, false )
generateCourseForField( field, width, 2, false, field.vehicle.location, 20, 1, 3, 0.5, 30, true, true )
field = loadFieldFromPickle( fieldName .. "_reversed" )
generateCourseForField( field, width, 5, true, field.vehicle.location, 0, true, 0, 0, 0.5, 30, false )
generateCourseForField( field, width, 2, true, field.vehicle.location, 20, true, 1, 3, 0.5, 30, true )
generateCourseForField( field, width, 5, true, field.vehicle.location, 0, 0, 0, 0.5, 30, false, false )
generateCourseForField( field, width, 2, true, field.vehicle.location, 20, 1, 3, 0.5, 30, true, true )
end
end

Expand All @@ -230,7 +230,7 @@ field.nHeadlandPasses = 5
field.width = 4.4
field.isClockwise = "true"

generateCourseForField( field, field.width, field.nHeadlandPasses, false, field.vehicle.location, 0, true, 0, 0, 0.5, 30, false )
generateCourseForField( field, field.width, field.nHeadlandPasses, false, field.vehicle.location, 0, 0, 0, 0.5, 30, false, false )
writeCourseToFile( field, fileName )
os.execute( "del " .. fileName )

Expand Down

0 comments on commit 769907f

Please sign in to comment.