diff --git a/include/aikido/control/BarrettHandKinematicSimulationPositionCommandExecutor.hpp b/include/aikido/control/BarrettHandKinematicSimulationPositionCommandExecutor.hpp index c83c477e92..f1f8a4196e 100644 --- a/include/aikido/control/BarrettHandKinematicSimulationPositionCommandExecutor.hpp +++ b/include/aikido/control/BarrettHandKinematicSimulationPositionCommandExecutor.hpp @@ -47,7 +47,11 @@ class BarrettHandKinematicSimulationPositionCommandExecutor /// \return Future which becomes available when the execution completes. std::future execute(const Eigen::VectorXd& goalPositions) override; - // Documentation inherited. + /// \copydoc PositionCommandExecutor::step() + /// + /// If multiple threads are accessing this function or the skeleton associated + /// with this executor, it is necessary to lock the skeleton before + /// calling this method. void step() override; /// Resets CollisionGroup to check collision with fingers. diff --git a/include/aikido/control/KinematicSimulationTrajectoryExecutor.hpp b/include/aikido/control/KinematicSimulationTrajectoryExecutor.hpp index 945129e6d2..b071ffc4ca 100644 --- a/include/aikido/control/KinematicSimulationTrajectoryExecutor.hpp +++ b/include/aikido/control/KinematicSimulationTrajectoryExecutor.hpp @@ -35,7 +35,11 @@ class KinematicSimulationTrajectoryExecutor : public TrajectoryExecutor std::future execute( trajectory::TrajectoryPtr traj) override; - // Documentation inherited. + /// \copydoc PositionCommandExecutor::step() + /// + /// If multiple threads are accessing this function or the skeleton associated + /// with this executor, it is necessary to lock the skeleton before + /// calling this method. void step() override; private: diff --git a/src/control/KinematicSimulationTrajectoryExecutor.cpp b/src/control/KinematicSimulationTrajectoryExecutor.cpp index 2a127d9098..a49777cbf3 100644 --- a/src/control/KinematicSimulationTrajectoryExecutor.cpp +++ b/src/control/KinematicSimulationTrajectoryExecutor.cpp @@ -106,7 +106,8 @@ void KinematicSimulationTrajectoryExecutor::step() } auto timeSinceBeginning = system_clock::now() - mExecutionStartTime; - double t = duration_cast(timeSinceBeginning).count(); + auto tsec = duration_cast>( + timeSinceBeginning).count(); // Can't do static here because MetaSkeletonStateSpace inherits // CartesianProduct which inherits virtual StateSpace @@ -115,15 +116,12 @@ void KinematicSimulationTrajectoryExecutor::step() auto metaSkeleton = space->getMetaSkeleton(); auto state = space->createState(); - mTraj->evaluate(t, state); + mTraj->evaluate(tsec, state); - // Lock the skeleton, set state. - std::unique_lock skeleton_lock(mSkeleton->getMutex()); space->setState(state); - skeleton_lock.unlock(); // Check if trajectory has completed. - bool const is_done = (t >= mTraj->getEndTime()); + bool const is_done = (tsec >= mTraj->getEndTime()); if (is_done) { mTraj.reset(); mPromise->set_value();