|
@ -70,7 +70,7 @@ friRemote* SvrData::getFriRemote() |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
void SvrData::updateMessurementData( |
|
|
void SvrData::updateMessurementData( |
|
|
VecJoint newJointPos, |
|
|
|
|
|
|
|
|
Robot::VecJoint newJointPos, |
|
|
MatCarthesian newCartPos, |
|
|
MatCarthesian newCartPos, |
|
|
VecTorque newForceAndTorque |
|
|
VecTorque newForceAndTorque |
|
|
) |
|
|
) |
|
@ -84,7 +84,7 @@ void SvrData::updateMessurementData( |
|
|
|
|
|
|
|
|
void SvrData::updateMessurement() |
|
|
void SvrData::updateMessurement() |
|
|
{ |
|
|
{ |
|
|
VecJoint newJointPos(0.0f); |
|
|
|
|
|
|
|
|
Robot::VecJoint newJointPos(0.0f); |
|
|
MatCarthesian newCartPos(0.0f,1.0f); |
|
|
MatCarthesian newCartPos(0.0f,1.0f); |
|
|
VecTorque newForceAndTorque(0.0f); |
|
|
VecTorque newForceAndTorque(0.0f); |
|
|
|
|
|
|
|
@ -92,8 +92,8 @@ void SvrData::updateMessurement() |
|
|
/// update current joint positions
|
|
|
/// update current joint positions
|
|
|
friInst->getState(); |
|
|
friInst->getState(); |
|
|
FRI_STATE state = friInst->getState(); |
|
|
FRI_STATE state = friInst->getState(); |
|
|
VecJoint newJointPosComanded(friInst->getMsrCmdJntPosition()); |
|
|
|
|
|
VecJoint newJointPosOffset(friInst->getMsrCmdJntPositionOffset()); |
|
|
|
|
|
|
|
|
Robot::VecJoint newJointPosComanded(friInst->getMsrCmdJntPosition()); |
|
|
|
|
|
Robot::VecJoint newJointPosOffset(friInst->getMsrCmdJntPositionOffset()); |
|
|
newJointPos = newJointPosComanded + newJointPosOffset; |
|
|
newJointPos = newJointPosComanded + newJointPosOffset; |
|
|
newJointPos = newJointPos * ( 180.0f / M_PI); |
|
|
newJointPos = newJointPos * ( 180.0f / M_PI); |
|
|
|
|
|
|
|
@ -118,9 +118,9 @@ void SvrData::unlock() |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
VecJoint SvrData::getMessuredJointPos() |
|
|
|
|
|
|
|
|
Robot::VecJoint SvrData::getMessuredJointPos() |
|
|
{ |
|
|
{ |
|
|
VecJoint buf; |
|
|
|
|
|
|
|
|
Robot::VecJoint buf; |
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
buf = messured.jointPos; |
|
|
buf = messured.jointPos; |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
@ -157,15 +157,15 @@ int SvrData::getMessuredJacobian(float* data, size_t size) |
|
|
return 0; |
|
|
return 0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
VecJoint SvrData::getCommandedJointPos() |
|
|
|
|
|
|
|
|
Robot::VecJoint SvrData::getCommandedJointPos() |
|
|
{ |
|
|
{ |
|
|
VecJoint buff; |
|
|
|
|
|
|
|
|
Robot::VecJoint buff; |
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
buff = commanded.jointPos; |
|
|
buff = commanded.jointPos; |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
return buff; |
|
|
return buff; |
|
|
} |
|
|
} |
|
|
void SvrData::setCommandedJointPos(VecJoint newJointPos) |
|
|
|
|
|
|
|
|
void SvrData::setCommandedJointPos(Robot::VecJoint newJointPos) |
|
|
{ |
|
|
{ |
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
commanded.jointPos = newJointPos; |
|
|
commanded.jointPos = newJointPos; |
|
@ -187,41 +187,41 @@ void SvrData::setCommandedCartPos(MatCarthesian newCartPos) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VecJoint SvrData::getMaxTorque() |
|
|
|
|
|
|
|
|
Robot::VecJoint SvrData::getMaxTorque() |
|
|
{ |
|
|
{ |
|
|
VecJoint buff; |
|
|
|
|
|
|
|
|
Robot::VecJoint buff; |
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
buff = robot.max.torque; |
|
|
buff = robot.max.torque; |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
return buff; |
|
|
return buff; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
VecJoint SvrData::getMaxAcceleration() |
|
|
|
|
|
|
|
|
Robot::VecJoint SvrData::getMaxAcceleration() |
|
|
{ |
|
|
{ |
|
|
VecJoint retval(0.0f); |
|
|
|
|
|
|
|
|
Robot::VecJoint retval(0.0f); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
retval = robot.max.accelaration; |
|
|
retval = robot.max.accelaration; |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
return retval; |
|
|
return retval; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
VecJoint SvrData::getMaxVelocity() |
|
|
|
|
|
|
|
|
Robot::VecJoint SvrData::getMaxVelocity() |
|
|
{ |
|
|
{ |
|
|
VecJoint retval(0.0f); |
|
|
|
|
|
|
|
|
Robot::VecJoint retval(0.0f); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
retval = robot.max.velocity; |
|
|
retval = robot.max.velocity; |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
return retval; |
|
|
return retval; |
|
|
} |
|
|
} |
|
|
VecJoint SvrData::getMaxRange() |
|
|
|
|
|
|
|
|
Robot::VecJoint SvrData::getMaxRange() |
|
|
{ |
|
|
{ |
|
|
VecJoint retval(0.0f); |
|
|
|
|
|
|
|
|
Robot::VecJoint retval(0.0f); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
retval = robot.max.range; |
|
|
retval = robot.max.range; |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
return retval; |
|
|
return retval; |
|
|
} |
|
|
} |
|
|
bool SvrData::checkJointRange(VecJoint vectorToCheck) |
|
|
|
|
|
|
|
|
bool SvrData::checkJointRange(Robot::VecJoint vectorToCheck) |
|
|
{ |
|
|
{ |
|
|
// save temporal the max range for short time lock
|
|
|
// save temporal the max range for short time lock
|
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
@ -257,10 +257,10 @@ int SvrData::setRobotVelocityPercentage(float newVelocityPercentage) |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
return retval; |
|
|
return retval; |
|
|
} |
|
|
} |
|
|
VecJoint SvrData::getRobotVelocity() |
|
|
|
|
|
|
|
|
Robot::VecJoint SvrData::getRobotVelocity() |
|
|
{ |
|
|
{ |
|
|
float percent = 0.0f; |
|
|
float percent = 0.0f; |
|
|
VecJoint retval(0.0f); |
|
|
|
|
|
|
|
|
Robot::VecJoint retval(0.0f); |
|
|
|
|
|
|
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
percent = robot.currentVelocityPercentage / 100.0f; |
|
|
percent = robot.currentVelocityPercentage / 100.0f; |
|
@ -292,10 +292,10 @@ int SvrData::setRobotAccelerationPercentage(float newAccelerationPercentage) |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
return retval; |
|
|
return retval; |
|
|
} |
|
|
} |
|
|
VecJoint SvrData::getRobotAcceleration() |
|
|
|
|
|
|
|
|
Robot::VecJoint SvrData::getRobotAcceleration() |
|
|
{ |
|
|
{ |
|
|
float percent = 0; |
|
|
float percent = 0; |
|
|
VecJoint retval(0.0f); |
|
|
|
|
|
|
|
|
Robot::VecJoint retval(0.0f); |
|
|
|
|
|
|
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
percent = robot.currentAccelerationPercentage / 100.0f; |
|
|
percent = robot.currentAccelerationPercentage / 100.0f; |
|
@ -445,15 +445,15 @@ void SvrData::setTrajectoryType(enum TrajectoryType newType) |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
class Trajectory<Robot::joints>* SvrData::createTrajectory(VecJoint newJointPos) |
|
|
|
|
|
|
|
|
class Trajectory<Robot::joints>* SvrData::createTrajectory(Robot::VecJoint newJointPos) |
|
|
{ |
|
|
{ |
|
|
//set new target for next trajectory
|
|
|
//set new target for next trajectory
|
|
|
VecJoint prevJointPos = getCommandedJointPos(); |
|
|
|
|
|
|
|
|
Robot::VecJoint prevJointPos = getCommandedJointPos(); |
|
|
class Trajectory<Robot::joints>* newTrajectory; |
|
|
class Trajectory<Robot::joints>* newTrajectory; |
|
|
|
|
|
|
|
|
float sampleTimeMs = getSampleTimeMs(); |
|
|
float sampleTimeMs = getSampleTimeMs(); |
|
|
VecJoint maxJointVelocity = getRobotVelocity(); |
|
|
|
|
|
VecJoint maxJointAcceleration = getRobotAcceleration(); |
|
|
|
|
|
|
|
|
Robot::VecJoint maxJointVelocity = getRobotVelocity(); |
|
|
|
|
|
Robot::VecJoint maxJointAcceleration = getRobotAcceleration(); |
|
|
enum TrajectoryType type = getTrajectoryType(); |
|
|
enum TrajectoryType type = getTrajectoryType(); |
|
|
|
|
|
|
|
|
//newTrajectory = SvrData::getInstance()->createTrajectory(newJointPos);
|
|
|
//newTrajectory = SvrData::getInstance()->createTrajectory(newJointPos);
|
|
@ -465,9 +465,9 @@ class Trajectory<Robot::joints>* SvrData::createTrajectory(MatCarthesian newJoin |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
VecJoint SvrData::getMeasuredJointPos() |
|
|
|
|
|
|
|
|
Robot::VecJoint SvrData::getMeasuredJointPos() |
|
|
{ |
|
|
{ |
|
|
VecJoint retval(0.0f); |
|
|
|
|
|
|
|
|
Robot::VecJoint retval(0.0f); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
retval = messured.jointPos; |
|
|
retval = messured.jointPos; |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|