Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F120521191
Oncilla.h
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Jul 4, 23:42
Size
2 KB
Mime Type
text/x-c++
Expires
Sun, Jul 6, 23:42 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
27201580
Attached To
R6622 liboncilla
Oncilla.h
View Options
/*
* Oncilla.h
*
* Created on: 15 dec. 2011
* Author: Alexandre Tuleu, Arne Nordmann
*/
#pragma once
#include <vector>
#include <iostream>
#include <boost/shared_ptr.hpp>
#include "common.h"
#include "Supervisor.h"
#include <liboncilla/utils/OncillaBackend.h>
#include <liboncilla/Synchronizer.h>
#include <liboncilla/nodes/Nodes.h>
#include <set>
namespace rci {
namespace oncilla {
class BackendLoader;
class Oncilla {
public:
typedef boost::shared_ptr<Oncilla> Ptr;
/**
* When an Oncilla object is created, it will initialize all the resources
* corresponding to node regarding the backend. At the backend level, if
* some error happens, it will results by an Exception beeing thrown, for
* example if one of the motor device is not available. User can change the
* behavior by masking this exception, and defer them to the point where
* they actually use the non-initialized node. This allow a finer control
* of the robot, if an user want to drive only a leg and does not care if the
* rest of the robot is online. By default throwing on initialization is
* enabled.
* @param throwOn if \true, Oncilla object will throw exception on initialization.
*/
static void throwExceptionOnInitialization(bool throwOn);
static bool willThrowOnInitialization();
static std::string nameOfLeg(Leg l);
Oncilla();
Oncilla(const OncillaBackend::Ptr & backend);
virtual ~Oncilla();
const L0::Ptr & getL0(Leg l) const;
const L1::Ptr & getL1(Leg l) const;
const L2::Ptr & getL2(Leg l) const;
const L3::Ptr & getL3(Leg l) const;
const Trunk::Ptr & getTrunk() const;
const rci::oncilla::Synchronizer::Ptr & getSynchronizer() const;
const rci::oncilla::Supervisor::Ptr & getSupervisor() const;
private :
typedef std::vector<std::string> LegNames;
typedef std::set<OncillaBackend::Ptr> SetOfBackend;
typedef std::tr1::shared_ptr<std::runtime_error> RuntimeErrPtr;
typedef std::vector<RuntimeErrPtr> ListOfErrors;
void init();
static SetOfBackend s_backends;
static bool s_throwExceptionOnInitialization;
rci::oncilla::Synchronizer::Ptr d_synchronizer;
//object cerated with teh backend depend on the backen existance, so this
// pointer should be first (even if we save the backends in the static set)
OncillaBackend::Ptr d_backend;
std::vector<L0::Ptr> d_L0s;
std::vector<L1::Ptr> d_L1s;
std::vector<L2::Ptr> d_L2s;
std::vector<L3::Ptr> d_L3s;
ListOfErrors d_L0Errors;
ListOfErrors d_L1Errors;
ListOfErrors d_L2Errors;
ListOfErrors d_L3Errors;
Trunk::Ptr d_trunk;
RuntimeErrPtr d_trunkError;
Supervisor::Ptr d_supervisor;
};
}
}
Event Timeline
Log In to Comment