Beispiel #1
0
def steer(a):
    print "Steering wind angle: ", round(rad_to_deg(a), 2),
    sys.stdout.flush()
    do_steer_wind(a)
    while abs(boat.wind_angle - a) > 0.001:
        sys.stdout.write(".")
        sys.stdout.flush()
        time.sleep(1)
        fetch_boat(boat)
    print " Done."
    time.sleep(10)
Beispiel #2
0
def steer(a):
    print "Steering wind angle: ", round(rad_to_deg(a), 2),
    sys.stdout.flush()
    do_steer_wind(a)
    while abs(boat.wind_angle - a) > 0.001:
        sys.stdout.write(".")
        sys.stdout.flush()
        time.sleep(1)
        fetch_boat(boat)
    print " Done."
    time.sleep(10)
Beispiel #3
0
print "Boat latitude  : ", rad_to_deg(boat.position[0])
print "Boat longitude : ", rad_to_deg(boat.position[1])
print "Boat wind angle: ", rad_to_deg(boat.wind_angle)
print "Boat speed     : ", ms_to_kn(boat.speed)

wa = boat.wind_angle
awa = abs(wa)
mult = 1
if wa >= 0:
    mult = -1

# When it's blowing hard or we're down on efficiency, turn the boat into the wind first
if (boat.efficiency < 0.98) or (boat.condition.wind[1] > 8):
    print "Turning into the wind",
    sys.stdout.flush()
    do_steer_wind(0)
    while boat.speed > 0.01:
        sys.stdout.write(".")
        sys.stdout.flush()
        time.sleep(1)
        fetch_boat(boat)
    print " Done."
    print "Boat efficiency : ", boat.efficiency
    print "Waiting for 100% efficiency",
    sys.stdout.flush()
    while boat.efficiency < 0.999:
        sys.stdout.write(".")
        sys.stdout.flush()
        time.sleep(1)
        fetch_boat(boat)
    print " Done."
Beispiel #4
0
print "Boat latitude  : ", rad_to_deg(boat.position[0])
print "Boat longitude : ", rad_to_deg(boat.position[1])
print "Boat wind angle: ", rad_to_deg(boat.wind_angle)
print "Boat speed     : ", ms_to_kn(boat.speed)

wa = boat.wind_angle
awa = abs(wa)
mult = 1
if wa >= 0:
    mult = -1

# When it's blowing hard or we're down on efficiency, turn the boat into the wind first
if (boat.efficiency < 0.98) or (boat.condition.wind[1] > 8):
    print "Turning into the wind",
    sys.stdout.flush()
    do_steer_wind(0)
    while boat.speed > 0.01:
        sys.stdout.write(".")
        sys.stdout.flush()
        time.sleep(1)
        fetch_boat(boat)
    print " Done."
    print "Boat efficiency : ", boat.efficiency
    print "Waiting for 100% efficiency",
    sys.stdout.flush()
    while boat.efficiency < 0.999:
        sys.stdout.write(".")
        sys.stdout.flush()
        time.sleep(1)
        fetch_boat(boat)
    print " Done."
Beispiel #5
0
    while abs(boat.wind_angle - a) > 0.001:
        sys.stdout.write(".")
        sys.stdout.flush()
        time.sleep(1)
        fetch_boat(boat)
    print " Done."
    time.sleep(10)

args = sys.argv[1:]
if len(args) < 1:
    print "No new wind angle provided on commandline."
elif len(args) < 2:
    new_wind_angle = float(args[0])
    print "Steering       : ", new_wind_angle, " degrees."
    rad_wind_angle = deg_to_rad(new_wind_angle)
    do_steer_wind(rad_wind_angle)
    # Sleep 10s so sailonline can process the request
    time.sleep(10)
    fetch_boat(boat)
    print "New wind angle : ", rad_to_deg(boat.wind_angle)
else:
    new_wind_angle = deg_to_rad(float(args[0]))
    step = deg_to_rad(float(args[1]))
    diff = normalize_angle_pipi(new_wind_angle - boat.wind_angle)
    mult = 1
    if diff < 0:
        mult = -1
    while abs(diff) > step:
        steer(boat.wind_angle + step * mult)
        diff = normalize_angle_pipi(new_wind_angle - boat.wind_angle)
    steer(new_wind_angle)
Beispiel #6
0
        sys.stdout.write(".")
        sys.stdout.flush()
        time.sleep(1)
        fetch_boat(boat)
    print " Done."
    time.sleep(10)


args = sys.argv[1:]
if len(args) < 1:
    print "No new wind angle provided on commandline."
elif len(args) < 2:
    new_wind_angle = float(args[0])
    print "Steering       : ", new_wind_angle, " degrees."
    rad_wind_angle = deg_to_rad(new_wind_angle)
    do_steer_wind(rad_wind_angle)
    # Sleep 10s so sailonline can process the request
    time.sleep(10)
    fetch_boat(boat)
    print "New wind angle : ", rad_to_deg(boat.wind_angle)
else:
    new_wind_angle = deg_to_rad(float(args[0]))
    step = deg_to_rad(float(args[1]))
    diff = normalize_angle_pipi(new_wind_angle - boat.wind_angle)
    mult = 1
    if diff < 0:
        mult = -1
    while abs(diff) > step:
        steer(boat.wind_angle + step * mult)
        diff = normalize_angle_pipi(new_wind_angle - boat.wind_angle)
    steer(new_wind_angle)