/** \file
 *
 *  Contains the NavigationModule class implementation.
 *
 *  Copyright (c) 2013 MBARI
 *  MBARI Proprietary Information.  All Rights Reserved
 */

#include "NavigationModule.h"

#include "DeadReckonUsingMultipleVelocitySources.h"
#include "DeadReckonUsingMultipleVelocitySourcesIF.h"
#include "DeadReckonUsingSpeedCalculator.h"
#include "DeadReckonUsingSpeedCalculatorIF.h"
#include "DeadReckonWithRespectToWater.h"
#include "DeadReckonWithRespectToWaterIF.h"
#include "DeadReckonWithRespectToSeafloor.h"
#include "DeadReckonWithRespectToSeafloorIF.h"
//#include "DeadReckonUsingDVLBottomLock.h"
//#include "DeadReckonUsingDVLBottomLockIF.h"
#include "DeadReckonUsingDVLWaterTrack.h"
#include "DeadReckonUsingDVLWaterTrackIF.h"
#include "LBL.h"
#include "LBLIF.h"
#include "LBLNavigation.h"
#include "LBLNavigationIF.h"
#include "NavChart.h"
#include "NavChartIF.h"
#include "UniversalFixResidualReporter.h"
#include "UniversalFixResidualReporterIF.h"
#include "WorkSite.h"
#include "WorkSiteIF.h"

NavigationModule::NavigationModule()
    : Module( "Navigation",
              "Contains the base navigation components" )
{}

void NavigationModule::loadComponents( Logger& logger )
{
    //// Dead reckoning methods ////
    if( loadAtStartup( DeadReckonUsingMultipleVelocitySourcesIF::LOAD_AT_STARTUP, logger ) )
    {
        registerComponent( new DeadReckonUsingMultipleVelocitySources( this ) );
    }
    if( loadAtStartup( DeadReckonUsingSpeedCalculatorIF::LOAD_AT_STARTUP, logger ) )
    {
        registerComponent( new DeadReckonUsingSpeedCalculator( this ) );
    }
    if( loadAtStartup( DeadReckonWithRespectToWaterIF::LOAD_AT_STARTUP, logger ) )
    {
        registerComponent( new DeadReckonWithRespectToWater( this ) );
    }
    if( loadAtStartup( DeadReckonWithRespectToSeafloorIF::LOAD_AT_STARTUP, logger ) )
    {
        registerComponent( new DeadReckonWithRespectToSeafloor( this ) );
    }
//    if( loadAtStartup( DeadReckonUsingDVLBottomLockIF::LOAD_AT_STARTUP, logger ) )
//    {
//        registerComponent( new DeadReckonUsingDVLBottomLock( this ) );
//    }
    if( loadAtStartup( DeadReckonUsingDVLWaterTrackIF::LOAD_AT_STARTUP, logger ) )
    {
        registerComponent( new DeadReckonUsingDVLWaterTrack( this ) );
    }
//    if( loadAtStartup( DeadReckonWithPropellerPitchAndShaftSpeed::LOAD_AT_STARTUP, logger ) )
//    {
//        registerComponent( new DeadReckonWithPropellerPitchAndShaftSpeed( this ) );
//    }
    // TODO: consider an alternative using higher fidelity propeller model
//    if( loadAtStartup( DeadReckonWithADCPWaterProfile::LOAD_AT_STARTUP, logger ) )
//    {
//        registerComponent( new DeadReckonWithADCPWaterProfile( this ) );
//    }

    //// Kalman Filter methods ////
    // TODO: Implement and include these.

    //// Information Filter methods ////
    // TODO: Implement and include these.

    //// Particle Filter methods ////
    // TODO: Implement and include these.

    //// LBL Compoents ////
    if( loadAtStartup( LBLNavigationIF::LOAD_AT_STARTUP, logger ) )
    {
        registerBehaviorCreator( LBLIF::NAME, &LBL::CreateBehavior );
        registerComponent( new LBLNavigation( this ) );
    }

    //// Other navigation components ////
    if( loadAtStartup( NavChartIF::LOAD_AT_STARTUP, logger ) )
    {
        registerComponent( new NavChart( this ) );
    }
    if( loadAtStartup( UniversalFixResidualReporterIF::LOAD_AT_STARTUP, logger ) )
    {
        registerComponent( new UniversalFixResidualReporter( this ) );
    }
    if( loadAtStartup( WorkSiteIF::LOAD_AT_STARTUP, logger ) )
    {
        registerComponent( new WorkSite( this ) );
    }
}

NavigationModule::~NavigationModule()
{}
