Ejemplo n.º 1
0
 def testConstruction(self):
     boat = SailBoat()
     course = Course()
     chart = Chart()
     router = Router(boat=boat, course=course, chart=chart)
     router.construct_legs()
     self.assertEqual(1, len(router.legs))
Ejemplo n.º 2
0
 def testValidRoute(self):
     p1 = Position(0.9, 0.9)
     p2 = Position(1.0, 1.0)
     p3 = Position(1.0, 1.1)
     pt1 = Position(0.99, 1.0)
     pt2 = Position(1.01, 1.0)
     r1 = Route((p1, pt1, p3))
     r2 = Route((p1, pt2, p3))
     c = Course((p1, p2, p3))
     boat = SailBoat()
     chart = Chart()
     router = Router(boat=boat, course=c, chart=chart)
     self.assertFalse(router.valid_route(r1))
     self.assertTrue(router.valid_route(r2))
     c.marks[0].to_port = True
     self.assertTrue(router.valid_route(r1))
     self.assertFalse(router.valid_route(r2))
Ejemplo n.º 3
0
#!/usr/bin/env python2.7
"""
This scripts prints the status of the currently configured sol boat

Author: Jaap Versteegh <*****@*****.**>
"""

import sys, os
# Add softsailor to the python path
sys.path.append(os.path.join(os.path.dirname(__file__), ".."))

from softsailor.utils import *
from softsailor.boat import SailBoat
from softsailor.sol.sol_functions import fetch_boat, get_settings

boat = SailBoat()
fetch_boat(boat)

settings = get_settings()
if settings.chart == '':
    area = settings.area
    print "Map tiles     : ", settings.tilemap, \
        lat_to_str(area[0]), lat_to_str(area[1]), \
        lon_to_str(area[2]), lon_to_str(area[3])
else:
    print "Chart          : ", settings.chart

print "Weather       : ", settings.weather

print "Boat latitude : ", lat_to_str(boat.position[0])
print "Boat longitude: ", lon_to_str(boat.position[1])
Ejemplo n.º 4
0
 def testGetBoat(self):
     boat = SailBoat()
     boat.heading = -1
     fetch_boat(boat)
     self.assertTrue(boat.heading > 0, 'Test valid boat heading')
Ejemplo n.º 5
0
 def testGetBoat(self):
     boat = SailBoat()
     boat.heading = -1
     fetch_boat(boat)
     self.assertTrue(boat.heading > 0, 'Test valid boat heading')
Ejemplo n.º 6
0
 def testGetBoat(self):
     boat = SailBoat()
     boat.heading = -1
Ejemplo n.º 7
0
 def setUp(self):
     self.boat = SailBoat()
     self.boat.position = (1.0, 1.0)
     self.boat.speed = 5
     self.boat.heading = math.pi
     self.updater = BoatUpdater(self.boat)
Ejemplo n.º 8
0
 def setUp(self):
     self.boat = SailBoat()
     self.controller = BoatController(self.boat)
Ejemplo n.º 9
0
 def setUp(self):
     self.boat = SailBoat()