|
@ -20,8 +20,8 @@ SvrData::SvrData(void) |
|
|
double maxTrqJnt[] = {176.0,176.0,100.0,100.0,100.0,38.0,38.0}; |
|
|
double maxTrqJnt[] = {176.0,176.0,100.0,100.0,100.0,38.0,38.0}; |
|
|
double maxRangeJnt[] = {170.0,120.0,170.0,120.0,170.0,120.0,170.0}; |
|
|
double maxRangeJnt[] = {170.0,120.0,170.0,120.0,170.0,120.0,170.0}; |
|
|
|
|
|
|
|
|
robot.currentVelocity = 20; |
|
|
|
|
|
robot.currentAcceleration = 10; |
|
|
|
|
|
|
|
|
robot.currentVelocityPercentage = 20; |
|
|
|
|
|
robot.currentAccelerationPercentage = 10; |
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < JOINT_NUMBER; ++i) |
|
|
for (unsigned int i = 0; i < JOINT_NUMBER; ++i) |
|
|
{ |
|
|
{ |
|
@ -191,40 +191,38 @@ VecJoint SvrData::getMaxTorque() |
|
|
|
|
|
|
|
|
VecJoint SvrData::getMaxAcceleration() |
|
|
VecJoint SvrData::getMaxAcceleration() |
|
|
{ |
|
|
{ |
|
|
VecJoint buff; |
|
|
|
|
|
|
|
|
VecJoint retval(0.0f); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
buff = robot.max.accelaration; |
|
|
|
|
|
|
|
|
retval = robot.max.accelaration; |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
return buff; |
|
|
|
|
|
|
|
|
return retval; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
VecJoint SvrData::getMaxVelocity() |
|
|
VecJoint SvrData::getMaxVelocity() |
|
|
{ |
|
|
{ |
|
|
VecJoint buff; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VecJoint retval(0.0f); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
buff = robot.max.velocity; |
|
|
|
|
|
|
|
|
retval = robot.max.velocity; |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
return buff; |
|
|
|
|
|
|
|
|
return retval; |
|
|
} |
|
|
} |
|
|
VecJoint SvrData::getMaxRange() |
|
|
VecJoint SvrData::getMaxRange() |
|
|
{ |
|
|
{ |
|
|
VecJoint buff; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
VecJoint retval(0.0f); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
buff = robot.max.range; |
|
|
|
|
|
|
|
|
retval = robot.max.range; |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
return buff; |
|
|
|
|
|
|
|
|
return retval; |
|
|
} |
|
|
} |
|
|
bool SvrData::checkJointRange(VecJoint vectorToCheck) |
|
|
bool SvrData::checkJointRange(VecJoint vectorToCheck) |
|
|
{ |
|
|
{ |
|
|
bool retval = false; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// save temporal the max range for short time lock
|
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
Vec<float,LBR_MNJ> maxJointRange; |
|
|
Vec<float,LBR_MNJ> maxJointRange; |
|
|
maxJointRange = robot.max.range; |
|
|
maxJointRange = robot.max.range; |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
|
|
|
|
|
|
|
|
|
// check if the value is in plus or minus range
|
|
|
for (int i = 0; i<JOINT_NUMBER; i++) |
|
|
for (int i = 0; i<JOINT_NUMBER; i++) |
|
|
{ |
|
|
{ |
|
|
if (abs(vectorToCheck(i)) > abs(maxJointRange(i))) |
|
|
if (abs(vectorToCheck(i)) > abs(maxJointRange(i))) |
|
@ -234,42 +232,76 @@ bool SvrData::checkJointRange(VecJoint vectorToCheck) |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
// no join angle is too big
|
|
|
// no join angle is too big
|
|
|
return false; |
|
|
|
|
|
|
|
|
return true; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
int SvrData::setRobotVelocity(float newVelocity) |
|
|
|
|
|
|
|
|
int SvrData::setRobotVelocityPercentage(float newVelocityPercentage) |
|
|
{ |
|
|
{ |
|
|
unsigned int retval = 0; |
|
|
unsigned int retval = 0; |
|
|
|
|
|
// percentage is to low
|
|
|
|
|
|
if (newVelocityPercentage <= 0.0f) |
|
|
|
|
|
return -1; |
|
|
|
|
|
// percentage is to high
|
|
|
|
|
|
if (newVelocityPercentage > 100.0f) |
|
|
|
|
|
return -2; |
|
|
|
|
|
|
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
robot.currentVelocity = newVelocity; |
|
|
|
|
|
|
|
|
robot.currentVelocityPercentage = newVelocityPercentage; |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
return retval; |
|
|
return retval; |
|
|
} |
|
|
} |
|
|
float SvrData::getRobotVelocity() |
|
|
|
|
|
|
|
|
VecJoint SvrData::getRobotVelocity() |
|
|
|
|
|
{ |
|
|
|
|
|
float percent = 0.0f; |
|
|
|
|
|
VecJoint retval(0.0f); |
|
|
|
|
|
|
|
|
|
|
|
pthread_mutex_lock(&dataLock); |
|
|
|
|
|
percent = robot.currentVelocityPercentage / 100.0f; |
|
|
|
|
|
retval = robot.max.velocity * percent; |
|
|
|
|
|
pthread_mutex_unlock(&dataLock); |
|
|
|
|
|
return retval; |
|
|
|
|
|
} |
|
|
|
|
|
float SvrData::getRobotVelocityPercentage() |
|
|
{ |
|
|
{ |
|
|
float retval = 0; |
|
|
float retval = 0; |
|
|
|
|
|
|
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
retval = robot.currentVelocity; |
|
|
|
|
|
|
|
|
retval = robot.currentVelocityPercentage; |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
return retval; |
|
|
return retval; |
|
|
} |
|
|
} |
|
|
int SvrData::setRobotAcceleration(float newAcceleration) |
|
|
|
|
|
|
|
|
int SvrData::setRobotAccelerationPercentage(float newAccelerationPercentage) |
|
|
{ |
|
|
{ |
|
|
unsigned int retval = 0; |
|
|
|
|
|
|
|
|
int retval = 0; |
|
|
|
|
|
// percentage is to low
|
|
|
|
|
|
if (newAccelerationPercentage <= 0.0f) |
|
|
|
|
|
return -1; |
|
|
|
|
|
// percentage is to high
|
|
|
|
|
|
if (newAccelerationPercentage > 100.0f) |
|
|
|
|
|
return -2; |
|
|
|
|
|
|
|
|
|
|
|
pthread_mutex_lock(&dataLock); |
|
|
|
|
|
robot.currentAccelerationPercentage = newAccelerationPercentage; |
|
|
|
|
|
pthread_mutex_unlock(&dataLock); |
|
|
|
|
|
return retval; |
|
|
|
|
|
} |
|
|
|
|
|
VecJoint SvrData::getRobotAcceleration() |
|
|
|
|
|
{ |
|
|
|
|
|
float percent = 0; |
|
|
|
|
|
VecJoint retval(0.0f); |
|
|
|
|
|
|
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
robot.currentAcceleration = newAcceleration; |
|
|
|
|
|
|
|
|
percent = robot.currentAccelerationPercentage / 100.0f; |
|
|
|
|
|
retval = robot.max.accelaration * percent; |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
return retval; |
|
|
return retval; |
|
|
} |
|
|
} |
|
|
float SvrData::getRobotAcceleration() |
|
|
|
|
|
|
|
|
float SvrData::getRobotAccelerationPercentage() |
|
|
{ |
|
|
{ |
|
|
float retval = 0; |
|
|
float retval = 0; |
|
|
|
|
|
|
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
retval = robot.currentAcceleration; |
|
|
|
|
|
|
|
|
retval = robot.currentAccelerationPercentage; |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
return retval; |
|
|
return retval; |
|
|
} |
|
|
} |
|
|