5 #include <VirtualRobot/Robot.h>
6 #include <VirtualRobot/IK/DifferentialIK.h>
14 #include <dmp/representation/dmp/umitsmp.h>
16 #include <armarx/control/deprecated_njoint_mp_controller/task_space/ControllerInterface.h>
27 using ViaPoint = std::pair<double, DMP::DVec >;
57 float derivative = (error - lastError) /
dt;
58 float retVal = Kp * error + Kd * derivative;
64 using ConfigPtrT = DeprecatedNJointTaskSpaceDMPControllerConfigPtr;
68 std::string
getClassName(
const Ice::Current&)
const override;
75 void learnDMPFromFiles(
const Ice::StringSeq& fileNames,
const Ice::Current&)
override;
81 void runDMP(
const Ice::DoubleSeq& goals,
Ice::Double tau,
const Ice::Current&)
override;
88 void setGoals(
const Ice::DoubleSeq& goals,
const Ice::Current&)
override;
91 void setTorqueKp(
const StringFloatDictionary& torqueKp,
const Ice::Current&)
override;
95 void pauseDMP(
const Ice::Current&)
override;
96 void resumeDMP(
const Ice::Current&)
override;
98 void resetDMP(
const Ice::Current&)
override;
99 void stopDMP(
const Ice::Current&)
override;
107 return dmpCtrl->canVal;
110 std::vector<double>
createDMPFromString(
const std::string& dmpString,
const Ice::Current&)
override;
116 void setMPWeights(
const DoubleSeqSeq& weights,
const Ice::Current&)
override;
117 DoubleSeqSeq
getMPWeights(
const Ice::Current&)
override;
130 useForceStop =
false;
149 std::vector<std::string> jointNames;
150 struct DebugBufferData
152 StringFloatDictionary latestTargetVelocities;
153 StringFloatDictionary dmpTargets;
154 StringFloatDictionary currentPose;
155 double currentCanVal;
169 Eigen::VectorXf targetJointVels;
175 struct RTToControllerData
180 Eigen::VectorXf currentTwist;
189 TripleBuffer<RTToUserData> rt2UserData;
194 std::vector<const SensorValue1DoFActuatorTorque*> torqueSensors;
195 std::vector<const SensorValue1DoFGravityTorque*> gravityTorqueSensors;
196 std::vector<ControlTarget1DoFActuatorVelocity*> targets;
197 std::vector<const SensorValue1DoFActuatorVelocity*> velocitySensors;
198 std::vector<const SensorValue1DoFActuatorPosition*> positionSensors;
201 std::vector<pidController> torquePIDs;
203 std::string nodeSetName;
209 VirtualRobot::DifferentialIKPtr ik;
210 VirtualRobot::RobotNodePtr tcp;
211 VirtualRobot::RobotNodePtr refFrame;
215 DeprecatedNJointTaskSpaceDMPControllerConfigPtr cfg;
220 std::string debugName;
222 Eigen::VectorXf filtered_qvel;
223 Eigen::Vector3f filtered_position;
224 float vel_filter_factor;
225 float pos_filter_factor;
233 Eigen::VectorXf jointHighLimits;
234 Eigen::VectorXf jointLowLimits;
236 Eigen::Vector3f filteredForce;
237 Eigen::Vector3f forceOffset;
238 Eigen::Vector3f filteredForceInRoot;
239 WriteBufferedTripleBuffer<Eigen::Vector3f> forceThreshold;
240 std::atomic<bool> useForceStop;
241 const SensorValueForceTorque* forceSensor;
243 std::atomic<float> timeForCalibration;
244 std::atomic_bool stopped =
false;