4 #include <VirtualRobot/Robot.h>
5 #include <VirtualRobot/IK/DifferentialIK.h>
13 #include <dmp/representation/dmp/umidmp.h>
16 #include <armarx/control/deprecated_njoint_mp_controller/adaptive/ControllerInterface.h>
48 using ConfigPtrT = NJointTaskSpaceAdaptiveDMPControllerConfigPtr;
66 void setGoals(
const Ice::DoubleSeq& goals,
const Ice::Current&);
68 void learnJointDMPFromFiles(
const std::string& fileName,
const Ice::FloatSeq& currentJVS,
const Ice::Current&);
69 void runDMP(
const Ice::DoubleSeq& goals,
const Ice::Current&);
74 return dmpCtrl->canVal;
77 void stopDMP(
const Ice::Current&);
81 void setKdImpedance(
const Ice::FloatSeq& dampings,
const Ice::Current&);
82 void setKpImpedance(
const Ice::FloatSeq& stiffness,
const Ice::Current&);
84 void setKdNull(
const Ice::FloatSeq& dnull,
const Ice::Current&);
85 void setKpNull(
const Ice::FloatSeq& knull,
const Ice::Current&);
86 Ice::FloatSeq
getForce(
const Ice::Current&);
88 void setCanVal(
double canVal,
const Ice::Current&);
101 struct DebugBufferData
103 double currentCanVal;
116 float currentPose_qw;
117 float currentPose_qx;
118 float currentPose_qy;
119 float currentPose_qz;
121 StringFloatDictionary desired_torques;
122 StringFloatDictionary desired_nullspaceJoint;
123 float forceDesired_x;
124 float forceDesired_y;
125 float forceDesired_z;
126 float forceDesired_rx;
127 float forceDesired_ry;
128 float forceDesired_rz;
133 float impedanceKp_rx;
134 float impedanceKp_ry;
135 float impedanceKp_rz;
154 struct NJointTaskSpaceAdaptiveDMPControllerSensorData
159 Eigen::VectorXf currentTwist;
163 struct NJointTaskSpaceAdaptiveDMPControllerInterfaceData
166 Eigen::VectorXf currentVel;
167 Eigen::Vector3f currentForce;
174 struct Inferface2rtData
176 Eigen::VectorXf KpImpedance;
177 Eigen::VectorXf KdImpedance;
178 Eigen::VectorXf Knull;
179 Eigen::VectorXf Dnull;
181 TripleBuffer<Inferface2rtData> interface2rtBuffer;
183 struct Interface2CtrlData
187 TripleBuffer<Interface2CtrlData> interface2CtrlBuffer;
190 DMP::Vec<DMP::DMPState> currentJointState;
191 DMP::UMIDMPPtr nullSpaceJointDMPPtr;
195 std::vector<const SensorValue1DoFActuatorTorque*> torqueSensors;
196 std::vector<const SensorValue1DoFActuatorVelocity*> velocitySensors;
197 std::vector<const SensorValue1DoFActuatorPosition*> positionSensors;
198 std::vector<ControlTarget1DoFActuatorTorque*> targets;
204 VirtualRobot::RobotNodeSetPtr rns;
211 double posToOriRatio;
214 NJointTaskSpaceAdaptiveDMPControllerConfigPtr cfg;
215 VirtualRobot::DifferentialIKPtr ik;
216 VirtualRobot::RobotNodePtr tcp;
220 Eigen::Vector3f kpos;
221 Eigen::Vector3f kori;
222 Eigen::Vector3f dpos;
223 Eigen::Vector3f dori;
224 Eigen::VectorXf knull;
225 Eigen::VectorXf dnull;
228 bool useNullSpaceJointDMP;
229 bool isNullSpaceJointDMPLearned;
232 Eigen::VectorXf defaultNullSpaceJointValues;
233 std::vector<std::string> jointNames;
237 bool started =
false;
238 bool stopped =
false;
239 Eigen::Vector3f forceOffset;
242 const SensorValueForceTorque* forceSensor;
243 Eigen::Vector3f filteredForce;