arduino-2020-06-12-1419.py
01234567890123456789012345678901234567890123456789012345678901234567890123456789









614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656











                            <----SKIPPED LINES---->




    return v
  return {}, {}, {}, {}


def ServoTestOrdinal(configuration, link):
  """Point laser at each of 0, 90, 180, 270 and hold for a second with different colors."""
  messageboard.RemoveSetting(configuration, 'test_servos_ordinal')
  link.Write((0, 0, *LASER_ALL))
  time.sleep(1)
  link.Write((90, 0, *LASER_RED))
  time.sleep(1)
  link.Write((180, 0, *LASER_GREEN))
  time.sleep(1)
  link.Write((270, 0, *LASER_BLUE))
  time.sleep(1)


def ServoTestSweep(configuration, link, altitude=45):
  """Sweep red laser around 360 degrees."""
  messageboard.RemoveSetting(configuration, 'test_servos_sweep')
  for azimuth in range(360, 10):
    link.Write((azimuth, altitude, *LASER_RED))
    time.sleep(0.1)


def ServoMain(to_arduino_q, to_parent_q, shutdown):
  """Main servo controller for projecting the plane position on a hemisphere.

  Takes the latest flight from the to_arduino_q and converts that to the current
  azimuth and altitude of the plane on a hemisphere.
  """
  sys.stderr = open(messageboard.STDERR_FILE, 'a')

  Log('Process started with process id %d' % os.getpid())

  # Ensures that the child can exit if the parent exits unexpectedly
  # docs.python.org/2/library/multiprocessing.html#multiprocessing.Queue.cancel_join_thread
  to_arduino_q.cancel_join_thread()
  to_parent_q.cancel_join_thread()

  # write_format: azimuth, altitude, R, G, & B intensity
  # read heartbeat: millis
  link = Serial(




                            <----SKIPPED LINES---->





01234567890123456789012345678901234567890123456789012345678901234567890123456789









614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656











                            <----SKIPPED LINES---->




    return v
  return {}, {}, {}, {}


def ServoTestOrdinal(configuration, link):
  """Point laser at each of 0, 90, 180, 270 and hold for a second with different colors."""
  messageboard.RemoveSetting(configuration, 'test_servos_ordinal')
  link.Write((0, 0, *LASER_ALL))
  time.sleep(1)
  link.Write((90, 0, *LASER_RED))
  time.sleep(1)
  link.Write((180, 0, *LASER_GREEN))
  time.sleep(1)
  link.Write((270, 0, *LASER_BLUE))
  time.sleep(1)


def ServoTestSweep(configuration, link, altitude=45):
  """Sweep red laser around 360 degrees."""
  messageboard.RemoveSetting(configuration, 'test_servos_sweep')
  for azimuth in range(0, 360, 10):
    link.Write((azimuth, altitude, *LASER_RED))
    time.sleep(0.15)


def ServoMain(to_arduino_q, to_parent_q, shutdown):
  """Main servo controller for projecting the plane position on a hemisphere.

  Takes the latest flight from the to_arduino_q and converts that to the current
  azimuth and altitude of the plane on a hemisphere.
  """
  sys.stderr = open(messageboard.STDERR_FILE, 'a')

  Log('Process started with process id %d' % os.getpid())

  # Ensures that the child can exit if the parent exits unexpectedly
  # docs.python.org/2/library/multiprocessing.html#multiprocessing.Queue.cancel_join_thread
  to_arduino_q.cancel_join_thread()
  to_parent_q.cancel_join_thread()

  # write_format: azimuth, altitude, R, G, & B intensity
  # read heartbeat: millis
  link = Serial(




                            <----SKIPPED LINES---->