INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

NONFRAMEWORK CODE
Driver Interfaces
Drivers
Libraries
Utilities

FRAMEWORK CODE
Interfaces
Components
Libraries
Utilities

Full Software Listings

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard

PEOPLE
Contributors
Users

SourceForge.net Logo
Project
Download
Mailing lists

 

         

components/localnav/mainthread.h

00001 /*
00002  * Orca-Robotics Project: Components for robotics 
00003  *               http://orca-robotics.sf.net/
00004  * Copyright (c) 2004-2006 Alex Brooks, Alexei Makarenko, Tobias Kaupp, Ben Upcroft
00005  *
00006  * This copy of Orca is licensed to you under the terms described in
00007  * the LICENSE file included in this distribution.
00008  *
00009  */
00010 #ifndef MAINTHREAD_H
00011 #define MAINTHREAD_H
00012 
00013 #include <orca/velocitycontrol2d.h>
00014 #include <orcaifaceimpl/rangescanner2d.h>
00015 #include <orcaifaceimpl/localise2d.h>
00016 #include <orcaifaceimpl/odometry2d.h>
00017 #include <orcaice/context.h>
00018 #include <orcaice/subsystemthread.h>
00019 #include <gbxsickacfr/gbxiceutilacfr/store.h>
00020 #include <orcalocalnav/speedlimiter.h>
00021 #include <orcalocalnav/pathmaintainer.h>
00022 #include <orcalocalnav/clock.h>
00023 #include <orcalocalnav/idriver.h>
00024 #include <hydronavutil/hydronavutil.h>
00025 #include <hydrodll/dynamicload.h>
00026 #include <orcalocalnav/pathfollowerinterface.h>
00027 #include <orcalocalnavtest/simulator.h>
00028 #include "algorithmevaluator.h"
00029 
00030 namespace localnav {
00031 
00032 //
00033 // @brief the main executing loop of this component.
00034 //
00035 // Note: this thing self-destructs when run() returns.
00036 //
00037 //
00038 // @author Alex Brooks
00039 //
00040 class MainThread : public orcaice::SubsystemThread
00041 {
00042 
00043 public: 
00044 
00045     MainThread( const orcaice::Context &context );
00046 
00047 private: 
00048 
00049     // from SubsystemThread
00050     virtual void initialise();
00051     virtual void work();
00052 
00053     void getVehicleDescription();
00054     void getRangeScannerDescription();
00055     void setup();
00056 
00057     void sendCommandToPlatform( const hydronavutil::Velocity &cmd );
00058 
00059     // Make sure all our sources of info are OK, and that there's something
00060     // in all our buffers
00061     void ensureProxiesNotEmpty();
00062 
00063     // See if we need to follow a new path, plus
00064     // see if we should update the world on our progress.
00065     void checkWithOutsideWorld();
00066 
00067     void getInputs( hydronavutil::Velocity &velocity,
00068                     hydronavutil::Pose     &localisePose,
00069                     orca::Time             &poseTime,
00070                     bool                   &isLocalisationUncertain,
00071                     std::vector<float>     &obsRanges,
00072                     orca::Time             &obsTime );
00073 
00074     void stopVehicle();
00075 
00076     // Constrains the max speed
00077     std::auto_ptr<orcalocalnav::SpeedLimiter> speedLimiter_;
00078 
00079     // Keeps track of the path we're following
00080     std::auto_ptr<orcalocalnav::PathMaintainer>  pathMaintainer_;
00081 
00082     // The library that contains the driver factory (must be declared first so it's destructed last!!!)
00083     std::auto_ptr<hydrodll::DynamicallyLoadedLibrary> driverLib_;
00084     // The factory which creates the driver
00085     std::auto_ptr<orcalocalnav::DriverFactory> driverFactory_;
00086     // Does the work
00087     std::auto_ptr<orcalocalnav::IDriver> driver_;
00088 
00089     // Incoming observations and pose info
00090     // Get observations, pose, and odometric velocity
00091     orcaifaceimpl::StoringRangeScanner2dConsumerImplPtr obsConsumer_;
00092     orcaifaceimpl::StoringLocalise2dConsumerImplPtr     locConsumer_;
00093     orcaifaceimpl::StoringOdometry2dConsumerImplPtr     odomConsumer_;
00094 
00095     std::auto_ptr<orcalocalnav::PathFollowerInterface> pathFollowerInterface_;
00096 
00097     // Outgoing commands: live version
00098     orca::VelocityControl2dPrx     velControl2dPrx_;
00099     // Outgoing commands: test version
00100     std::auto_ptr<orcalocalnavtest::Simulator> testSimulator_;
00101 
00102     // temporary data
00103     orca::Localise2dData           orcaLocaliseData_;
00104     orca::Odometry2dData           orcaOdomData_;
00105     orca::RangeScanner2dDataPtr    orcaRangeData_;
00106 
00107     // A global time reference
00108     std::auto_ptr<orcalocalnav::Clock> clock_;
00109 
00110     orca::VehicleDescription        vehicleDescr_;
00111     orca::RangeScanner2dDescription scannerDescr_;
00112 
00113     bool testMode_;
00114     std::auto_ptr<AlgorithmEvaluator> algorithmEvaluator_;
00115 
00116     orcaice::Context context_;
00117     bool timestampsCheckEnabled_;
00118 };
00119 
00120 }
00121 
00122 #endif
 

Webmaster: Tobias Kaupp (tobasco at users.sourceforge.net)


Generated for Orca Robotics by  doxygen 1.4.5