Page MenuHomec4science

OncillaL01.cpp
No OneTemporary

File Metadata

Created
Mon, May 6, 04:57

OncillaL01.cpp

#include "OncillaL01.h"
using namespace std;
namespace cca {
namespace rci {
namespace driver {
OncillaL1::OncillaL1(const std::string & name) :
ResourceNode(name), Controlled(), Sensing(), PositionControlled(),
PositionSensing(), TorqueControlled(), ImpedanceControlled() {
this->_dimension = 2; // Two encoder values - should always be the same
}
bool OncillaL1::isConverged() const {
throw std::runtime_error("Not yet implemented.");
return false;
}
bool OncillaL1::setJointPosition(JointAnglesPtr position) {
// Successfull
this->_lastCommandedPosition = position;
return true;
}
JointAnglesPtr OncillaL1::getJointPosition() const {
return this->_latestJointPosition;
}
bool OncillaL1::setJointVelocity(JointVelocitiesPtr vel) {
throw std::runtime_error("Not yet implemented.");
}
bool OncillaL1::setJointTorque(JointTorquesPtr torque) {
throw std::runtime_error("Not yet implemented.");
}
bool OncillaL1::setJointImpedance(JointImpedancePtr imped) {
throw std::runtime_error("Not yet implemented.");
}
JointAnglesPtr OncillaL1::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;
}
OncillaL1::~OncillaL1() {
}
std::string OncillaL1::print() const {
ostringstream outstream(ostringstream::out);
outstream.precision(3); // Precision when printing double values
outstream << "<Oncilla Hip>" << endl;
return outstream.str();
}
/** Oncilla Hip Transverse **/
OncillaL0::OncillaL0(std::string name) :
ResourceNode(name), Controlled(), PositionControlled() {
}
bool OncillaL0::isConverged() const {
return false;
}
bool OncillaL0::setJointPosition(JointAnglesPtr position) {
// Successfull
this->_lastCommandedPosition = position;
return true;
}
JointAnglesPtr OncillaL0::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;
}
return JointAnglesPtr();
}
OncillaL0::~OncillaL0() {
}
std::string OncillaL0::print() const {
ostringstream outstream(ostringstream::out);
outstream.precision(3); // Precision when printing double values
outstream << "<Oncilla Hip>" << endl;
return outstream.str();
}
}
}
}

Event Timeline