Ejemplo n.º 1
0
 def test_navigation(self):
     swe = swefilmer.Swefilmer(self.xbmc, self.xbmcplugin, self.xbmcgui,
                               self.xbmcaddon)
     nav = navigation.Navigation(self.xbmc, self.xbmcplugin, self.xbmcgui,
                                 self.xbmcaddon, swe, 'plugin', '1', '')
     username, password = nav.get_credentials()
     swe.login(username, password)
Ejemplo n.º 2
0
    def test_part_one(self):
        "Test part one example of Navigation object"

        # 1. Create Navigation object from text
        myobj = navigation.Navigation(text=aoc_10.from_text(PART_ONE_TEXT))

        # 2. Check the part one result
        self.assertEqual(myobj.part_one(verbose=False), PART_ONE_RESULT)
Ejemplo n.º 3
0
    def test_part_two(self):
        "Test part two example of Navigation object"

        # 1. Create Navigation object from text
        myobj = navigation.Navigation(part2=True,
                                      text=aoc_10.from_text(PART_TWO_TEXT))

        # 2. Check the part two result
        self.assertEqual(myobj.part_two(verbose=False), PART_TWO_RESULT)
Ejemplo n.º 4
0
    def test_text_init(self):
        "Test the Navigation object creation from text"

        # 1. Create Navigation object from text
        myobj = navigation.Navigation(text=aoc_12.from_text(EXAMPLE_TEXT))

        # 2. Make sure it has the expected values
        self.assertEqual(myobj.part2, False)
        self.assertEqual(len(myobj.text), 5)
Ejemplo n.º 5
0
    def test_empty_init(self):
        "Test the default Navigation creation"

        # 1. Create default Navigation object
        myobj = navigation.Navigation()

        # 2. Make sure it has the default values
        self.assertEqual(myobj.part2, False)
        self.assertEqual(myobj.text, None)
Ejemplo n.º 6
0
 def test_quality_select(self):
     swe = swefilmer.Swefilmer(self.xbmc, self.xbmcplugin, self.xbmcgui,
                               self.addon)
     nav = navigation.Navigation(self.xbmc, self.xbmcplugin, self.xbmcgui,
                                 self.addon, swe, 'plugin', '1', '')
     stream_urls = [('1080p', 'url1080p'), ('360p', 'url360p'),
                    ('720p', 'url720p')]
     self.assertEqual(nav.quality_select(stream_urls), 'url360p')
     stream_urls = [('sd', 'urlsd'), ('hd', 'urlhd')]
     self.assertEqual(nav.quality_select(stream_urls), 'urlsd')
Ejemplo n.º 7
0
    def test_text_init(self):
        "Test the Navigation object creation from text"

        # 1. Create Navigation object from text
        myobj = navigation.Navigation(text=aoc_10.from_text(EXAMPLE_TEXT))

        # 2. Make sure it has the expected values
        self.assertEqual(myobj.part2, False)
        self.assertEqual(len(myobj.text), 10)
        self.assertEqual(len(myobj.lines), 10)

        # 3. Check methods
        self.assertEqual(myobj.syntax_error_score(), 26397)
Ejemplo n.º 8
0
 def execute(self, userdata):
     nv = navigation.Navigation()
     navi_state = 0
     rospy.loginfo('Start navigation')
     while not rospy.is_shutdown() and not navi_state == 3:
         if navi_state == 0:
             navi_state = nv.input_value()
         elif navi_state == 1:
             navi_state = nv.searchLocationName()
         elif navi_state == 2:
             sate = nv.navigationAC()
     rospy.loginfo('Finish "Navigation"')
     return 'navigation_fin'
Ejemplo n.º 9
0
def part_two(args, input_lines):
    "Process part two of the puzzle"

    # 1. Create the puzzle solver
    solver = navigation.Navigation(part2=True, text=input_lines)

    # 2. Determine the solution for part two
    solution = solver.part_two(verbose=args.verbose, limit=args.limit)
    if solution is None:
        print("There is no solution")
    else:
        print("The solution for part two is %s" % (solution))

    # 3. Return result
    return solution is not None
Ejemplo n.º 10
0
def run():
    args = parse_args()
    params = parser.Yaml(file_name=args.params)

    env = rave.Environment()
    env.SetViewer('qtcoin')
    env.Load(params.scene)
    env.UpdatePublishedBodies()
    robot = env.GetRobots()[0]

    time.sleep(0.1)  # give time for environment to update
    navi = navigation.Navigation(robot, params, verbose=args.verbose)

    if args.test:
        test.test(navi)
    else:
        navi.run()
Ejemplo n.º 11
0
	'reqChangeBand'  		: 10,
	'reqSetHomeAddress'		: 11,
	'reqSetBrightness' 		: 12,
	'reqSetColor'	   		: 13,
	'reqSetContrast'  		: 14,
	'reqSetAddress'	   		: 15,
	'reqGetRecentDestinations': 16
}

