Skip to content
Snippets Groups Projects
Commit d65253d2 authored by Stefan Reither's avatar Stefan Reither
Browse files

add locks

parent da06b6de
No related branches found
No related tags found
1 merge request!32Tcp sub unit
......@@ -113,6 +113,8 @@ bool TrajectoryControllerSubUnit::resetTrajectoryPlayer(bool moveToFrameZeroPose
void TrajectoryControllerSubUnit::loadJointTraj(const TrajectoryBasePtr& jointTraj, const Ice::Current& c)
{
ScopedLock lock(dataMutex);
this->jointTraj = TrajectoryPtr::dynamicCast(jointTraj);
if (!this->jointTraj)
......@@ -157,11 +159,15 @@ double TrajectoryControllerSubUnit::getTrajEndTime(const Ice::Current& c)
double TrajectoryControllerSubUnit::getCurrentTime(const Ice::Current& c)
{
ScopedLock lock(dataMutex);
return jointTrajController->getCurrentTrajTime();
}
void TrajectoryControllerSubUnit::setEndTime(Ice::Double end, const Ice::Current& c)
{
ScopedLock lock(dataMutex);
if (jointTrajController)
{
ARMARX_WARNING << "TrajectoryController already running. Please reset it before setting a new end-time.";
......@@ -186,6 +192,8 @@ void TrajectoryControllerSubUnit::setIsPreview(bool isPreview, const Ice::Curren
bool TrajectoryControllerSubUnit::setJointsInUse(const std::string& jointName, bool isInUse, const Ice::Current& c)
{
ScopedLock lock(dataMutex);
if (isInUse && (std::find(usedJoints.begin(), usedJoints.end(), jointName) == usedJoints.end()))
{
usedJoints.push_back(jointName);
......
......@@ -160,6 +160,8 @@ namespace armarx
float kd;
float maxVelocity;
bool considerConstraintsForTrajectoryOptimization = true;
Mutex dataMutex;
};
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment