Page MenuHomec4science

OncillaKnee.cpp
No OneTemporary

File Metadata

Created
Wed, Nov 13, 16:18

OncillaKnee.cpp

#include "OncillaKnee.h"
using namespace std;
using namespace boost;
namespace cca {
namespace rci {
namespace driver {
OncillaKnee::OncillaKnee(std::string name) :
ResourceNode(name), Controlled(), Sensing(), PositionControlled(),
PositionSensing(), VelocityControlled(), TorqueControlled(),
ImpedanceControlled() {
// Two encoder values - difference is due to passive compliance
this->_dimension = 2;
}
bool OncillaKnee::isConverged() const {
return false;
}
bool OncillaKnee::setJointPosition(JointAnglesPtr position) {
// Successfull
// std::cerr << "[OncillaKnee] " << position << std::endl;
this->_lastCommandedPosition = position;
return true;
}
JointAnglesPtr OncillaKnee::getJointPosition() const {
return this->_latestJointPosition;
}
OncillaKnee::~OncillaKnee() {
}
std::string OncillaKnee::print() const {
ostringstream outstream(ostringstream::out);
outstream.precision(3); // Precision when printing double values
outstream << "<Oncilla Knee>" << endl;
return outstream.str();
}
bool OncillaKnee::setJointTorque(JointTorquesPtr torques) {
throw std::runtime_error("Not yet implemented.");
}
bool OncillaKnee::setJointImpedance(JointImpedancePtr imped) {
throw std::runtime_error("Not yet implemented.");
}
bool OncillaKnee::setJointVelocity(JointVelocitiesPtr vel) {
throw std::runtime_error("Not yet implemented.");
}
JointAnglesPtr OncillaKnee::getLastPositionCommand() const {
// TODO: The second part f this condition shouldn`t be necessary
if (!this->_lastCommandedPosition || !this->_lastCommandedPosition.get()) {
// No command set yet. Returning current joint values instead
// FIXME: Instead of return current position set command to current position
return this->_latestJointPosition;
}
return this->_lastCommandedPosition;
}
}
}
}

Event Timeline