lobot::App Class Reference

An application object that ties together various I/O and other modules and runs the main thread. More...

#include <Robots/LoBot/LoApp.H>

Collaboration diagram for lobot::App:
Collaboration graph
[legend]

List of all members.

Classes

struct  signal_pred
 Helper classes for above condition variable.
struct  wait_pred

Public Types

typedef Compositor< PixelTypeImageCompositor
typedef std::vector
< VideoStream * > 
VideoStreams
typedef std::vector
< VideoRecorder * > 
VideoRecorders
typedef std::vector
< LocustModel * > 
LocustModels
typedef std::vector< Behavior * > Behaviours

Public Member Functions

void parse_command_line ()
 Parse the command line arguments.
void run ()
 ~App ()
 Clean-up.

Static Public Member Functions

static Appcreate (int argc, const char *argv[])
static void wait_for_init ()

static int argc ()
static const char ** argv ()
static LaserRangeFinderlrf ()
static Robotrobot ()
static Mapmap ()
static const LocustModelslocusts ()
static const Behavioursbehaviours ()
static LaserVizlaser_viz ()
static LaserVizFlatlaser_viz_flat ()

Friends

class singleton< App >

struct signal_pred
struct wait_pred

Detailed Description

An application object that ties together various I/O and other modules and runs the main thread.

This class is responsible for instantiating the various objects used to interface with the robot's sensors, motors, etc. It also creates the different behaviours that make up Robolocust's behaviour-based controller and runs the main thread's update loop that takes care of continously retrieving the latest sensor measurements, performing the necessary low-level state computations, etc.

The application object is implemented as a singleton. This allows other modules/behaviours to easily retrieve references to I/O and other objects. Thus, the application object serves as a central repository that holds together the various low-level shared objects required by the different behaviours.

Definition at line 104 of file LoApp.H.


Member Typedef Documentation

One of the main responsibilities of the application object is to hold a bunch of low-level things together in one place so that they may be accessed by other modules and threads as required. To ease the interface between these low-level objects and high-level behaviours that need them, we use these typedefs.

Definition at line 119 of file LoApp.H.


Constructor & Destructor Documentation

lobot::App::~App (  ) 

Clean-up.

Definition at line 506 of file LoApp.C.

References ModelComponent::started(), and ModelComponent::stop().


Member Function Documentation

static int lobot::App::argc (  )  [inline, static]

Return references/pointers to the things held centrally by the application object.

Definition at line 152 of file LoApp.H.

App & lobot::App::create ( int  argc,
const char *  argv[] 
) [static]

A convenient alias for returning the application object's lone instance.

Definition at line 136 of file LoApp.C.

void lobot::App::parse_command_line (  ) 

Parse the command line arguments.

Definition at line 366 of file LoApp.C.

References ModelManager::parseCommandLine(), and ModelManager::setOptionValString().

void lobot::App::run (  ) 

The application object has two main responsibilities. First, it must instantiate all the different I/O modules, create the different behaviours, etc. Second, it must run the Robolocust application's main loop. This method implements the afore-mentioned loop.

The main loop runs the update cycle, which takes care of retrieving the latest measurements from the sensors, computing any low-level state based on these measurements, etc. The loop exits when the lobot::Shutdown object is signaled. Before exiting, the main thread waits for all the other threads to wind-up.

Definition at line 381 of file LoApp.C.

References lobot::Pause::clear(), lobot::Pause::is_clear(), lobot::Configuration::load(), lobot::Robot::off(), lobot::MainWindow::push_back(), lobot::Pause::set(), lobot::Configuration::set_internal(), lobot::Shutdown::signaled(), ModelComponent::start(), lobot::Robot::update(), lobot::DangerZone::update(), lobot::LocustModel::update(), lobot::Compositor< pixel_type >::update(), lobot::VideoStream::update(), lobot::LaserRangeFinder::update(), and lobot::VideoRecorder::update().

static void lobot::App::wait_for_init (  )  [inline, static]

External API for other threads to wait until the application object is fully initialized.

Definition at line 228 of file LoApp.H.

Referenced by lobot::Arbiter::run(), and lobot::Behavior::run().


The documentation for this class was generated from the following files:
Generated on Sun May 8 08:44:29 2011 for iLab Neuromorphic Vision Toolkit by  doxygen 1.6.3