|
@ -26,7 +26,7 @@ SvrData::SvrData(void) |
|
|
robot.currentVelocityPercentage = 10; |
|
|
robot.currentVelocityPercentage = 10; |
|
|
robot.currentAccelerationPercentage = 10; |
|
|
robot.currentAccelerationPercentage = 10; |
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < jointNumber; ++i) |
|
|
|
|
|
|
|
|
for (unsigned int i = 0; i < Robot::joints; ++i) |
|
|
{ |
|
|
{ |
|
|
robot.max.velocity(i) = maxVelJnt[i]; |
|
|
robot.max.velocity(i) = maxVelJnt[i]; |
|
|
robot.max.accelaration(i) = maxAccJnt[i]; |
|
|
robot.max.accelaration(i) = maxAccJnt[i]; |
|
@ -230,7 +230,7 @@ bool SvrData::checkJointRange(VecJoint vectorToCheck) |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
|
|
|
|
|
|
// check if the value is in plus or minus range
|
|
|
// check if the value is in plus or minus range
|
|
|
for (int i = 0; i<jointNumber; i++) |
|
|
|
|
|
|
|
|
for (int i = 0; i<Robot::joints; i++) |
|
|
{ |
|
|
{ |
|
|
if (abs(vectorToCheck(i)) > abs(maxJointRange(i))) |
|
|
if (abs(vectorToCheck(i)) > abs(maxJointRange(i))) |
|
|
{ |
|
|
{ |
|
@ -317,7 +317,7 @@ unsigned int SvrData::getJoints() |
|
|
unsigned int retval = 0; |
|
|
unsigned int retval = 0; |
|
|
|
|
|
|
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
retval = jointNumber; |
|
|
|
|
|
|
|
|
retval = Robot::joints; |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
return retval; |
|
|
return retval; |
|
|
} |
|
|
} |
|
@ -346,9 +346,9 @@ int SvrData::setSampleTimeMs(float newSampleTimeMs) |
|
|
return retval; |
|
|
return retval; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
class Trajectory<jointNumber>* SvrData::popTrajectory() |
|
|
|
|
|
|
|
|
class Trajectory<Robot::joints>* SvrData::popTrajectory() |
|
|
{ |
|
|
{ |
|
|
class Trajectory<jointNumber>* retval = NULL; |
|
|
|
|
|
|
|
|
class Trajectory<Robot::joints>* retval = NULL; |
|
|
pthread_mutex_lock(&dataLock); |
|
|
pthread_mutex_lock(&dataLock); |
|
|
if (!trajectory.list.empty() ) |
|
|
if (!trajectory.list.empty() ) |
|
|
{ |
|
|
{ |
|
@ -363,7 +363,7 @@ class Trajectory<jointNumber>* SvrData::popTrajectory() |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
return retval; |
|
|
return retval; |
|
|
} |
|
|
} |
|
|
int SvrData::pushTrajectory(class Trajectory<jointNumber>* newTrajectory) |
|
|
|
|
|
|
|
|
int SvrData::pushTrajectory(class Trajectory<Robot::joints>* newTrajectory) |
|
|
{ |
|
|
{ |
|
|
if (newTrajectory == NULL) |
|
|
if (newTrajectory == NULL) |
|
|
return -1; |
|
|
return -1; |
|
@ -392,7 +392,7 @@ bool SvrData::cancelCurrentTrajectory() |
|
|
// clear trajectory list
|
|
|
// clear trajectory list
|
|
|
while(!trajectory.list.empty()) |
|
|
while(!trajectory.list.empty()) |
|
|
{ |
|
|
{ |
|
|
class Trajectory<jointNumber>* currentTrajectory = trajectory.list.front(); |
|
|
|
|
|
|
|
|
class Trajectory<Robot::joints>* currentTrajectory = trajectory.list.front(); |
|
|
if(currentTrajectory != NULL) |
|
|
if(currentTrajectory != NULL) |
|
|
delete currentTrajectory; |
|
|
delete currentTrajectory; |
|
|
trajectory.list.pop(); |
|
|
trajectory.list.pop(); |
|
@ -445,11 +445,11 @@ void SvrData::setTrajectoryType(enum TrajectoryType newType) |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
pthread_mutex_unlock(&dataLock); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
class Trajectory<jointNumber>* SvrData::createTrajectory(VecJoint newJointPos) |
|
|
|
|
|
|
|
|
class Trajectory<Robot::joints>* SvrData::createTrajectory(VecJoint newJointPos) |
|
|
{ |
|
|
{ |
|
|
//set new target for next trajectory
|
|
|
//set new target for next trajectory
|
|
|
VecJoint prevJointPos = getCommandedJointPos(); |
|
|
VecJoint prevJointPos = getCommandedJointPos(); |
|
|
class Trajectory<jointNumber>* newTrajectory; |
|
|
|
|
|
|
|
|
class Trajectory<Robot::joints>* newTrajectory; |
|
|
|
|
|
|
|
|
float sampleTimeMs = getSampleTimeMs(); |
|
|
float sampleTimeMs = getSampleTimeMs(); |
|
|
VecJoint maxJointVelocity = getRobotVelocity(); |
|
|
VecJoint maxJointVelocity = getRobotVelocity(); |
|
@ -457,11 +457,11 @@ class Trajectory<jointNumber>* SvrData::createTrajectory(VecJoint newJointPos) |
|
|
enum TrajectoryType type = getTrajectoryType(); |
|
|
enum TrajectoryType type = getTrajectoryType(); |
|
|
|
|
|
|
|
|
//newTrajectory = SvrData::getInstance()->createTrajectory(newJointPos);
|
|
|
//newTrajectory = SvrData::getInstance()->createTrajectory(newJointPos);
|
|
|
newTrajectory = Trajectory<jointNumber>::GetTrajectory(type,sampleTimeMs, maxJointVelocity, maxJointAcceleration, prevJointPos, newJointPos); |
|
|
|
|
|
|
|
|
newTrajectory = Trajectory<Robot::joints>::GetTrajectory(type,sampleTimeMs, maxJointVelocity, maxJointAcceleration, prevJointPos, newJointPos); |
|
|
|
|
|
|
|
|
return newTrajectory; |
|
|
return newTrajectory; |
|
|
} |
|
|
} |
|
|
class Trajectory<jointNumber>* SvrData::createTrajectory(MatCarthesian newJointPos) |
|
|
|
|
|
|
|
|
class Trajectory<Robot::joints>* SvrData::createTrajectory(MatCarthesian newJointPos) |
|
|
{ |
|
|
{ |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|