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

 

         

robot2d/hwthread.h

00001 /*
00002  * Orca-Robotics Project: Components for robotics 
00003  *               http://orca-robotics.sf.net/
00004  * Copyright (c) 2004-2008 Alex Brooks, Alexei Makarenko, Tobias Kaupp
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 
00011 #ifndef ROBOT2D_HARDWARE_THREAD_H
00012 #define ROBOT2D_HARDWARE_THREAD_H
00013 
00014 #include <memory>
00015 #include <gbxsickacfr/gbxiceutilacfr/subsystemthread.h>
00016 #include <orcaice/context.h>
00017 #include <hydrointerfaces/robot2d.h>
00018 #include <hydrodll/dynamicload.h>
00019 #include <gbxsickacfr/gbxiceutilacfr/store.h>
00020 #include <orcarobotdriverutil/statemachine.h>
00021 
00022 namespace robot2d {
00023 
00024 //
00025 // @brief The thread that runs the driver
00026 //
00027 // @author Alex Brooks
00028 //
00029 class HwThread : public gbxsickacfr::gbxiceutilacfr::SubsystemThread
00030 {
00031 
00032 public: 
00033 
00034     HwThread( const orcaice::Context &context );
00035 
00036     // from SubsystemThread
00037     virtual void walk();
00038 
00039     // local interface, used by NetThread
00040 
00041     void setCommand( const hydrointerfaces::Robot2d::Command &command );
00042 
00043     // Return valus same as gbxsickacfr::gbxiceutilacfr::Store.
00044     int getData( hydrointerfaces::Robot2d::Data &data, int timeoutMs )
00045         {
00046             return dataStore_.getNext( data, timeoutMs );
00047         }
00048 
00049 private: 
00050 
00051     // Keeps trying until success or isStopping()
00052     void enableDriver();
00053 
00054     // Faults can be detected in either read or write threads: have to be careful.
00055     orcarobotdriverutil::StateMachine stateMachine_;
00056 
00057     // Stores the data most recently received from the hardware
00058     gbxsickacfr::gbxiceutilacfr::Store<hydrointerfaces::Robot2d::Data>    dataStore_;
00059     // Stores incoming commands
00060     gbxsickacfr::gbxiceutilacfr::Store<hydrointerfaces::Robot2d::Command> commandStore_;
00061 
00062     bool isMotionEnabled_;
00063 
00064     // The library that contains the driver factory (must be declared first so it's destructed last!!!)
00065     std::auto_ptr<hydrodll::DynamicallyLoadedLibrary> driverLib_;
00066     // Generic driver for the hardware
00067     std::auto_ptr<hydrointerfaces::Robot2d> driver_;
00068 
00069     orcaice::Context context_;
00070 };
00071 
00072 } // namespace
00073 
00074 #endif
 

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


Generated for Orca Robotics by  doxygen 1.4.5