67 update(
float dt,
float error)
69 float derivative = (error - lastError) /
dt;
70 float retVal = Kp * error + Kd * derivative;
77 using ConfigPtrT = DeprecatedNJointTaskSpaceDMPControllerConfigPtr;
79 const NJointControllerConfigPtr& config,
83 std::string
getClassName(
const Ice::Current&)
const override;
87 void rtRun(
const IceUtil::Time& sensorValuesTimestamp,
88 const IceUtil::Time& timeSinceLastIteration)
override;
91 void learnDMPFromFiles(
const Ice::StringSeq& fileNames,
const Ice::Current&)
override;
99 void runDMP(
const Ice::DoubleSeq& goals, Ice::Double tau,
const Ice::Current&)
override;
101 Ice::Double timeDuration,
102 const Ice::Current&)
override;
104 void setSpeed(Ice::Double times,
const Ice::Current&)
override;
106 setViaPoints(Ice::Double u,
const Ice::DoubleSeq& viapoint,
const Ice::Current&)
override;
109 void setGoals(
const Ice::DoubleSeq& goals,
const Ice::Current&)
override;
113 const Ice::Current&)
override;
114 void setTorqueKp(
const StringFloatDictionary& torqueKp,
const Ice::Current&)
override;
116 const Ice::Current&)
override;
119 void pauseDMP(
const Ice::Current&)
override;
120 void resumeDMP(
const Ice::Current&)
override;
122 void resetDMP(
const Ice::Current&)
override;
123 void stopDMP(
const Ice::Current&)
override;
134 return dmpCtrl->canVal;
139 const Ice::Current&)
override;
142 Eigen::VectorXf
calcIK(
const Eigen::VectorXf& cartesianVel,
143 const Eigen::VectorXf& nullspace,
144 VirtualRobot::IKSolver::CartesianSelection mode);
147 void setMPWeights(
const DoubleSeqSeq& weights,
const Ice::Current&)
override;
148 DoubleSeqSeq
getMPWeights(
const Ice::Current&)
override;
164 useForceStop =
false;
170 forceThreshold.getWriteBuffer() = f;
171 forceThreshold.commitWrite();
177 VirtualRobot::IKSolver::CartesianSelection
188 std::vector<std::string> jointNames;
190 struct DebugBufferData
192 StringFloatDictionary latestTargetVelocities;
193 StringFloatDictionary dmpTargets;
194 StringFloatDictionary currentPose;
195 double currentCanVal;
208 Eigen::VectorXf targetJointVels;
213 struct RTToControllerData
217 Eigen::Matrix4f currentPose;
218 Eigen::VectorXf currentTwist;
225 Eigen::Matrix4f currentTcpPose;
228 TripleBuffer<RTToUserData> rt2UserData;
233 std::vector<const SensorValue1DoFActuatorTorque*> torqueSensors;
234 std::vector<const SensorValue1DoFGravityTorque*> gravityTorqueSensors;
235 std::vector<ControlTarget1DoFActuatorVelocity*> targets;
236 std::vector<const SensorValue1DoFActuatorVelocity*> velocitySensors;
237 std::vector<const SensorValue1DoFActuatorPosition*> positionSensors;
240 std::vector<pidController> torquePIDs;
242 std::string nodeSetName;
248 VirtualRobot::DifferentialIKPtr ik;
249 VirtualRobot::RobotNodePtr tcp;
250 VirtualRobot::RobotNodePtr refFrame;
252 Eigen::Matrix4f targetPose;
254 DeprecatedNJointTaskSpaceDMPControllerConfigPtr cfg;
259 std::string debugName;
261 Eigen::VectorXf filtered_qvel;
262 Eigen::Vector3f filtered_position;
263 float vel_filter_factor;
264 float pos_filter_factor;
272 Eigen::VectorXf jointHighLimits;
273 Eigen::VectorXf jointLowLimits;
275 Eigen::Vector3f filteredForce;
276 Eigen::Vector3f forceOffset;
277 Eigen::Vector3f filteredForceInRoot;
278 WriteBufferedTripleBuffer<Eigen::Vector3f> forceThreshold;
279 std::atomic<bool> useForceStop;
280 const SensorValueForceTorque* forceSensor;
282 std::atomic<float> timeForCalibration;
283 std::atomic_bool stopped =
false;