orca-robotics


INTRODUCTION
Overview
Download and Install
Quick Start
Documentation
Publications

REPOSITORY
Interfaces
Components
Libraries
Utilities
Software Map

DEVELOPER
Tutorials
Examples
Dev Guide
Dashboard
Wiki
login/pass: orca/orca

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 <orca/localise2d.h>
00015 #include <orca/rangescanner2d.h>
00016 #include <orcaice/context.h>
00017 #include <gbxsickacfr/gbxiceutilacfr/subsystemthread.h>
00018 #include <gbxsickacfr/gbxiceutilacfr/store.h>
00019 #include <orcaifaceimpl/storingconsumers.h>
00020 #include "speedlimiter.h"
00021 #include "pathmaintainer.h"
00022 #include "clock.h"
00023 #include <orcalocalnav/idriver.h>
00024 #include <hydronavutil/hydronavutil.h>
00025 #include <hydrodll/dynamicload.h>
00026 #include "pathfollowerinterface.h"
00027 #include "testsim/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 gbxsickacfr::gbxiceutilacfr::SubsystemThread
00041 {
00042 
00043 public: 
00044 
00045     MainThread( const orcaice::Context &context );
00046 
00047     virtual void walk();
00048 
00049 private: 
00050 
00051     void getVehicleDescription();
00052     void getRangeScannerDescription();
00053     void setup();
00054     void initPathFollowerInterface();
00055 
00056     void sendCommandToPlatform( const hydronavutil::Velocity &cmd );
00057 
00058     // Make sure all our sources of info are OK, and that there's something
00059     // in all our buffers
00060     void ensureProxiesNotEmpty();
00061 
00062     // See if we need to follow a new path, plus
00063     // see if we should update the world on our progress.
00064     void checkWithOutsideWorld();
00065 
00066     void getInputs( hydronavutil::Velocity &velocity,
00067                        hydronavutil::Pose     &localisePose,
00068                        orca::Time             &poseTime,
00069                        bool                   &isLocalisationUncertain,
00070                        std::vector<float>     &obsRanges,
00071                        orca::Time             &obsTime );
00072 
00073     void stopVehicle();
00074 
00075     // Constrains the max speed
00076     std::auto_ptr<SpeedLimiter> speedLimiter_;
00077 
00078     // Keeps track of the path we're following
00079     std::auto_ptr<PathMaintainer>  pathMaintainer_;
00080 
00081     // The library that contains the driver factory (must be declared first so it's destructed last!!!)
00082     std::auto_ptr<hydrodll::DynamicallyLoadedLibrary> driverLib_;
00083     // The factory which creates the driver
00084     std::auto_ptr<orcalocalnav::DriverFactory> driverFactory_;
00085     // Does the work
00086     std::auto_ptr<orcalocalnav::IDriver> driver_;
00087 
00088     // Incoming observations and pose info
00089     // Get observations, pose, and odometric velocity
00090     orcaifaceimpl::StoringRangeScanner2dConsumerImplPtr obsConsumer_;
00091     orcaifaceimpl::StoringLocalise2dConsumerImplPtr     locConsumer_;
00092     orcaifaceimpl::StoringOdometry2dConsumerImplPtr     odomConsumer_;
00093 
00094     std::auto_ptr<PathFollowerInterface> pathFollowerInterface_;
00095 
00096     // Outgoing commands: live version
00097     orca::VelocityControl2dPrx     velControl2dPrx_;
00098     // Outgoing commands: test version
00099     Simulator                     *testSimulator_;
00100 
00101     // temporary data
00102     orca::Localise2dData           orcaLocaliseData_;
00103     orca::Odometry2dData           orcaOdomData_;
00104     orca::RangeScanner2dDataPtr    orcaRangeData_;
00105 
00106     // A global time reference
00107     std::auto_ptr<Clock> clock_;
00108 
00109     orca::VehicleDescription        vehicleDescr_;
00110     orca::RangeScanner2dDescription scannerDescr_;
00111 
00112     bool testMode_;
00113     std::auto_ptr<AlgorithmEvaluator> algorithmEvaluator_;
00114 
00115     orcaice::Context context_;
00116 };
00117 
00118 }
00119 
00120 #endif
 

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


Generated for Orca Robotics by  doxygen 1.4.5