예제 #1
0
def drive(model):
    throttle = 0
    left_line_max = 75
    right_line_max = 670

    screen, roi, radar, speed = process("Grand Theft Auto V")

    controls = model.predict([np.array([roi]), np.array([radar]), np.array([speed])], batch_size=1)

    if controls > 0:
        print("-->" + "   speed=" + str(speed))
    else:
        print("<--" + "   speed=" + str(speed))

    if speed < 19:       # control speed
        throttle = 0.6
    elif speed < 45:
        throttle = 0.4
    elif speed > 50:
        throttle = 0.0

    lane = detect_lane(screen)

    if lane[0] and lane[0][0] > left_line_max:
        if abs(controls[0][0]) < 0.27:
            controls[0][0] = 0.27
    elif lane[1] and lane[1][0] < right_line_max:
        if abs(controls[0][0]) < 0.27:
            controls[0][0] = -0.27

    return controls[0][0], throttle
예제 #2
0
파일: navigator.py 프로젝트: chlebajz/LARva
 def scanForCones(self):
     image = self.pilot.robot.get_rgb_image()
     depth = self.pilot.robot.get_depth_image()
     self.cones = img.process(image, depth, self.kRGB)
     print("Found cones: ", self.cones)
예제 #3
0
import urllib.request
import requests
import threading
import csv
import demo
import img_process
import time
plt.rcParams.update({'figure.max_open_warning': 0}) #fix the memory error

Chrome_driver_location = 'get_image/2/webdriver/chromedriver78'
destination_url_student = 'https://irs.thsrc.com.tw/IMINT/?student=university'
destination_url_default = 'https://irs.thsrc.com.tw/IMINT/'
train_number = 434 #火車班次號碼

dir = '/Users/garys/Desktop/2.jpg'
img_process.process(dir) #process
passcode = demo.predict(dir) #predict
print(passcode)


driver = webdriver.Chrome(Chrome_driver_location)
driver.get(destination_url_default)  # 輸入範例網址,交給瀏覽器
cookie = driver.get_cookies() #get cookie
pageSource = driver.page_source  # 取得網頁原始碼

#driver.find_element_by_id("bookingMethod2").click()
#driver.find_element_by_name("toTrainIDInputField").send_keys(train_number)
driver.find_element_by_id('btn-confirm').click()

啟程站 = Select(driver.find_element_by_name('selectStartStation'))
啟程站.select_by_value("1")