diff --git a/src/liboncilla/BackendFactory.h b/src/liboncilla/BackendFactory.h index d74d5b2..6800905 100644 --- a/src/liboncilla/BackendFactory.h +++ b/src/liboncilla/BackendFactory.h @@ -1,83 +1,83 @@ /** * \file BackendFactory.h * * \date Jun 21, 2012 * \author Alexandre Tuleu */ #ifndef LIBONCILLA_BACKENDFACTORY_H_ #define LIBONCILLA_BACKENDFACTORY_H_ #include -#include +#include #include #include #include extern "C" { typedef void (*liboncilla_backend_entry_fct)(); } namespace rci{ namespace oncilla{ class OncillaSynchronizer; class BackendFactory { public : /** * define the priority of the backend */ enum Priority{ HARDWARE = 0, SIMULATION = 1, USER_DEFINED_PRIORITY = 2 }; /** * Pointer to a function that will be the entry of the Backend. */ typedef OncillaSynchronizer * (*EntryPtr)(); static BackendFactory & Instance(); void AddAdditionalBackend(const std::string & name); /** * Register a new backend. * \param p the Priority of the backend * \param entry the EntryPtr of the backend * \warning : if a backend with the same priority is already here, the call * will be silently discarded. */ void RegisterBackend(Priority p, EntryPtr entry); /** * \return the EntryPtr of the highest priority backend or 0 if none was * registered with RegisterBackend(). */ EntryPtr HighestPriorityBackend(); private: typedef std::map EntryByPriority; typedef std::set SetOfBackendName; typedef std::map ListOfLoadedBackend; void LoadExternalBackend(); BackendFactory(); virtual ~BackendFactory(); EntryByPriority d_entries; SetOfBackendName d_unloaded; ListOfLoadedBackend d_loaded; }; } } #endif // LIBONCILLA_BACKENDFACTORY_H_ diff --git a/src/liboncilla/Oncilla.h b/src/liboncilla/Oncilla.h index 1cf2015..5a24a1f 100644 --- a/src/liboncilla/Oncilla.h +++ b/src/liboncilla/Oncilla.h @@ -1,81 +1,81 @@ /* * Oncilla.h * * Created on: 15 dec. 2011 * Author: Alexandre Tuleu, Arne Nordmann */ #pragma once #include #include -#include +#include namespace rci { namespace oncilla { class Oncilla; -typedef std::tr1::shared_ptr OncillaPtr; +typedef boost::shared_ptr OncillaPtr; class OncillaSynchronizer; -typedef std::tr1::shared_ptr OncillaSynchronizerPtr; +typedef boost::shared_ptr OncillaSynchronizerPtr; class OncillaTrunk; -typedef std::tr1::shared_ptr OncillaTrunkPtr; +typedef boost::shared_ptr OncillaTrunkPtr; class OncillaL0; -typedef std::tr1::shared_ptr OncillaL0Ptr; +typedef boost::shared_ptr OncillaL0Ptr; class OncillaL1L2; -typedef std::tr1::shared_ptr OncillaL1Ptr; -typedef std::tr1::shared_ptr OncillaL2Ptr; +typedef boost::shared_ptr OncillaL1Ptr; +typedef boost::shared_ptr OncillaL2Ptr; class OncillaL3; -typedef std::tr1::shared_ptr OncillaL3Ptr; +typedef boost::shared_ptr OncillaL3Ptr; class OncillaL4; -typedef std::tr1::shared_ptr OncillaL4Ptr; +typedef boost::shared_ptr OncillaL4Ptr; class Oncilla { public: enum Leg { LEFT_FORE = 0, RIGHT_FORE = 1, LEFT_HIND = 2, RIGHT_HIND = 3, NUM_LEGS = 4 }; static const std::string & nameOfLeg(Leg l); Oncilla(); virtual ~Oncilla(); OncillaL0Ptr getL0(Leg l) const; OncillaL1Ptr getL1(Leg l) const; OncillaL2Ptr getL2(Leg l) const; OncillaL3Ptr getL3(Leg l) const; OncillaL4Ptr getL4(Leg l) const; OncillaTrunkPtr getTrunk() const; OncillaSynchronizerPtr getSynchronizer() const; private: typedef std::vector LegNames; static LegNames s_legNames; void init(); static OncillaSynchronizerPtr s_synchronizer; std::vector d_L0s; std::vector d_L1s; std::vector d_L2s; std::vector d_L3s; std::vector d_L4s; OncillaTrunkPtr d_trunk; }; } } diff --git a/src/liboncilla/OncillaL0.h b/src/liboncilla/OncillaL0.h index b9dac88..e88b312 100644 --- a/src/liboncilla/OncillaL0.h +++ b/src/liboncilla/OncillaL0.h @@ -1,69 +1,69 @@ #pragma once #include -#include +#include #include #include #include #include #include "OncillaSynchronizer.h" namespace rci { namespace oncilla { class OncillaL0; -typedef std::tr1::shared_ptr OncillaL0Ptr; +typedef boost::shared_ptr OncillaL0Ptr; /** * Node class, representing the hip node of the quadruped robot. * @todo In case of simulation, this node can also sense the power consumption. */ class OncillaL0: public rci::ResourceNode, public rci::Controlled, public rci::PositionControlled { public: /** * Special constructor to also link to webots */ OncillaL0(const std::string &name = "Oncilla Hip"); virtual ~OncillaL0(); /** * Returns, if controller is converged. * @return True, if controller is converged after last command. */ bool isConverged() const; /** * Commanding a joint position. * @param position Position command * @return Return, if successfull. (e.g. not exceeding joint limits) * @todo Check for correct control mode */ bool setJointPosition(JointAnglesPtr position); void unsafeSetCommand(double value); double unsafeGetCommand() const; /** * Returns latest position command. Note, that this is the latest valid * commanded position. If the position command exceeds limits and is * therefore rejected, it .. */ virtual JointAnglesPtr getLastPositionCommand() const; /** * Print */ std::string print() const; }; } } diff --git a/src/liboncilla/OncillaL1L2.h b/src/liboncilla/OncillaL1L2.h index 9644349..db4ece6 100644 --- a/src/liboncilla/OncillaL1L2.h +++ b/src/liboncilla/OncillaL1L2.h @@ -1,125 +1,125 @@ #pragma once -#include +#include #include #include #include #include #include "OncillaSynchronizer.h" namespace rci{ namespace oncilla{ class OncillaL1L2; -typedef std::tr1::shared_ptr OncillaL1Ptr; -typedef std::tr1::shared_ptr OncillaL2Ptr; +typedef boost::shared_ptr OncillaL1Ptr; +typedef boost::shared_ptr OncillaL2Ptr; /** * Node class, representing the hip node of the quadruped robot. * * @todo In case of simulation, this node can also sense the power consumption. */ class OncillaL1L2: public rci::ResourceNode, public rci::Controlled, public rci::Sensing, public rci::PositionControlled, public rci::PositionSensing, // Two encoder values public rci::VelocityControlled, public rci::TorqueControlled, public rci::ImpedanceControlled { public: const static unsigned int MotorAxisIndex = 0; const static unsigned int MagneticEncoderIndex = 1; /** * Special constructor to also link to webots */ OncillaL1L2(OncillaSynchronizer &s, const std::string &name = "Oncilla Hip"); virtual ~OncillaL1L2(); /** * Returns, if controller is converged. * @return True, if controller is converged after last command. */ bool isConverged() const; /** * Commanding a joint position. * @param position Position command * @return Return, if successfull. (e.g. not exceeding joint limits) * @todo Check for correct control mode */ bool setJointPosition(JointAnglesPtr position); void unsafeSetCommand(double value); double unsafeGetCommand() const ; /** * Returns current joint position. * @return Current joint position */ virtual JointAnglesPtr getJointPosition() const; double unsafeGetMotorAxisPosition() const; double unsafeGetMagneticEncoderPosition() const; void unsafeUpdateMotorAxisPosition(double value); void unsafeUpdateMagneticEncoderPosition(double value); /** * Commanding a joint velocity. * @param position Position command * @return Return, if successfull. (e.g. not exceeding joint limits) * @todo Check for correct control mode */ virtual bool setJointVelocity(rci::JointVelocitiesPtr vel); /** * Returns current joint torque. * @return Current joint torque */ virtual bool setJointTorque(JointTorquesPtr torque); /** * Returns current joint torque. * @return Current joint torque */ virtual bool setJointImpedance(JointImpedancePtr imped); /** * Returns latest position command. Note, that this is the latest valid * commanded position. If the position command exceeds limits and is * therefore rejected, it .. */ virtual JointAnglesPtr getLastPositionCommand() const; /** * Print */ std::string print() const; private: /** * Reference to OncillaSynchronizer * @todo This is a dangerous reference which will become invalid as soon as * OncillaSynchronizer gets deleted outside. */ OncillaSynchronizer &synchronizer; }; } } diff --git a/src/liboncilla/OncillaL3.h b/src/liboncilla/OncillaL3.h index 39ce875..9c4aa1d 100644 --- a/src/liboncilla/OncillaL3.h +++ b/src/liboncilla/OncillaL3.h @@ -1,49 +1,49 @@ #pragma once #include -#include +#include #include #include #include #include #include namespace rci { namespace oncilla { class OncillaL3; -typedef std::tr1::shared_ptr OncillaL3Ptr; +typedef boost::shared_ptr OncillaL3Ptr; /** * Node class, representing the foot/ankle of the quadruped robot. Not actuated, * but force sensing. */ class OncillaL3: public rci::ResourceNode, public rci::Sensing, public rci::PositionSensing { public: OncillaL3(const std::string & name = "Oncilla Ankle"); virtual ~OncillaL3(); /** * Returns contact forces */ JointAnglesPtr getJointPosition() const; double unsafeGetPosition() const; void unsafeUpdatePosition(double value); /** * Print */ std::string print() const; }; } } diff --git a/src/liboncilla/OncillaL4.h b/src/liboncilla/OncillaL4.h index d1ad167..3cb016b 100644 --- a/src/liboncilla/OncillaL4.h +++ b/src/liboncilla/OncillaL4.h @@ -1,45 +1,45 @@ #pragma once #include -#include +#include #include #include #include #include #include namespace rci { namespace oncilla { class OncillaL4; -typedef std::tr1::shared_ptr OncillaL4Ptr; +typedef boost::shared_ptr OncillaL4Ptr; /** * Node class, representing the foot of the quadruped robot. Not actuated, * but force sensing. */ class OncillaL4: public rci::ResourceNode, public rci::Sensing, public rci::ForceSensing { public: OncillaL4(const std::string & name = "Oncilla Foot"); virtual ~OncillaL4(); /** * Returns contact forces */ ForcesPtr getForces() const; /** * Print */ std::string print() const; }; } } diff --git a/src/liboncilla/OncillaSynchronizer.h b/src/liboncilla/OncillaSynchronizer.h index 5d376f8..5f1a93a 100644 --- a/src/liboncilla/OncillaSynchronizer.h +++ b/src/liboncilla/OncillaSynchronizer.h @@ -1,86 +1,86 @@ #pragma once #include #include #include #include #include "Oncilla.h" namespace rci { namespace oncilla { class OncillaSynchronizer; -typedef std::tr1::shared_ptr OncillaSynchronizerPtr; +typedef boost::shared_ptr OncillaSynchronizerPtr; class OncillaTrunk; -typedef std::tr1::shared_ptr OncillaTrunkPtr; +typedef boost::shared_ptr OncillaTrunkPtr; class OncillaL0; -typedef std::tr1::shared_ptr OncillaL0Ptr; +typedef boost::shared_ptr OncillaL0Ptr; class OncillaL1L2; -typedef std::tr1::shared_ptr OncillaL1Ptr; -typedef std::tr1::shared_ptr OncillaL2Ptr; +typedef boost::shared_ptr OncillaL1Ptr; +typedef boost::shared_ptr OncillaL2Ptr; class OncillaL3; -typedef std::tr1::shared_ptr OncillaL3Ptr; +typedef boost::shared_ptr OncillaL3Ptr; class OncillaL4; -typedef std::tr1::shared_ptr OncillaL4Ptr; +typedef boost::shared_ptr OncillaL4Ptr; /** * OncillaSynchronizer * Different OncillaSynchronizers may be for example: * * Update with a given frequency * ** Send data every time * ** Send only if new data * * Update only if new data (event-based) * * Triggered from robot side (e.g. FRI) */ class OncillaSynchronizer: public Synchronizer { public: OncillaSynchronizer(const std::string &name); virtual ~OncillaSynchronizer(); /** * Registers a trunk node. */ virtual void registerTrunkNode(OncillaTrunkPtr node) = 0; /** * Registers an L0 node. */ virtual void registerL0Node(Oncilla::Leg l, OncillaL0Ptr node) = 0; /** * Registers an L1 node. */ virtual void registerL1Node(Oncilla::Leg l, OncillaL1Ptr node) = 0; /** * Registers an L2 node. */ virtual void registerL2Node(Oncilla::Leg l, OncillaL2Ptr node) = 0; /** * Registers an L3 node. */ virtual void registerL3Node(Oncilla::Leg l, OncillaL3Ptr node) = 0; /** * Registers an L4 node. */ virtual void registerL4Node(Oncilla::Leg l, OncillaL4Ptr node) = 0; /** * */ friend std::ostream & operator<<(std::ostream& os, const OncillaSynchronizer& val); double latestProcessLoopDuration() const; protected : virtual double latestProcessLoopDurationPrimpl() const = 0; }; } } diff --git a/src/liboncilla/OncillaTrunk.h b/src/liboncilla/OncillaTrunk.h index efe53f2..f5e89a4 100644 --- a/src/liboncilla/OncillaTrunk.h +++ b/src/liboncilla/OncillaTrunk.h @@ -1,58 +1,58 @@ #pragma once #include -#include +#include #include #include #include #include namespace rci { namespace oncilla { class OncillaTrunk; -typedef std::tr1::shared_ptr OncillaTrunkPtr; +typedef boost::shared_ptr OncillaTrunkPtr; /** * Node class, representing the quadruped trunk, including pose sensing. * * @todo Expose translational accelerations and rotational velocities */ class OncillaTrunk: public rci::ResourceNode, public Sensing, public PoseSensing { public: OncillaTrunk(const std::string & name = "Oncilla Trunk"); virtual ~OncillaTrunk(); /** * Returns current pose. * * @return Current pose */ virtual PosePtr getAbsolutePose() const; /** * Returns current displacement. * * @return Current pose */ virtual PosePtr getDisplacement() const; /** * Returns current translational and rotational acceleration. * * @return Current pose */ virtual PosePtr getAcceleration() const; /** * Print */ std::string print() const; }; } }