Ejemplo n.º 1
0
def start_nodes():

    if not DEVELOP: 
        # Stop camera triggers
        camera_trigger.stop()

        # Start camera nodes and wait until they are ready
        camera_master.set_camera_launch_param(
                frame_rate='camera_driver',
                trigger=True
                )
        camera_master.start_cameras()
        while not mct_introspection.camera_nodes_ready(mode='calibration'):
            time.sleep(0.2)
        
        # Delay until all camera nodes are ready and start triggers
        time.sleep(10)
        frame_rates = file_tools.read_frame_rates()
        camera_trigger.start(frame_rates['zoom_calibration'])

        # Start zoom tool nodes and wait until they are ready
        zoom_tool_master.start()
        while not mct_introspection.zoom_tool_image_ready():
            time.sleep(0.2)
        
        # Start mjpeg servers and throttleing 
        mjpeg_servers.set_topics(['image_zoom_tool'])
        mjpeg_servers.start_servers()
        
        # Turn on active target two led patter
        mct_active_target.led_pair()
Ejemplo n.º 2
0
def start_cameras_and_mjpeg_servers():
    """
    Starts the cameras and mjpeg servers
    """
    if not DEVELOP: 

        # Stop camera triggers
        camera_trigger.stop()

        # Start cameras
        camera_master.set_camera_launch_param(
                frame_rate='camera_driver',
                trigger=True
                )
        camera_master.start_cameras()
        # Wait until the camera nodes are ready and then start the mjpeg servers
        while not mct_introspection.camera_nodes_ready(mode='calibration'):
            time.sleep(0.2)

        # Delay until all camera nodes are ready and start triggers
        time.sleep(10)
        frame_rates = file_tools.read_frame_rates()
        camera_trigger.start(frame_rates['camera_calibration'])

        # Start mjpeg servers
        mjpeg_servers.set_topics(['image_raw'])
        mjpeg_servers.start_servers()
        target_info = file_tools.read_target_info(config.camera_calib_target_type)
        calibrator_master.start(target_info['size'], target_info['square'])
Ejemplo n.º 3
0
def start_nodes():
    if not DEVELOP: 

        # Stop camera triggers
        camera_trigger.stop()

        file_tools.rsync_camera_calibrations()
        
        # Start camera nodes and wait until they are ready
        camera_master.set_camera_launch_param(
                frame_rate='camera_driver',
                trigger=True
                )
        camera_master.start_cameras()
        while not mct_introspection.camera_nodes_ready(mode='calibration'):
            time.sleep(0.2)
        
        # Delay until all camera nodes are ready and start triggers
        time.sleep(10)
        frame_rates = file_tools.read_frame_rates()
        camera_trigger.start(frame_rates['transform_2d_calibration'])

        # Start image_proc nodes and wait until they are ready
        image_proc_master.start_image_proc()
        while not mct_introspection.image_proc_nodes_ready():
            time.sleep(0.2)
        
        # Wait for rectified images to be ready - required for launching transform 
        # calibrators.
        while not mct_introspection.image_rect_ready():
            time.sleep(0.2)
        
        # Start transform 2d calibrator nodes and wait until ready
        transform_2d_calibrator_master.start()
        while not mct_introspection.transform_2d_calibrator_nodes_ready():
            time.sleep(0.2)
        
        # Start mjpeg servers and throttleing 
        topic_list = [ 'image_transform_calibration_0', 'image_transform_calibration_1']
        mjpeg_servers.set_topics(topic_list)
        mjpeg_servers.start_servers()
Ejemplo n.º 4
0
def start_cameras_and_mjpeg_servers():
    """
    Starts the cameras and mjpeg servers
    """
    if not DEVELOP:
        # Stop camera triggers
        camera_trigger.stop()

        # Wait until camera inspectors are running and then start cameras
        while not mct_introspection.camera_inspectors_ready():
            time.sleep(0.2)
        camera_inspector_master.start_cameras()

        # Delay until all camera nodes are ready and start triggers
        time.sleep(10)
        frame_rates = file_tools.read_frame_rates()
        camera_trigger.start(frame_rates['assignment'])

        # Wait until the camera nodes are ready and then start the mjpeg servers
        while not mct_introspection.camera_nodes_ready(mode='inspector'):
            time.sleep(0.2)
        mjpeg_servers.set_topics(['image_raw'])
        mjpeg_servers.start_servers()
