コード例 #1
0
def mainfunction():
    global navigator
    global isObstacle
    global motorLeft
    global motorRight
    global inmission
    navigator = LocationAudio.Navigator(connection_string="/dev/ttyACM1", baudrate=115200)
    while True:
        ui = gui.UI()
        # User Interface
        # Get User click on map to generate destination
        # Waypoint generate & upload to Ardurover
        ui.mainloop()
        targetbuilding = ui.location.get()
        targetbuildingindex = ui.locationindex.get()

        # ROS
        # Get obstacles
        # If too close --> Manual mode w/ pwm instructions
        # If far enough --> Auto
        # Ardurover GPS
        navigator.setLocationindex(targetbuildingindex)
        print ("The target location is: " + navigator.gettargetlocation())

        currentmission = navigator.getcurrentmission()
        navigator.upload_mission(currentmission)

        # Need to integrate mission control with obstacle avoidance

        # while no obstacle detected --> run automated mission control
        inmission = True
        navigator.run_mission()
        inmission = False
        currentaudio = navigator.getaudio()
        navigator.PlayAudio(currentaudio)  # Plays audio file at current location

        # Need to start return mission whose file is located at current mission + 6
        navigator.setLocationindex(targetbuildingindex + 6)
        currentmission = navigator.getcurrentmission()

        # while no obstacle detected --> run automated mission control
        navigator.upload_mission(currentmission)
        inmission = True
        navigator.run_mission()
        inmission = False
コード例 #2
0
ファイル: test.py プロジェクト: benhoff/pystk
def main():
    config = pystk.GraphicsConfig.hd()
    config.screen_width = 800
    config.screen_height = 600
    pystk.init(config)

    config = pystk.RaceConfig()
    config.num_kart = 2
    # config.track ='battleisland'
    config.track = 'stadium'

    config.players[0].controller = pystk.PlayerConfig.Controller.PLAYER_CONTROL
    config.players[0].team = 0
    # NOTE: Add 4 players
    for _ in range(3):
        config.players.append(
            # pystk.PlayerConfig(args.kart, pystk.PlayerConfig.Controller.AI_CONTROL, (args.team + 1) % 2))
            pystk.PlayerConfig('', pystk.PlayerConfig.Controller.AI_CONTROL,
                               1))

    config.mode = config.RaceMode.THREE_STRIKES
    # TODO: Look at step size?
    # config.step_size = args.step_size

    race = pystk.Race(config)
    race.start()
    race.step()

    uis = [gui.UI(gui.VT['IMAGE']) for i in range(4)]

    state = pystk.WorldState()
    state.update()
    t0 = time()
    if not all(ui.pause for ui in uis):
        race.step(uis[0].current_action)
        state.update()
    for ui, d in zip(uis, race.render_data):
        ui.show(d)
    input('press enter to continue')

    race.stop()
    del race
    pystk.clean()
コード例 #3
0
    def start(self):
        startstate = []
        for massName, massObj in self.objects["masses"].items():
            startstate.append(massObj.position)
            startstate.append(massObj.velocity)
        result = solve_ivp(self.integrator,
                           self.timespan,
                           startstate,
                           max_step=0.1)
        return result


if __name__ == "__main__":
    objects = validateSetup(setup)
    if objects:
        simulation = sysSim(objects, simSpan)
        UI = gui.UI()
        UI.prepare()
        result = simulation.start()
        print(result.t, result.y)
        counter = 0
        for massName, massObj in simulation.objects["masses"].items():
            massObj.position = result.y[counter]
            massObj.velocity = result.y[counter + 1]
            counter += 2

        UI.simulate(simulation.objects, result.t)
    else:
        print("\nInvalid setup\n")
        sys.exit()
コード例 #4
0
ファイル: main.py プロジェクト: NickDale/simple_pdf_editor
import gui

if __name__ == '__main__':
    gui = gui.UI()
    gui.create_ui()
コード例 #5
0
ファイル: t1.py プロジェクト: watrt/myesp32_micropython
import _thread
import gui
main_show = 0
spi = SPI(1, baudrate=26000000, sck=Pin(33), mosi=Pin(25), miso=Pin(4))
ili = ILI9163_SPI(128, 160, spi, res=Pin(27), dc=Pin(26), cs=Pin(4))
ili.fill(0xFFFF)
ili.fill_rect(5, 5, 56, 50, ili.brg(r=255))
ili.show()

f = open("weather/0.bin")
imgbyte = f.read()
img = framebuf.FrameBuffer(bytearray(imgbyte), 60, 60, framebuf.RGB565)
ili.blit(img, 0, 0)
ili.show()
ili.fill(0xFFFF)
ui = gui.UI(ili)
for i in range(100):
    ui.ProgressBar(30, 30, 70, 10, i)
    ui.stripBar(10, 10, 10, 70, i, 0, 0)
    ili.show()
    time.sleep_ms(50)

ili.fill(0xFFFF)
ui.qr_code('http://www.163.com', 20, 20)
ili.show()

ili.fill(0xFFFF)
clock = gui.Clock(ili, 64, 60, 40)
clock.settime()
clock.drawClock()
ili.show()