diff --git a/src/OncillaL01.h b/src/OncillaL01.h index c18c4fd..ea9ff9c 100644 --- a/src/OncillaL01.h +++ b/src/OncillaL01.h @@ -1,153 +1,153 @@ #pragma once #include #include #include #include #include #include #include #include "OncillaSynchronizer.h" namespace rci { namespace oncilla { class OncillaL0; 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 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); /** * 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; }; class OncillaL1; typedef boost::shared_ptr OncillaL1Ptr; /** * Node class, representing the hip node of the quadruped robot. * * @todo In case of simulation, this node can also sense the power consumption. */ class OncillaL1: 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: /** * Special constructor to also link to webots */ OncillaL1(OncillaSynchronizer &s, const std::string &name = "Oncilla Hip"); virtual ~OncillaL1(); /** * 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); /** * Returns current joint position. * @return Current joint position */ virtual JointAnglesPtr getJointPosition() const; /** * 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/OncillaSynchronizer.cpp b/src/OncillaSynchronizer.cpp index f50e5dd..e5a9747 100644 --- a/src/OncillaSynchronizer.cpp +++ b/src/OncillaSynchronizer.cpp @@ -1,16 +1,16 @@ #include "OncillaSynchronizer.h" using namespace std; namespace rci { namespace oncilla { OncillaSynchronizer::OncillaSynchronizer(const std::string &sname) : - Synchronizer(sname) { + Synchronizer(sname) { } OncillaSynchronizer::~OncillaSynchronizer() { } } } diff --git a/src/OncillaSynchronizer.h b/src/OncillaSynchronizer.h index a24af44..4cdbf9e 100644 --- a/src/OncillaSynchronizer.h +++ b/src/OncillaSynchronizer.h @@ -1,87 +1,83 @@ #pragma once #include #include #include #include +#include "Oncilla.h" + namespace rci { namespace oncilla { class OncillaSynchronizer; typedef boost::shared_ptr OncillaSynchronizerPtr; class OncillaTrunk; typedef boost::shared_ptr OncillaTrunkPtr; class OncillaL0; typedef boost::shared_ptr OncillaL0Ptr; class OncillaL1; typedef boost::shared_ptr OncillaL1Ptr; class OncillaL2; typedef boost::shared_ptr OncillaL2Ptr; class OncillaL3; typedef boost::shared_ptr OncillaL3Ptr; class OncillaL4; 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. - * @todo use Oncilla::Leg as index (problem with cyclic includes) */ - virtual void registerTrunkNode(unsigned int index, OncillaTrunkPtr node) = 0; + virtual void registerTrunkNode(OncillaTrunkPtr node) = 0; /** * Registers an L0 node. - * @todo use Oncilla::Leg as index (problem with cyclic includes) */ - virtual void registerL0Node(unsigned int index, OncillaL0Ptr node) = 0; + virtual void registerL0Node(Oncilla::Leg l, OncillaL0Ptr node) = 0; /** * Registers an L1 node. - * @todo use Oncilla::Leg as index (problem with cyclic includes) */ - virtual void registerL1Node(unsigned int index, OncillaL1Ptr node) = 0; + virtual void registerL1Node(Oncilla::Leg l, OncillaL1Ptr node) = 0; /** * Registers an L2 node. - * @todo use Oncilla::Leg as index (problem with cyclic includes) */ - virtual void registerL2Node(unsigned int index, OncillaL2Ptr node) = 0; + virtual void registerL2Node(Oncilla::Leg l, OncillaL2Ptr node) = 0; /** * Registers an L3 node. - * @todo use Oncilla::Leg as index (problem with cyclic includes) */ - virtual void registerL3Node(unsigned int index, OncillaL3Ptr node) = 0; + virtual void registerL3Node(Oncilla::Leg l, OncillaL3Ptr node) = 0; /** * Registers an L4 node. - * @todo use Oncilla::Leg as index (problem with cyclic includes) */ - virtual void registerL4Node(unsigned int index, OncillaL4Ptr node) = 0; + virtual void registerL4Node(Oncilla::Leg l, OncillaL4Ptr node) = 0; /** * */ friend std::ostream & operator<<(std::ostream& os, const OncillaSynchronizer& val); }; } }