Page MenuHomec4science

OncillaHip.cpp
No OneTemporary

File Metadata

Created
Fri, Jul 12, 02:27

OncillaHip.cpp

#include "OncillaHip.h"
using namespace std;
namespace cca {
namespace rci {
namespace driver {
OncillaHipSagittal::OncillaHipSagittal(std::string name) :
ResourceNode(name), Controlled(), Sensing(), PositionControlled(),
PositionSensing(), TorqueControlled(), ImpedanceControlled() {
this->_dimension = 2; // Two encoder values - should always be the same
}
bool OncillaHipSagittal::isConverged() const {
throw std::runtime_error("Not yet implemented.");
}
bool OncillaHipSagittal::setJointPosition(JointAnglesPtr position) {
// Successfull
this->_lastCommandedPosition = position;
return true;
}
JointAnglesPtr OncillaHipSagittal::getJointPosition() const {
return this->_latestJointPosition;
}
bool OncillaHipSagittal::setJointVelocity(JointVelocitiesPtr vel) {
throw std::runtime_error("Not yet implemented.");
}
bool OncillaHipSagittal::setJointTorque(JointTorquesPtr torque) {
throw std::runtime_error("Not yet implemented.");
}
bool OncillaHipSagittal::setJointImpedance(JointImpedancePtr imped) {
throw std::runtime_error("Not yet implemented.");
}
JointAnglesPtr OncillaHipSagittal::getLastPositionCommand() const {
// TODO: The second part f this condition shouldn`t be necessary
if (this->_lastCommandedPosition && this->_lastCommandedPosition.get()) {
//std::cout << this->_lastCommandedPosition->print();
return this->_lastCommandedPosition;
}
// No command set yet. Returning current joint values instead
return this->_latestJointPosition;
}
OncillaHipSagittal::~OncillaHipSagittal() {
}
std::string OncillaHipSagittal::print() const {
ostringstream outstream(ostringstream::out);
outstream.precision(3); // Precision when printing double values
outstream << "<Oncilla Hip>" << endl;
return outstream.str();
}
/** Oncilla Hip Transverse **/
OncillaHipTransverse::OncillaHipTransverse(std::string name) :
ResourceNode(name), Controlled(), PositionControlled() {
}
bool OncillaHipTransverse::isConverged() const {
return false;
}
bool OncillaHipTransverse::setJointPosition(JointAnglesPtr position) {
// Successfull
this->_lastCommandedPosition = position;
return true;
}
JointAnglesPtr OncillaHipTransverse::getLastPositionCommand() const {
// TODO: The second part f this condition shouldn`t be necessary
if (this->_lastCommandedPosition && this->_lastCommandedPosition.get()) {
//std::cout << this->_lastCommandedPosition->print();
return this->_lastCommandedPosition;
}
}
OncillaHipTransverse::~OncillaHipTransverse() {
}
std::string OncillaHipTransverse::print() const {
ostringstream outstream(ostringstream::out);
outstream.precision(3); // Precision when printing double values
outstream << "<Oncilla Hip>" << endl;
return outstream.str();
}
}
}
}

Event Timeline