3 #include <dmp/representation/dmp/umidmp.h>
10 #include <armarx/control/deprecated_njoint_mp_controller/task_space/TaskSpaceImpedanceDMPControllerInterface.h>
15 class SensorValueForceTorque;
17 class ControlTarget1DoFActuatorTorque;
20 namespace control::deprecated_njoint_mp_controller::tsvmp
55 using ConfigPtrT = NJointTaskSpaceImpedanceDMPControllerConfigPtr;
59 std::string
getClassName(
const Ice::Current&)
const override;
66 void learnDMPFromFiles(
const Ice::StringSeq& fileNames,
const Ice::Current&)
override;
78 void setGoals(
const Ice::DoubleSeq& goals,
const Ice::Current&)
override;
80 void learnJointDMPFromFiles(
const std::string& fileName,
const Ice::FloatSeq& currentJVS,
const Ice::Current&)
override;
81 void runDMP(
const Ice::DoubleSeq& goals,
const Ice::Current& iceCurrent = Ice::emptyCurrent)
override;
86 void stopDMP(
const Ice::Current&)
override;
87 void resumeDMP(
const Ice::Current&)
override;
88 void resetDMP(
const Ice::Current&)
override;
90 void setMPWeights(
const DoubleSeqSeq& weights,
const Ice::Current&)
override;
110 useForceStop =
false;
126 struct DebugBufferData
128 double currentCanVal;
141 float currentPose_qw;
142 float currentPose_qx;
143 float currentPose_qy;
144 float currentPose_qz;
152 float currentKnull_x;
153 float currentKnull_y;
154 float currentKnull_z;
162 float currentDnull_x;
163 float currentDnull_y;
164 float currentDnull_z;
166 StringFloatDictionary desired_torques;
167 StringFloatDictionary desired_nullspaceJoint;
168 float forceDesired_x;
169 float forceDesired_y;
170 float forceDesired_z;
171 float forceDesired_rx;
172 float forceDesired_ry;
173 float forceDesired_rz;
183 struct NJointTaskSpaceImpedanceDMPControllerSensorData
188 Eigen::VectorXf currentTwist;
192 struct NJointTaskSpaceImpedanceDMPControllerInterfaceData
201 Eigen::Vector3f kpos;
202 Eigen::Vector3f dpos;
203 Eigen::Vector3f kori;
204 Eigen::Vector3f dori;
205 Eigen::VectorXf knull;
206 Eigen::VectorXf dnull;
209 WriteBufferedTripleBuffer<CtrlParams> ctrlParams;
213 DMP::Vec<DMP::DMPState> currentJointState;
214 DMP::UMIDMPPtr nullSpaceJointDMPPtr;
218 std::vector<const SensorValue1DoFActuatorTorque*> torqueSensors;
219 std::vector<const SensorValue1DoFActuatorVelocity*> velocitySensors;
220 std::vector<const SensorValue1DoFActuatorPosition*> positionSensors;
221 std::vector<ControlTarget1DoFActuatorTorque*> targets;
227 VirtualRobot::RobotNodeSetPtr rns;
234 double posToOriRatio;
237 NJointTaskSpaceImpedanceDMPControllerConfigPtr cfg;
238 VirtualRobot::DifferentialIKPtr ik;
239 VirtualRobot::RobotNodePtr tcp;
251 std::atomic_bool useNullSpaceJointDMP;
252 bool isNullSpaceJointDMPLearned;
255 WriteBufferedTripleBuffer<Eigen::VectorXf> defaultNullSpaceJointValues;
256 std::vector<std::string> jointNames;
259 std::atomic_bool firstRun;
260 std::atomic_bool started =
false;
261 std::atomic_bool stopped =
false;
262 std::atomic_bool prematurely_stopped =
false;
266 Eigen::Vector3f filteredForce;
267 Eigen::Vector3f forceOffset;
268 Eigen::Vector3f filteredForceInRoot;
269 WriteBufferedTripleBuffer<Eigen::Vector3f> forceThreshold;
270 std::atomic<bool> useForceStop;
271 std::atomic<float> timeForCalibration;
272 const SensorValueForceTorque* forceSensor;