Ejemplo n.º 5
0
# Stop camera triggers
print(' * stopping camera triggers ... ',end='')
sys.stdout.flush()
camera_trigger.stop()
print('done')

# Start cameras
print(' * starting cameras ... ',end='')
sys.stdout.flush()
camera_master.set_camera_launch_param(
        frame_rate='camera_driver',
        trigger=True
        )
camera_master.start_cameras()
# Wait until the camera nodes are ready and then start the mjpeg servers
while not mct_introspection.camera_nodes_ready(mode='calibration'):
    time.sleep(0.2)
print('done')

# Delay until all camera nodes are ready and start triggers
print(' * camera nodes sync delay ... ', end='')
sys.stdout.flush()
time.sleep(10)
print('done')

print(' * starting camera triggers ... ', end='')
sys.stdout.flush()
frame_rates = file_tools.read_frame_rates()
camera_trigger.start(frame_rates['camera_calibration'])
print('done')
Ejemplo n.º 6
0
def tracking_2d_node_startup(debug=False):

    # Stop camera triggers
    debug_print(' * stopping camera triggers ... ', end='', debug=debug)
    sys.stdout.flush()
    camera_trigger.stop()
    debug_print('done', debug=debug)

    file_tools.rsync_camera_calibrations(verbose=True)

    # Start camera nodes and wait until they are ready
    debug_print(' * starting camera nodes ... ', end='', debug=debug)
    sys.stdout.flush()
    camera_master.set_camera_launch_param(frame_rate='camera_driver',
                                          trigger=True)
    camera_master.start_cameras()
    while not mct_introspection.camera_nodes_ready(mode='tracking'):
        time.sleep(ready_poll_dt)
    debug_print('done', debug=debug)

    # Delay until all camera nodes are ready
    debug_print(' * camera nodes sync delay ... ', end='', debug=debug)
    sys.stdout.flush()
    time.sleep(camera_startup_t)
    debug_print('done', debug=debug)

    # Reset rand sync
    debug_print(' * resetting rand sync ... ', end='', debug=debug)
    sys.stdout.flush()
    status = reset_rand_sync()
    if not status:
        raise RuntimeError, 'unable to reset rand_sync device'
    debug_print('done', debug=debug)

    # Restart camera triggers
    debug_print(' * starting camera triggers ... ', end='', debug=debug)
    sys.stdout.flush()
    frame_rates = file_tools.read_frame_rates()
    camera_trigger.start(frame_rates['tracking_2d'])
    debug_print('done', debug=debug)

    # Start image_proc nodes and wait until they are ready
    debug_print(' * starting image proc nodes ... ', end='', debug=debug)
    sys.stdout.flush()
    image_proc_master.start_image_proc()
    while not mct_introspection.image_proc_nodes_ready():
        time.sleep(ready_poll_dt)
    debug_print('done', debug=debug)

    # Wait for image rect topics
    debug_print(' * waiting for image_rect topics ... ', end='', debug=debug)
    sys.stdout.flush()
    while not mct_introspection.image_rect_ready():
        time.sleep(ready_poll_dt)
    debug_print('done', debug=debug)

    # Start frame drop corrector nodes and wait until they are ready
    debug_print(' * starting frame drop correctors ... ', end='', debug=debug)
    sys.stdout.flush()
    frame_drop_corrector_master.start()
    while not mct_introspection.frame_drop_correctors_ready():
        time.sleep(ready_poll_dt)
    debug_print('done', debug=debug)

    # Stop camera triggers again to sync frame drop correctors.  Note, It
    # appears we do need to stop the camera triggers twice during startup.
    # Sync'ing the frame drop correctors requires stopping the camera triggers
    # resetting the frame drop correctors and then re-starting the triggers.
    debug_print(' * stopping camera triggers ... ', end='', debug=debug)
    sys.stdout.flush()
    camera_trigger.stop()
    debug_print('done', debug=debug)

    # Reset frame drop correctors
    debug_print(' * frame drop corrector sync delay ... ', end='', debug=debug)
    time.sleep(buffer_flush_t)
    frame_drop_corrector.reset_all()
    debug_print('done', debug=debug)

    # --------------------------------------------------------------------
    # Need to reset time stamp watchdog ... or change how it functions
    #
    # Delay working on this until we know what modifcations we are making
    # to the watchdog.
    # --------------------------------------------------------------------

    # Restart camera triggers
    debug_print(' * starting camera triggers ... ', end='', debug=debug)
    sys.stdout.flush()
    frame_rates = file_tools.read_frame_rates()
    camera_trigger.start(frame_rates['tracking_2d'])
    debug_print('done', debug=debug)

    # Start frame skipper nodes and wait unti they are ready
    debug_print(' * starting frame skippers ... ', end='', debug=debug)
    sys.stdout.flush()
    frame_skipper_master.start_frame_skippers()
    while not mct_introspection.frame_skippers_ready():
        time.sleep(ready_poll_dt)
    debug_print('done', debug=debug)

    # Start image stitcher nodes and wait until stitched image topics ready
    debug_print(' * starting image stitchers ... ', end='', debug=debug)
    sys.stdout.flush()
    image_stitcher_master.start_image_stitchers()
    while not mct_introspection.stitched_images_ready():
        time.sleep(ready_poll_dt)
    debug_print('done', debug=debug)

    # Start three point tracker nodes and wait until they are ready.
    debug_print(' * starting three point trackers ... ', end='', debug=debug)
    sys.stdout.flush()
    three_point_tracker_master.start_three_point_trackers()
    while not mct_introspection.three_point_trackers_ready():
        time.sleep(ready_poll_dt)
    while not mct_introspection.three_point_tracker_synchronizers_ready():
        time.sleep(ready_poll_dt)
    debug_print('done', debug=debug)

    # Start stitched image labeler and wait until stitched images are published.
    debug_print(' * starting stitched image lablers ... ', end='', debug=debug)
    sys.stdout.flush()
    stitched_image_labeler_master.start_stitched_image_labelers()
    while not mct_introspection.stitched_image_labelers_ready():
        time.sleep(ready_poll_dt)
    debug_print('done', debug=debug)

    # Start avi writer nodes
    debug_print(' * starting avi writers ... ', end='', debug=debug)
    sys.stdout.flush()
    avi_writer_master.start_avi_writers()
    debug_print('done', debug=debug)

    # Start tracking pts loggers
    debug_print(' * starting tracking pts loggers ... ', end='', debug=debug)
    sys.stdout.flush()
    tracking_pts_logger_master.start_tracking_pts_loggers()
    debug_print('done', debug=debug)

    # Start mjpeg servers
    debug_print(' * starting mjpeg servers ... ', end='', debug=debug)
    sys.stdout.flush()

    # Set topics for mjpeg servers
    mjpeg_topics = []
    # Add time stamp watchdog image
    mjpeg_topics.append('/image_frame_drop_watchdog')

    # Add the stitched and tracking pts images for all regions
    for region in regions_dict:
        mjpeg_topics.append('/{0}/image_stitched_labeled'.format(region))
        mjpeg_topics.append('/{0}/image_tracking_pts'.format(region))
        mjpeg_topics.append('/{0}/image_tracking_info'.format(region))

    # Add any extra video images
    for v in extra_video_dict.values():
        mjpeg_topics.append(v)

    mjpeg_servers.set_topics(mjpeg_topics)
    mjpeg_servers.start_servers()
    debug_print('done', debug=debug)