messages = []
messages.append(json.dumps({'time': datetime.datetime.utcnow().isoformat() + 'Z'}))


Media = media.Media('media') 
Tuner = tuner.Tuner('tuner') 
Navi = navigation.Navigation('navi')
Settings = settings.Settings('Settings')

def parseMsg(msg):
	try:
		messageObj = json.loads(msg)
	except ValueError:
		LOG.error('Cannot parse message to JSON! ')
		return False
	except:
		LOG.error('Unexpected error: ' + sys.exc_info()[0]); 
		return False
	return messageObj

async def consumer (message):
	messageObj = parseMsg(message)
Ejemplo n.º 12
0
import navigation as nav

addon_handle = int(sys.argv[1])
plugin_base_url = sys.argv[0]
params = dict(urlparse.parse_qsl(sys.argv[2][1:]))
addon_handle = int(sys.argv[1])
addon = xbmcaddon.Addon()

base_url = "plugin://" + xbmcaddon.Addon().getAddonInfo('id')
cookie_path = xbmc.translatePath(addon.getAddonInfo('profile')) + 'COOKIES'
username = addon.getSetting('email')
password = addon.getSetting('password')
region = addon.getSetting('region').lower()

mas = maxdome.MaxdomeSession(username, password, cookie_path, region)
nav = nav.Navigation(mas)

# Router for all plugin actions
if params:
    if 'switchview' in params:
        nav.switchPackageView()
    if 'action' in params:
        if params['action'] == 'list':
            if 'page' in params:
                nav.getPage(params['page'])
            elif 'url' in params:
                path = params['url']
                listAssets(mas.Assets.parseHtmlAssets(path))
            elif 'id' in params:
                navid = params['id']
                use_filter = False
Ejemplo n.º 13
0
#

from http.server import BaseHTTPRequestHandler
import socketserver
import time
import json
import threading
import selectors
from myQueue import SynchronizedQueue
import navigation as nav
import map

PORT        = 8080
NUM_THREADS = 100

nav_solution = nav.Navigation("example.txt")

if hasattr(selectors, 'PollSelector'):
    _ServerSelector = selectors.PollSelector
else:
    _ServerSelector = selectors.SelectSelector


class Handler(BaseHTTPRequestHandler):
    def do_POST(self):
        """ Callback function for handling a POST HTTP request. 
            Uses shared Navigation object to process navigation logic 
            and writes next turn in JSON format to the socket"""
        fields= self.headers.as_string().split('\n')
        output = {}
        for field in fields:
Ejemplo n.º 14
0
 def wrap_djiktras():
     nav = nv.Navigation(start, end, gr)
     print(nav.dij())
Ejemplo n.º 15
0
    robotParameters.cameraOrientation = 'landscape'  # specifies the orientation of the camera, either landscape or portrait
    robotParameters.cameraDistanceFromRobotCenter = 0.1  # distance between the camera and the center of the robot in the direction of the kicker/dribbler in metres
    robotParameters.cameraHeightFromFloor = 0.15  # height of the camera relative to the floor in metres
    robotParameters.cameraTilt = 0.35  # tilt of the camera in radians

    # Vision Processing Parameters
    robotParameters.maxBallDetectionDistance = 1  # the maximum distance away that you can detect the ball in metres
    robotParameters.maxLanderDetectionDistance = 2.5  # the maximum distance away that you can detect the goals in metres
    robotParameters.maxObstacleDetectionDistance = 1.5  # the maximum distance away that you can detect the obstacles in metres

LED_GREEN = 0
LED_RED = 1
LED_YELLOW = 2
v = 0
w = 0
nav = navigation.Navigation()
state = state.State()
vision = vision.Vision()
# MAIN SCRIPT
if __name__ == '__main__':
    try:
        if SIMULATION:
            #sim = rbot.VREP_RoverRobot('127.0.0.1', robotParameters, sceneParameters)
            sim = rbot.VREP_RoverRobot('131.181.33.226', robotParameters,
                                       sceneParameters)
            sim.StartSimulator()
        else:
            ledSetup()
        while True:
            sim.UpdateObjectPositions()
            objects = sim.GetDetectedObjects()
Ejemplo n.º 16
0
import fabric
import form
import button
import planet
import heading
import line
import tweak

# =============================== COMPONENTS =============================== #
# STATUS: ENABLE TO UPDATE/EDIT
# >> ADD NEW COMPONENTS HERE
components = [
    body.Body().draw(),
    link.Link().draw(),
    div.Div().draw(),
    navigation.Navigation().draw(),
    container.Container().draw(),
    footer.Footer().draw(),
    card.Card().draw(),
    paper.Paper().draw(),
    fabric.Fabric().draw(),
    form.Form().draw(),
    button.Button().draw(),
    planet.Planet().draw(),
    heading.Heading().draw(),
    line.Line().draw(),
    tweak.Tweak().draw(),
]

# ================================ POINTERS ================================ #
# STATUS: DONT CHANGE ANYTHING