def setUp(self): self.browser = webdriver.Chrome(ChromeDriverManager().install()) self.navigator = Navigator(self.browser) self.browser.get( "https://kkstream.testrail.net/index.php?/runs/overview/30") self.navigator.loginPage().userName().input() self.navigator.loginPage().passWord().input() self.navigator.loginPage().submitButton().tap()
def goToCoordinates(lat, lon): gps = GPS.GPS() path = Navigator.generatePath(gps.getLocation(), [lat, lon]) Navigator.dictPrint(path) #print(path) for node in reversed(path): print("Next Node Reached") driveToNode(node) while Navigator.distance(gps.getLocation(), node.coords) > 5: time.sleep(.5) #When the loop exits, we have arrived at next point in path stop()
def driveToNode(node): gps = GPS.GPS() location = gps.getLocation() currentHeading = gps.getHeading() targetHeading = gps.calculateHeadingFromCoords(location, node.coords) delta = targetHeading - currentHeading if delta > 180: delta = delta - 360 if delta < -180: delta = delta + 360 distance = Navigator.distance(location, node.coords) #I don't think this part will be relevant for our purposes, but it's cool math nonetheless radius = 12 #In inches distanceToTravel = math.pi * (radius**2) distanceToTravel = distanceToTravel * (delta / 720) #Could take average inches per milisecond at full throttle and calculate. #Problem is that this would probably vary with the charge of the battery if delta > 0: stop() pi.set_PWM_dutycycle(leftMotorFwd, 255) pi.set_PWM_dutycycle(rightMotorBkd, 255) else: stop() pi.set_PWM_dutycycle(leftMotorBkd, 255) pi.set_PWM_dutycycle(rightMotorFwd, 255) time.sleep(abs(delta) / 80) stop() if locked == False: pi.set_PWM_dutycycle(leftMotorFwd, 255) pi.set_PWM_dutycycle(rightMotorFwd, 255)
def __init__(self, maze_dim): ''' Use the initialization function to set up attributes that your robot will use to learn and navigate the maze. Some initial attributes are provided based on common information, including the size of the maze the robot is placed in. ''' self.location = [0, 0] self.heading = 'up' self.maze_dim = maze_dim self.maze = Mapper(maze_dim) self.idx_dir_map = {0:"l", 1:"u",2:"r", 3:"d"} self.dir_idx_map = {"left":0, "up":1,"right":2, "down":3, "l":0, "u":1, "r":2, "d":3} self.navigator = Navigator() self.second = False
def main(): rospy.logerr("before before lineee") rospy.init_node('accio_backend') wait_for_time() # TODO incorporate navigation navigator = Navigator.Navigator() station_handler = StationInformation.StationInformation(navigator) print("Initializing the gripper, arm, torso, head...") print("To quit before these are initialized, do ctrl-C and then ctrl-D.") gripper = Gripper() print("Gripper ready...") arm = Arm() print("Arm ready...") torso = Torso() print("Torso ready...") head = Head() print("Head ready...") base = Base() print("Base ready...") program_handler = ProgramHandler(PROGRAM_FILE, gripper, arm, torso, head, base) #load_program(PROGRAM_FILE, gripper, arm, torso, head) # karan commented this out, refactoring status_pub = rospy.Publisher('print_update', std_msgs.msg.String, queue_size=10) order_handler = OrderHandler.OrderHandler(station_handler, program_handler, status_pub) robot_state = RobotState(order_handler, status_pub) rospy.sleep(1) #rospy.Subscriber('available_items', acciobot_main.msg.ItemStock, printHI) rospy.Subscriber('dispatch_order', acciobot_main.msg.Order, robot_state.order_callback) # dispatch_sub = rospy.Subscriber('dispatch_order', acciobot_main.msg.Order, printHI) def stop_things(): navigator.stop() arm.cancel_all_goals() base.stop() rospy.on_shutdown(stop_things) rospy.logerr("Waiting for orders") while True: if robot_state.get_current_order() is not None: rospy.logerr("Robot state has a current order") order = order_handler.remove_order(robot_state.get_current_order()) success = order.fulfill_order() # TODO: Uncomment when navigation is ready print("press enter to continue [removed]") # raw_input() navigator.move_to_posestamped( station_handler.get_cashier().location) robot_state.finished_order() rospy.sleep(1)
def processUrl(data, readStandalone): nav = Navigator.Navigator(data).getFinancialUrls() basicSheet = BasicsScrapper.BasicsScrapper(nav['Basic']).readPage() # print("Basic Sheet processed") finData = readFinancialData(nav,basicSheet, readStandalone) if(not finData is None): basicSheet = updateBasicData(basicSheet, finData) writeData(basicSheet, finData) print("finished processing ", data) time.sleep(5)
def Init(LayoutFile=None,scale=4,speed=None,center_offset=0): """ Initialize the module. Must be called before any of the module functions can be called. Parameters: All parameters are optional. LayoutFile: <String> The name of the text file defining the map. If this parameter is provided, then the module will keep track of the subject's position in the layout and the subject will be prevented from moving through walls. This parameter must be given to use CanMoveForward and GetView. scale: <Float> The distance in meters between the center of two nodes in the environment. This is the distance that the subject will move when GoForward is called. speed: <Float> The speed that the subject will move forward in meters per second. If None, then the speed will be set to scale. center_offset: <Float> The distance in meters that the subject is separated from his axis of rotation. The axis of rotation is always the center of a node. Return Value: None. """ global __MOVEMENT_VAR, __PLAT_VAR if not speed: speed = scale __MOVEMENT_VAR = __MOVEMENT_CLASS(0,0,0,scale,speed,center_offset) viz.eyeheight(0.0) #viz.setfov(70,1) viz.mouse(viz.OFF) # don't want mouse input viz.callback(viz.TIMER_EVENT, TimerCallback) if LayoutFile: try: # use __PLAT_VAR to hold info about LayoutFile width, height, size = Navigator.getPlatDim(LayoutFile) __PLAT_VAR = Navigator.PLAT(width,height,size) __PLAT_VAR.ReadTextImage(LayoutFile) __PLAT_VAR.ComputeAllViews(100) except: __PLAT_VAR = None raise ("\n****** Error in Movement.Init ******\nUnable to initialize Plat Object with '%s'\n"%LayoutFile)
def __init__(self, filename, initialState): (_w, _h, _s) = Navigator.getPlatDim(filename) self.MyPlat = Navigator.PLAT(_w, _h, _s) self.MyPlat.ReadTextImage(filename) self.MyPlat.ComputeAllViews(100) self.PossiblePositions = [] #------------------------------------------------- # BJS 6/5/2002 # Compute all of the possible positions in the environment. # Place all possible positions in the array PossiblePositions #------------------------------------------------- for position in self.MyPlat.ChosenList: for vCount in range(4): self.PossiblePositions.append( (position[0], position[1], vCount)) #------------------------------------------------- # Set the current state. # Convert from actual coordinates and angle. #------------------------------------------------- (x, y, t) = initialState if (t > -10 or t > 350) and t < 10: pos = (x, y, 1) elif t > 80 and t < 100: pos = (x, y, 2) elif t > 170 and t < 190: pos = (x, y, 3) else: pos = (x, y, 0) self.CurrState = pos #------------------------------------------------- # BJS 6/5/2002 # Compute the view at the current state (CurrState) #------------------------------------------------- self.currView = self.MyPlat.Nodes[self.CurrState[0]][ self.CurrState[1]].View[self.CurrState[2]] #------------------------------------------------- # BJS 6/5/2002 # Find the states in the set of possible states that are # consistent with the current view. #------------------------------------------------- self.PossiblePositions = self.MyPlat.FindView( self.currView, self.PossiblePositions[:])
def __init__(self, serverQueue, serverLock, location, direction): #These variables deal with orders being processed from server self.serverQueue = serverQueue self.serverLock = serverLock self.currentOrder = None threading.Thread.__init__(self) #these variables handle the state of the machine self.state = botstates.IDLE self.prevState = botstates.IDLE self.leds = LEDManager.BotLEDManager() self.navigator = Navigator.Navigator(directions.getDir(direction), location) self.dispensor = Dispensor.Dispensor() self.listener = Listener.Listener(listenerPort, self.serverQueue, self.serverLock) self.pusher = Pusher.Pusher(pusherPort, self.serverQueue, self.serverLock) self.listener.start() self.pusher.start()
def __init__(self, filename, width, height, length): self.viewmode = 0 self.scale = width + length self.width = width self.height = height self.length = length #target location pointer self.targetpointer = viz.addchild( './Layouts/SharedMedia/Objects/bvmap_target_pointer.wrl') self.targetpointer.scale(self.scale * 0.8, self.scale * 0.8, self.scale * 0.8) self.targetpointer.disable(viz.LIGHTING) self.targetpointer.curtain(viz.CLOSE) (_w, _h, _s) = Navigator.getPlatDim(filename) MyPlat = Navigator.PLAT(_w, _h, _s) MyPlat.ReadTextImage(filename) #MyPlat.DisplayTextImage() maxx = -1 maxy = -1 minx = -1 miny = -1 #belief vector pointers self.pointers = [] for y in range(MyPlat.y): for x in range(MyPlat.x): if (x, y) in MyPlat.ChosenList: if x > maxx or maxx == -1: maxx = x if x < minx or minx == -1: minx = x if y > maxy or maxy == -1: maxy = y if y < miny or miny == -1: miny = y pointer_0 = viz.addchild( './Layouts/SharedMedia/Objects/bvmap_pointer.wrl') pointer_0.scale(self.scale, self.scale, self.scale) pointer_0.disable(viz.LIGHTING) pointer_0.curtain(viz.CLOSE) pointer_90 = viz.addchild( './Layouts/SharedMedia/Objects/bvmap_pointer.wrl') pointer_90.scale(self.scale, self.scale, self.scale) pointer_90.disable(viz.LIGHTING) pointer_90.curtain(viz.CLOSE) pointer_180 = viz.addchild( './Layouts/SharedMedia/Objects/bvmap_pointer.wrl') pointer_180.scale(self.scale, self.scale, self.scale) pointer_180.disable(viz.LIGHTING) pointer_180.curtain(viz.CLOSE) pointer_270 = viz.addchild( './Layouts/SharedMedia/Objects/bvmap_pointer.wrl') pointer_270.scale(self.scale, self.scale, self.scale) pointer_270.disable(viz.LIGHTING) pointer_270.curtain(viz.CLOSE) pointer_0.translate(x * self.scale, self.height + self.scale * 0.11, -y * self.scale + self.scale * 0.125) pointer_90.translate(x * self.scale + self.scale * 0.125, self.height + self.scale * 0.11, -y * self.scale) pointer_180.translate(x * self.scale, self.height + self.scale * 0.11, -y * self.scale - self.scale * 0.125) pointer_270.translate(x * self.scale - self.scale * 0.125, self.height + self.scale * 0.11, -y * self.scale) pointer_0.rotate(180, 90, 180) pointer_90.rotate(180, 90, 90) pointer_180.rotate(180, 90, 0) pointer_270.rotate(180, 90, 270) self.pointers.append([(x, y, 0), pointer_0]) self.pointers.append([(x, y, 90), pointer_90]) self.pointers.append([(x, y, 180), pointer_180]) self.pointers.append([(x, y, 270), pointer_270]) # find center point (midx,midy) minx = minx * self.scale maxx = maxx * self.scale miny = -miny * self.scale maxy = -maxy * self.scale midx = (maxx + minx) / 2 midy = (maxy + miny) / 2 #find out how far away the farthest point from the center is. farthest = max([(midx - minx), (-midy + miny)]) _yoffset = farthest + self.height + self.scale self.clipLevel = { "showMap": (_yoffset - self.height - 1.5, _yoffset - self.height), "hideMap": (_yoffset - self.height - 1.6, _yoffset - self.height - 1.5) } # Create a new window in the lower left corner self.window = viz.add(viz.WINDOW) self.window.position(0, 0.4) self.window.size(0.3, 0.4) self.window.fov(90, 1) # Create a new viewpoint and attach it to the window self.view = viz.add(viz.VIEWPOINT) self.window.viewpoint(self.view) self.view.translate(midx, _yoffset, midy) self.view.rotate(1, 0, 0, 90) # Hide the window. self.window.clip(*self.clipLevel["hideMap"])
class Robot(object): def __init__(self, maze_dim): ''' Use the initialization function to set up attributes that your robot will use to learn and navigate the maze. Some initial attributes are provided based on common information, including the size of the maze the robot is placed in. ''' self.location = [0, 0] self.heading = 'up' self.maze_dim = maze_dim self.maze = Mapper(maze_dim) self.idx_dir_map = {0:"l", 1:"u",2:"r", 3:"d"} self.dir_idx_map = {"left":0, "up":1,"right":2, "down":3, "l":0, "u":1, "r":2, "d":3} self.navigator = Navigator() self.second = False def next_move(self, sensors): ''' Use this function to determine the next move the robot should make, based on the input from the sensors after its previous move. Sensor inputs are a list of three distances from the robot's left, front, and right-facing sensors, in that order. Outputs should be a tuple of two values. The first value indicates robot rotation (if any), as a number: 0 for no rotation, +90 for a 90-degree rotation clockwise, and -90 for a 90-degree rotation counterclockwise. Other values will result in no rotation. The second value indicates robot movement, and the robot will attempt to move the number of indicated squares: a positive number indicates forwards movement, while a negative number indicates backwards movement. The robot may move a maximum of three units per turn. Any excess movement is ignored. If the robot wants to end a run (e.g. during the first training run in the maze) then returing the tuple ('Reset', 'Reset') will indicate to the tester to end the run and return the robot to the start. ''' if self.second: # if in the second run, carry out steps in the store optimal moves (rotation, movement) = self.navigator.steps[0] del self.navigator.steps[0] return rotation, movement # default use the target search (rotation, movement) = self.navigator.target_search(self.location, self.heading, self.maze) # (rotation, movement) = self.navigator.counter_search(self.location, self.heading, sensors, self.maze) if (rotation == 0 and movement == 0): raise Exception('Something went wrong!') if (rotation=='Reset' and movement == 'Reset'): self.second = True return rotation, movement # update robot location and heading information idx = self.dir_idx_map[self.heading] if (rotation == -90): new_idx = (idx-1)%4 self.heading = self.idx_dir_map[new_idx] if (rotation == 0): new_idx = (idx-0)%4 self.heading = self.idx_dir_map[new_idx] if (rotation == 90): new_idx = (idx+1)%4 self.heading = self.idx_dir_map[new_idx] if (self.heading=="left" or self.heading=="l" ): new_x = self.location[0]-movement new_y = self.location[1] if (self.heading=="up" or self.heading=="u"): new_x = self.location[0] new_y = self.location[1]+movement if (self.heading=="right" or self.heading=="r"): new_x = self.location[0]+movement new_y = self.location[1] if (self.heading=="down" or self.heading=="d"): new_x = self.location[0] new_y = self.location[1]-movement self.location = [new_x, new_y] return rotation, movement
def __init__(self, lat, lon): location = (lat, lon) for i in Utils.allCoords: if Navigator.distance(location, i) < Navigator.maxDistance and i != location: adjList.append()
################################################################################ ### ### Antonella Wilby and Vivian Wehner ### ### This class module provides a finite state machine that controls both the ### leader and follower behavior for the robot convoy. Robots are activated ### using 'A', and set to either leader or follower mode using '1' and '2', ### respectively. Leader mode tracks a white line on the floor using the ### iRobot's infrared cliff sensors. Follower mode tracks a previously ### thresholded color target. ### ################################################################################ #Get instances of data and robot from Navigator D = Navigator.get_data_instance() Robo = Navigator.get_robot_instance() #################### ROBOT SPECIFIC FUNCTIONS ##################### def activate(): """Activates robot, or after a deactivation, reactivates.""" if Robo.state != "active": Robo.state = "active" print "Robot is now active" else: Robo.state = "not active" print "Robot is no longer active" Robo.speed = (0, 0)
import Utils import graphBasic import Navigator Utils.init() graphBasic.init() while True: startStr = input("Start Coordinates (lat,lon): ") destStr = input("Destination Coordinates: ") idx1 = startStr.find(",") idx2 = destStr.find(",") lat1 = float(startStr[:idx1 - 1]) lon1 = float(startStr[idx1 + 1:]) lat2 = float(destStr[:idx2 - 1]) lon2 = float(destStr[idx2 + 1:]) Navigator.generatePath([lat1, lon1], [lat2, lon2])
def run(self): #do initialization while (True): if (self.state == botstates.IDLE): self.currentOrder = self.serverQueue.get(block=True) if (self.currentOrder.location != self.navigator.getDestination()): self.destination = self.currentOrder.location self.prevState = self.state self.state = botstates.MOTION elif (self.currentOrder.location == self.navigator.getDestination()): self.prevState = self.state self.state = botstates.DISPENSING elif (self.state == botstates.MOTION): self.navigator = Navigator.Navigator( directions.getDir(self.navigator.direction), self.navigator.location) self.navigator.start() try: self.navigator.join() except Exception as e: self.prevState = self.state self.state = botstates.LINE_LOST self.prevState = self.state self.state = botstates.DISPENSING elif (self.state == botstates.DISPENSING): if (self.currentOrder['drink'] == '1'): resp = self.dispensor.orangejuice() if (resp): self.leds.done() self.prevState = self.state self.state = botstates.IDLE else: self.prevState = self.state self.state = botstates.ERROR elif (self.currentOrder['drink'] == '2'): self.leds.done() resp = self.dispensor.gingerAle() if (resp): self.prevState = self.state self.state = botstates.IDLE else: self.prevState = self.state self.state = botstates.ERROR elif (self.currentOrder['drink'] == '3'): self.leds.done() resp = self.dispensor.mimosa() if (resp): self.prevState = self.state self.state = botstates.IDLE else: self.prevState = self.state self.state = botstates.ERROR elif (self.state == botstates.LINE_LOST): #perform recovery #utils.espeak('"line has been lost"') self.leds.blinkAll() elif (self.state == botstates.ERROR): #utils.espeak('"error dispensing drink"') self.leds.blinkAll()
the(rover.orientation).should.be('W') rover.orders = 'brb' rover.run_orders() print(rover.position) the(is_same_dictionary(rover.position, {'x': 0, 'y': 0})).should.be(True) the(rover.orientation).should.be('N') rover.orders = 'flflflfl' rover.run_orders() print(rover.position) the(is_same_dictionary(rover.position, {'x': 0, 'y': 0})).should.be(True) the(rover.orientation).should.be('N') with when.supplied_with_a_navigator: navigator = Navigator() MAP_SIZE = 3 navigator.map_size = MAP_SIZE rover = Rover(starting_point, initial_direction, navigator) with then.the_rover_should_wrap_from_the_upper_edge: rover.orders = 'ffff' rover.run_orders() print(rover.position) the(is_same_dictionary(rover.position, {'x': 0, 'y': -MAP_SIZE})).should.be(True) with and_.the_rover_should_wrap_from_the_lower_edge: rover.orders = 'b' rover.run_orders() print(rover.position) the(is_same_dictionary(rover.position, {'x': 0, 'y': MAP_SIZE})).should.be(True)
def main(argv): # register handlers so we properly disconnect and reconnect signal.signal(signal.SIGINT, shutdown_handler) signal.signal(signal.SIGTERM, shutdown_handler) # parse the passed in command line options optionp = OptionParser() optionp.add_option("-c", "--config-file", type="string", dest="configfile", default=config.cfgFile, help="Path of the configuration file.") optionp.add_option("-d", "--dry-run", action="store_true", dest="dryrun", default=False, help="Perform a dry run of the script: make folders, but don't move/convert files, and don't create any fedora objects.") (options, args) = optionp.parse_args() # args is everything left over after parsing config.dryrun = options.dryrun if config.dryrun: print("Launch Ingester in SKELETON mode...") else: print("Launch Ingester...") print("argv=%s" % str(argv)) if len(args) > 0: print("Unused arguments given: %s" % str(args)) if not os.path.exists(options.configfile): print("Config file %s not found!" % (options.configfile)) optionp.print_help() return 1 # put the name of the config file in the master dictionary - in case its different config.cfgFile = options.configfile """ ====== BASE CONFIGURATION FILE ====== """ # load configuration print("Loading configuration file %s" % options.configfile) if not config.parse(options.configfile): print("*** Error loading configuration file ***") return 2 if not os.path.isdir(config.inDir): print("Please verify the source directory: %s" % config.inDir) return 3 for addr in config.mailTo.split(" "): config.message.addAddress(addr) config.message.setSubject("%s report" % argv[0]) atexit.register(sendReport) if config.dryrun: config.message.addLine("Running in SKELETON mode") """ ====== ENVIRONMENT VARIABLES ====== """ convertPath = "/usr/local/bin" if not os.environ["PATH"].startswith(convertPath): os.environ["PATH"] = convertPath + ":" + os.environ["PATH"]#need to prepend this one for precedence over pre-existing convert command # display to the user what settings are being used for this run config.printSettings() """ ====== FEDORA SETUP ====== """ # connect to fedora fedora = connectToFedora(config.fedoraUrl, config.fedoraUser, config.fedoraPW) if not fedora: print("Error connecting to fedora instance at %s" % config.fedoraUrl) config.message.addLine("Error connecting to fedora instance at %s" % config.fedoraUrl) return 5 print("Begin timer") start = time.time() # we want the header information to display now instead of mixed up later with the curl status updates, so flush here sys.stdout.flush() sys.stderr.flush() numBooks = Navigator.processFolder(fedora, config) config.message.addLine("Script run complete: %d books ingested" % numBooks) end = time.time() print("Total execution time: %f sec" % (end - start)) config.message.addLine("Total execution time: %f sec" % (end - start)) return 0
def on_click(self): Navigator.main()
class Regression(unittest.TestCase): def setUp(self): self.browser = webdriver.Chrome(ChromeDriverManager().install()) self.navigator = Navigator(self.browser) self.browser.get( "https://kkstream.testrail.net/index.php?/runs/overview/30") self.navigator.loginPage().userName().input() self.navigator.loginPage().passWord().input() self.navigator.loginPage().submitButton().tap() def test_RegressionDay1(self): self.navigator.testRunAndTestResult().addTestPlan().tap() self.navigator.addTestPlanPage().planNameAndroid().input( "[Sprint ][Android] Regression Day 1") self.navigator.addTestPlanPage().dscription( "Release", "https://utapass-jenkins.kkinternal.com/view/Android/job/UtaPassAndroidRelease/" ) self.navigator.addTestPlanPage().addTestSuiteButton().tap() self.navigator.addTestPlanPage().selectAddTestSuite().select( "Utapass APP") self.navigator.addTestPlanPage().selectAddTestSuiteOkButton().tap() self.navigator.addTestPlanPage().testPlanSelectCasesButton().tap() self.navigator.selectCasePage().licenseLabelButton().tap() self.navigator.selectCasePage().selectPremium500Plan().select( "Premium-500") self.navigator.selectCasePage().platformsButton().tap() self.navigator.selectCasePage().selectAndroidPlatforms().tap() self.navigator.selectCasePage().priorityButton().tap() self.navigator.selectCasePage().selectCriticalPriority().tap() self.navigator.selectCasePage().testPurposeButton().tap() self.navigator.selectCasePage().selectFastTag().tap() self.navigator.selectCasePage().setSelectionButton().tap() self.navigator.selectCasePage().selectCasesSubmit().tap() self.navigator.addTestPlanPage().addTestSuiteButton().tap() self.navigator.addTestPlanPage().selectAddTestSuiteOkButton().tap() self.navigator.addTestPlanPage().testPlanSelectCasesButton2().tap() self.navigator.selectCasePage().selectSpPPlan().deselectAll() self.navigator.selectCasePage().selectSpPPlan().select( "SmartPass-Premium(SpP)") self.navigator.selectCasePage().setSelectionButton().tap() self.navigator.selectCasePage().selectCasesSubmit().tap() self.navigator.addTestPlanPage().addTestSuiteButton().tap() self.navigator.addTestPlanPage().selectAddTestSuiteOkButton().tap() self.navigator.addTestPlanPage().testPlanSelectCasesButton3().tap() self.navigator.selectCasePage().selectSpPPlan().deselectAll() self.navigator.selectCasePage().selectHighTierPlan().select( "HighTier-980") self.navigator.selectCasePage().setSelectionButton().tap() self.navigator.selectCasePage().selectCasesSubmit().tap() self.navigator.addTestPlanPage().renamePlanTitle("1").tap() self.navigator.addTestPlanPage().editPlanName("Galaxy S6 edge (7.0)", "500 Plan", "F-C", "Release", "Stg", "Release") self.navigator.addTestPlanPage().editConfirm().tap() self.navigator.addTestPlanPage().renamePlanTitle("2").tap() self.navigator.addTestPlanPage().editPlanName("Galaxy S7 Edge (8.0)", "SpP Plan", "F-C", "Release", "Stg", "Release") self.navigator.addTestPlanPage().editConfirm().tap() self.navigator.addTestPlanPage().renamePlanTitle("3").tap() self.navigator.addTestPlanPage().editPlanName("Galaxy S8 (9.0)", "HighTier Plan", "F-C", "Release", "Stg", "Release") self.navigator.addTestPlanPage().editConfirm().tap() self.navigator.addTestPlanPage().acceptTestCasePaln().tap() def test_RegressionDa2(self): self.navigator.testRunAndTestResult().addTestPlan().tap() self.navigator.addTestPlanPage().planNameAndroid().input( "[Sprint ][Android] Regression Day 2") self.navigator.addTestPlanPage().dscription( "Release", "https://utapass-jenkins.kkinternal.com/view/Android/job/UtaPassAndroidRelease/" ) self.navigator.addTestPlanPage().addTestSuiteButton().tap() self.navigator.addTestPlanPage().selectAddTestSuite().select( "Utapass APP") self.navigator.addTestPlanPage().selectAddTestSuiteOkButton().tap() self.navigator.addTestPlanPage().testPlanSelectCasesButton().tap() self.navigator.selectCasePage().licenseLabelButton().tap() self.navigator.selectCasePage().selectPremium500Plan().select( "Premium-500") self.navigator.selectCasePage().platformsButton().tap() self.navigator.selectCasePage().selectAndroidPlatforms().tap() self.navigator.selectCasePage().priorityButton().tap() self.navigator.selectCasePage().selectCriticalPriority().tap() self.navigator.selectCasePage().testPurposeButton().tap() self.navigator.selectCasePage().selectRATTag().tap() self.navigator.selectCasePage().setSelectionButton().tap() self.navigator.selectCasePage().selectCasesSubmit().tap() self.navigator.addTestPlanPage().addTestSuiteButton().tap() self.navigator.addTestPlanPage().selectAddTestSuiteOkButton().tap() self.navigator.addTestPlanPage().testPlanSelectCasesButton2().tap() self.navigator.selectCasePage().selectSpPPlan().deselectAll() self.navigator.selectCasePage().selectSpPPlan().select( "SmartPass-Premium(SpP)") self.navigator.selectCasePage().setSelectionButton().tap() self.navigator.selectCasePage().selectCasesSubmit().tap() self.navigator.addTestPlanPage().addTestSuiteButton().tap() self.navigator.addTestPlanPage().selectAddTestSuiteOkButton().tap() self.navigator.addTestPlanPage().testPlanSelectCasesButton3().tap() self.navigator.selectCasePage().selectSpPPlan().deselectAll() self.navigator.selectCasePage().selectHighTierPlan().select( "HighTier-980") self.navigator.selectCasePage().setSelectionButton().tap() self.navigator.selectCasePage().selectCasesSubmit().tap() self.navigator.addTestPlanPage().renamePlanTitle("1").tap() self.navigator.addTestPlanPage().editPlanName("Galaxy S6 edge (7.0)", "500 Plan", "R-C", "Release", "Stg", "Release") self.navigator.addTestPlanPage().editConfirm().tap() self.navigator.addTestPlanPage().renamePlanTitle("2").tap() self.navigator.addTestPlanPage().editPlanName("Galaxy S7 Edge (8.0)", "SpP Plan", "R-C", "Release", "Stg", "Release") self.navigator.addTestPlanPage().editConfirm().tap() self.navigator.addTestPlanPage().renamePlanTitle("3").tap() self.navigator.addTestPlanPage().editPlanName("Galaxy S8 (9.0)", "HighTier Plan", "R-C", "Release", "Stg", "Release") self.navigator.addTestPlanPage().editConfirm().tap() self.navigator.addTestPlanPage().acceptTestCasePaln().tap() def test_FinalCheck(self): self.navigator.testRunAndTestResult().addTestPlan().tap() self.navigator.addTestPlanPage().planNameAndroid().input( "[Sprint ][Android] FinalCheck") self.navigator.addTestPlanPage().prodDescription( "Master", "https://utapass-jenkins.kkinternal.com/view/Android/job/UtaPassAndroidMaster/" ) self.navigator.addTestPlanPage().addTestSuiteButton().tap() self.navigator.addTestPlanPage().selectAddTestSuite().select( "Utapass APP") self.navigator.addTestPlanPage().selectAddTestSuiteOkButton().tap() self.navigator.addTestPlanPage().testPlanSelectCasesButton().tap() self.navigator.selectCasePage().licenseLabelButton().tap() self.navigator.selectCasePage().selectPremium500Plan().select( "Premium-500") self.navigator.selectCasePage().platformsButton().tap() self.navigator.selectCasePage().selectAndroidPlatforms().tap() self.navigator.selectCasePage().typeButton().tap() self.navigator.selectCasePage().selectAcceptance().tap() self.navigator.selectCasePage().setSelectionButton().tap() self.navigator.selectCasePage().selectCasesSubmit().tap() self.navigator.addTestPlanPage().addTestSuiteButton().tap() self.navigator.addTestPlanPage().selectAddTestSuite().select( "Utapass APP") self.navigator.addTestPlanPage().selectAddTestSuiteOkButton().tap() self.navigator.addTestPlanPage().testPlanSelectCasesButton2().tap() self.navigator.selectCasePage().selectSpPPlan().deselectAll() self.navigator.selectCasePage().selectPremium500Plan().select( "SmartPass-Premium(SpP)") self.navigator.selectCasePage().setSelectionButton().tap() self.navigator.selectCasePage().selectCasesSubmit().tap() self.navigator.addTestPlanPage().addTestSuiteButton().tap() self.navigator.addTestPlanPage().selectAddTestSuite().select( "Utapass APP") self.navigator.addTestPlanPage().selectAddTestSuiteOkButton().tap() self.navigator.addTestPlanPage().testPlanSelectCasesButton3().tap() self.navigator.selectCasePage().selectSpPPlan().deselectAll() self.navigator.selectCasePage().selectPremium500Plan().select( "HighTier-980") self.navigator.selectCasePage().setSelectionButton().tap() self.navigator.selectCasePage().selectCasesSubmit().tap() self.navigator.addTestPlanPage().renamePlanTitle("1").tap() self.navigator.addTestPlanPage().editPlanName("Galaxy S6 edge (7.0)", "500 Plan", "AT", "Master", "Prod", "Master") self.navigator.addTestPlanPage().editConfirm().tap() self.navigator.addTestPlanPage().renamePlanTitle("2").tap() self.navigator.addTestPlanPage().editPlanName("Galaxy S7 Edge (8.0)", "SpP Plan", "AT", "Master", "Prod", "Master") self.navigator.addTestPlanPage().editConfirm().tap() self.navigator.addTestPlanPage().renamePlanTitle("3").tap() self.navigator.addTestPlanPage().editPlanName("Galaxy S8 (9.0)", "HighTier Plan", "AT", "Master", "Prod", "Master") self.navigator.addTestPlanPage().editConfirm().tap() self.navigator.addTestPlanPage().acceptTestCasePaln().tap() def test_RegressionDay1_iOS(self): self.navigator.testRunAndTestResult().addTestPlan().tap() self.navigator.addTestPlanPage().planNameAndroid().input( "[Sprint ][iOS] Regression Day 1") self.navigator.addTestPlanPage().dscription( "Release", "https://utapass-jenkins.kkinternal.com/view/iOS/job/UtaPassiOSRelease/" ) self.navigator.addTestPlanPage().addTestSuiteButton().tap() self.navigator.addTestPlanPage().selectAddTestSuite().select( "Utapass APP") self.navigator.addTestPlanPage().selectAddTestSuiteOkButton().tap() self.navigator.addTestPlanPage().testPlanSelectCasesButton().tap() self.navigator.selectCasePage().licenseLabelButton().tap() self.navigator.selectCasePage().selectPremium500Plan().select( "Premium-500") self.navigator.selectCasePage().platformsButton().tap() self.navigator.selectCasePage().selectiOSPlatforms().tap() self.navigator.selectCasePage().priorityButton().tap() self.navigator.selectCasePage().selectCriticalPriority().tap() self.navigator.selectCasePage().testPurposeButton().tap() self.navigator.selectCasePage().selectFastTag().tap() self.navigator.selectCasePage().setSelectionButton().tap() self.navigator.selectCasePage().selectCasesSubmit().tap() self.navigator.addTestPlanPage().addTestSuiteButton().tap() self.navigator.addTestPlanPage().selectAddTestSuiteOkButton().tap() self.navigator.addTestPlanPage().testPlanSelectCasesButton2().tap() self.navigator.selectCasePage().selectSpPPlan().deselectAll() self.navigator.selectCasePage().selectSpPPlan().select( "SmartPass-Premium(SpP)") self.navigator.selectCasePage().setSelectionButton().tap() self.navigator.selectCasePage().selectCasesSubmit().tap() self.navigator.addTestPlanPage().addTestSuiteButton().tap() self.navigator.addTestPlanPage().selectAddTestSuiteOkButton().tap() self.navigator.addTestPlanPage().testPlanSelectCasesButton3().tap() self.navigator.selectCasePage().selectSpPPlan().deselectAll() self.navigator.selectCasePage().selectHighTierPlan().select( "HighTier-980") self.navigator.selectCasePage().setSelectionButton().tap() self.navigator.selectCasePage().selectCasesSubmit().tap() self.navigator.addTestPlanPage().renamePlanTitle("1").tap() self.navigator.addTestPlanPage().editPlanName("iPhone 12.x 系列", "500 Plan", "F-C", "Release", "Stg", "Release") self.navigator.addTestPlanPage().editConfirm().tap() self.navigator.addTestPlanPage().renamePlanTitle("2").tap() self.navigator.addTestPlanPage().editPlanName("iPhone 13.x 系列", "SpP Plan", "F-C", "Release", "Stg", "Release") self.navigator.addTestPlanPage().editConfirm().tap() self.navigator.addTestPlanPage().renamePlanTitle("3").tap() self.navigator.addTestPlanPage().editPlanName("iPhone 11.x 系列", "HighTier Plan", "F-C", "Release", "Stg", "Release") self.navigator.addTestPlanPage().editConfirm().tap() self.navigator.addTestPlanPage().acceptTestCasePaln().tap() def test_RegressionDay2_iOS(self): self.navigator.testRunAndTestResult().addTestPlan().tap() self.navigator.addTestPlanPage().planNameAndroid().input( "[Sprint ][iOS] Regression Day 2") self.navigator.addTestPlanPage().dscription( "Release", "https://utapass-jenkins.kkinternal.com/view/iOS/job/UtaPassiOSRelease/" ) self.navigator.addTestPlanPage().addTestSuiteButton().tap() self.navigator.addTestPlanPage().selectAddTestSuite().select( "Utapass APP") self.navigator.addTestPlanPage().selectAddTestSuiteOkButton().tap() self.navigator.addTestPlanPage().testPlanSelectCasesButton().tap() self.navigator.selectCasePage().licenseLabelButton().tap() self.navigator.selectCasePage().selectPremium500Plan().select( "Premium-500") self.navigator.selectCasePage().platformsButton().tap() self.navigator.selectCasePage().selectiOSPlatforms().tap() self.navigator.selectCasePage().priorityButton().tap() self.navigator.selectCasePage().selectCriticalPriority().tap() self.navigator.selectCasePage().testPurposeButton().tap() self.navigator.selectCasePage().selectRATTag().tap() self.navigator.selectCasePage().setSelectionButton().tap() self.navigator.selectCasePage().selectCasesSubmit().tap() self.navigator.addTestPlanPage().addTestSuiteButton().tap() self.navigator.addTestPlanPage().selectAddTestSuiteOkButton().tap() self.navigator.addTestPlanPage().testPlanSelectCasesButton2().tap() self.navigator.selectCasePage().selectSpPPlan().deselectAll() self.navigator.selectCasePage().selectSpPPlan().select( "SmartPass-Premium(SpP)") self.navigator.selectCasePage().setSelectionButton().tap() self.navigator.selectCasePage().selectCasesSubmit().tap() self.navigator.addTestPlanPage().addTestSuiteButton().tap() self.navigator.addTestPlanPage().selectAddTestSuiteOkButton().tap() self.navigator.addTestPlanPage().testPlanSelectCasesButton3().tap() self.navigator.selectCasePage().selectSpPPlan().deselectAll() self.navigator.selectCasePage().selectHighTierPlan().select( "HighTier-980") self.navigator.selectCasePage().setSelectionButton().tap() self.navigator.selectCasePage().selectCasesSubmit().tap() self.navigator.addTestPlanPage().renamePlanTitle("1").tap() self.navigator.addTestPlanPage().editPlanName("iPhone 12.x 系列", "500 Plan", "R-C", "Release", "Stg", "Release") self.navigator.addTestPlanPage().editConfirm().tap() self.navigator.addTestPlanPage().renamePlanTitle("2").tap() self.navigator.addTestPlanPage().editPlanName("iPhone 13.x 系列", "SpP Plan", "R-C", "Release", "Stg", "Release") self.navigator.addTestPlanPage().editConfirm().tap() self.navigator.addTestPlanPage().renamePlanTitle("3").tap() self.navigator.addTestPlanPage().editPlanName("iPhone 11.x 系列", "HighTier Plan", "R-C", "Release", "Stg", "Release") self.navigator.addTestPlanPage().editConfirm().tap() self.navigator.addTestPlanPage().acceptTestCasePaln().tap() def test_FinalCheck_iOS(self): self.navigator.testRunAndTestResult().addTestPlan().tap() self.navigator.addTestPlanPage().planNameAndroid().input( "[Sprint ][iOS] FinalCheck") self.navigator.addTestPlanPage().prodDescription( "Master", "https://utapass-jenkins.kkinternal.com/view/iOS/job/UtaPassiOSMaster/" ) self.navigator.addTestPlanPage().addTestSuiteButton().tap() self.navigator.addTestPlanPage().selectAddTestSuite().select( "Utapass APP") self.navigator.addTestPlanPage().selectAddTestSuiteOkButton().tap() self.navigator.addTestPlanPage().testPlanSelectCasesButton().tap() self.navigator.selectCasePage().licenseLabelButton().tap() self.navigator.selectCasePage().selectPremium500Plan().select( "Premium-500") self.navigator.selectCasePage().platformsButton().tap() self.navigator.selectCasePage().selectiOSPlatforms().tap() self.navigator.selectCasePage().typeButton().tap() self.navigator.selectCasePage().selectAcceptance().tap() self.navigator.selectCasePage().setSelectionButton().tap() self.navigator.selectCasePage().selectCasesSubmit().tap() self.navigator.addTestPlanPage().addTestSuiteButton().tap() self.navigator.addTestPlanPage().selectAddTestSuite().select( "Utapass APP") self.navigator.addTestPlanPage().selectAddTestSuiteOkButton().tap() self.navigator.addTestPlanPage().testPlanSelectCasesButton2().tap() self.navigator.selectCasePage().selectSpPPlan().deselectAll() self.navigator.selectCasePage().selectPremium500Plan().select( "SmartPass-Premium(SpP)") self.navigator.selectCasePage().setSelectionButton().tap() self.navigator.selectCasePage().selectCasesSubmit().tap() self.navigator.addTestPlanPage().addTestSuiteButton().tap() self.navigator.addTestPlanPage().selectAddTestSuite().select( "Utapass APP") self.navigator.addTestPlanPage().selectAddTestSuiteOkButton().tap() self.navigator.addTestPlanPage().testPlanSelectCasesButton3().tap() self.navigator.selectCasePage().selectSpPPlan().deselectAll() self.navigator.selectCasePage().selectPremium500Plan().select( "HighTier-980") self.navigator.selectCasePage().setSelectionButton().tap() self.navigator.selectCasePage().selectCasesSubmit().tap() self.navigator.addTestPlanPage().renamePlanTitle("1").tap() self.navigator.addTestPlanPage().editPlanName("iPhone 12.x 系列", "500 Plan", "AT", "Master", "Prod", "Master") self.navigator.addTestPlanPage().editConfirm().tap() self.navigator.addTestPlanPage().renamePlanTitle("2").tap() self.navigator.addTestPlanPage().editPlanName("iPhone 13.x 系列", "SpP Plan", "AT", "Master", "Prod", "Master") self.navigator.addTestPlanPage().editConfirm().tap() self.navigator.addTestPlanPage().renamePlanTitle("3").tap() self.navigator.addTestPlanPage().editPlanName("iPhone 11.x 系列", "HighTier Plan", "AT", "Master", "Prod", "Master") self.navigator.addTestPlanPage().editConfirm().tap() self.navigator.addTestPlanPage().acceptTestCasePaln().tap() def tearDown(self): self.browser.quit()
def main(argv): # register handlers so we properly disconnect and reconnect signal.signal(signal.SIGINT, shutdown_handler) signal.signal(signal.SIGTERM, shutdown_handler) # parse the passed in command line options optionp = OptionParser() optionp.add_option("-c", "--config-file", type="string", dest="configfile", default=config.cfgFile, help="Path of the configuration file.") optionp.add_option("-d", "--dry-run", action="store_true", dest="dryrun", default=False, help="Perform a dry run of the script: make folders, but don't move/convert files, and don't create any fedora objects.") (options, args) = optionp.parse_args() config.dryrun = options.dryrun if config.dryrun: print("Launch Ingester in SKELETON mode...") else: print("Launch Ingester...") print("argv=%s" % str(argv)) if not os.path.exists(options.configfile): print("Config file %s not found!" % (options.configfile)) optionp.print_help() return 1 # put the name of the config file in the master dictionary - in case its different config.cfgFile = options.configfile """ ====== BASE CONFIGURATION FILE ====== """ # load configuration print("Loading configuration file %s" % options.configfile) if not config.parse(options.configfile): print("*** Error loading configuration file ***") return 2 if not os.path.isdir(config.inDir): print("Please verify the source directory: %s" % config.inDir) return 3 for addr in config.mailTo.split(" "): config.message.addAddress(addr) config.message.setSubject("%s report" % argv[0]) if config.dryrun: config.message.addLine("Running in SKELETON mode") atexit.register(sendReport) """ ====== ENVIRONMENT VARIABLES ====== """ os.environ["PATH"] = os.environ["PATH"] + ":/opt/jhove" convertPath = "/usr/local/bin" if not os.environ["PATH"].startswith(convertPath): os.environ["PATH"] = convertPath + ":" + os.environ["PATH"]#need to prepend this one for precedence over pre-existing convert command # display to the user what settings are being used for this run config.printSettings() """ ====== FEDORA SETUP ====== """ # connect to fedora fedora = connectToFedora(config.fedoraUrl, config.fedoraUser, config.fedoraPW) if not fedora: print("Error connecting to fedora instance at %s" % config.fedoraUrl) message.addLine("Error connecting to fedora instance at %s" % config.fedoraUrl) return 5 print("Begin timer") start = time.time() # we want the header information to display now instead of mixed up later with the curl status updates, so flush here sys.stdout.flush() sys.stderr.flush() Navigator.processFolder(fedora, config) #config.message.addLine("Script run complete: %d books ingested" % numBooks) end = time.time() print("Total execution time: %f sec" % (end - start)) config.message.addLine("Total execution time: %f sec" % (end - start)) return 0
################################################################################ ### ### Antonella Wilby and Vivian Wehner ### ### This class module provides a finite state machine that controls both the ### leader and follower behavior for the robot convoy. Robots are activated ### using 'A', and set to either leader or follower mode using '1' and '2', ### respectively. Leader mode tracks a white line on the floor using the ### iRobot's infrared cliff sensors. Follower mode tracks a previously ### thresholded color target. ### ################################################################################ #Get instances of data and robot from Navigator D = Navigator.get_data_instance() Robo = Navigator.get_robot_instance() #################### ROBOT SPECIFIC FUNCTIONS ##################### def activate(): """Activates robot, or after a deactivation, reactivates.""" if Robo.state != "active": Robo.state = "active" print "Robot is now active" else: Robo.state = "not active" print "Robot is no longer active" Robo.speed = (0,0)
import Navigator import time import json from threading import Thread import random nav = Navigator.Navigator() nav.startSafe() def getFakeSensorData(): sensorData = {} sensorData['angle'] = random.randint(0, 360) sensorData['distance'] = random.randint(0, 100) return sensorData def readSensors(param): while True: sensorData = nav.readSensorsData() #sensorData = getFakeSensorData() print json.dumps(sensorData, indent=4, sort_keys=False) time.sleep(1) thread = Thread(target=readSensors, args=('someParam', )) thread.start() thread.join() print 'thread exiting'
print(" ultrasoon 1:", globalVal.ultraSoon1) print(" ultrasoon 2:", globalVal.ultraSoon2) print() print("==motors==") print(" motor A:", globalVal.TargetSpeedA) print(" motor B:", globalVal.TargetSpeedB) print() print("Main: starting...") SensorService.SensorMain() IGNS.IGNS() Navigator.NavigatorMain() Manager.ManagerMain() Mqtt.MqttMain() time.sleep(2) silent = True while True: while silent: time.sleep(1) s = input("command?: ") if s == "status": statusReportPrint() else: