01234567890123456789012345678901234567890123456789012345678901234567890123456789
682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735 |
<----SKIPPED LINES---->
def InitialMessageValues(q):
"""Initializes the arduino main processes with values from messageboard."""
v = DrainQueue(q)
if v:
return v
return {}, {}, {}, {}
def SetLoggingGlobals(configuration):
"""Sets the logging globals based on values in the config file."""
global VERBOSE
VERBOSE = 'arduino_verbose' in configuration
global LOG_SERIALS
LOG_SERIALS = 'arduino_log_serials' in configuration
def ServoTestOrdinal(link):
"""Point laser at each of 0, 90, 180, 270 and hold with different colors."""
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(link, altitude=45):
"""Sweep red laser around 360 degrees."""
for azimuth in range(0, 360, 10):
link.Write((azimuth, altitude, *LASER_RED))
time.sleep(WRITE_DELAY_TIME)
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
<----SKIPPED LINES---->
|
01234567890123456789012345678901234567890123456789012345678901234567890123456789
682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735 |
<----SKIPPED LINES---->
def InitialMessageValues(q):
"""Initializes the arduino main processes with values from messageboard."""
v = DrainQueue(q)
if v:
return v
return {}, {}, {}, {}
def SetLoggingGlobals(configuration):
"""Sets the logging globals based on values in the config file."""
global VERBOSE
VERBOSE = 'arduino_verbose' in configuration
global LOG_SERIALS
LOG_SERIALS = 'arduino_log_serials' in configuration
def ServoTestOrdinal(link):
"""Point laser at each of 0, 90, 180, 270 and hold with different colors."""
link.Write((0, 0, *LASER_ALL, False))
time.sleep(1)
link.Write((90, 0, *LASER_RED, False))
time.sleep(1)
link.Write((180, 0, *LASER_GREEN, False))
time.sleep(1)
link.Write((270, 0, *LASER_BLUE, False))
time.sleep(1)
def ServoTestSweep(link, altitude=45):
"""Sweep red laser around 360 degrees."""
for azimuth in range(0, 360, 10):
link.Write((azimuth, altitude, *LASER_RED, False))
time.sleep(WRITE_DELAY_TIME)
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
<----SKIPPED LINES---->
|