4 #include <VirtualRobot/VirtualRobot.h>
13 #include <armarx/control/deprecated_njoint_mp_controller/adaptive/ControllerInterface.h>
17 class SensorValue1DoFActuatorTorque;
18 class SensorValue1DoFActuatorVelocity;
19 class SensorValue1DoFActuatorPosition;
20 class ControlTarget1DoFActuatorTorque;
21 class SensorValueForceTorque;
56 using ConfigPtrT = NJointTaskSpaceAdaptiveDMPControllerConfigPtr;
58 const NJointControllerConfigPtr& config,
79 void setGoals(
const Ice::DoubleSeq& goals,
const Ice::Current&);
82 const Ice::FloatSeq& currentJVS,
84 void runDMP(
const Ice::DoubleSeq& goals,
const Ice::Current&);
91 return dmpCtrl->canVal;
94 void stopDMP(
const Ice::Current&);
98 void setKdImpedance(
const Ice::FloatSeq& dampings,
const Ice::Current&);
99 void setKpImpedance(
const Ice::FloatSeq& stiffness,
const Ice::Current&);
101 void setKdNull(
const Ice::FloatSeq& dnull,
const Ice::Current&);
102 void setKpNull(
const Ice::FloatSeq& knull,
const Ice::Current&);
103 Ice::FloatSeq
getForce(
const Ice::Current&);
105 void setCanVal(
double canVal,
const Ice::Current&);
121 struct DebugBufferData
123 double currentCanVal;
136 float currentPose_qw;
137 float currentPose_qx;
138 float currentPose_qy;
139 float currentPose_qz;
141 StringFloatDictionary desired_torques;
142 StringFloatDictionary desired_nullspaceJoint;
143 float forceDesired_x;
144 float forceDesired_y;
145 float forceDesired_z;
146 float forceDesired_rx;
147 float forceDesired_ry;
148 float forceDesired_rz;
153 float impedanceKp_rx;
154 float impedanceKp_ry;
155 float impedanceKp_rz;
173 struct NJointTaskSpaceAdaptiveDMPControllerSensorData
178 Eigen::VectorXf currentTwist;
183 struct NJointTaskSpaceAdaptiveDMPControllerInterfaceData
186 Eigen::VectorXf currentVel;
187 Eigen::Vector3f currentForce;
192 struct Inferface2rtData
194 Eigen::VectorXf KpImpedance;
195 Eigen::VectorXf KdImpedance;
196 Eigen::VectorXf Knull;
197 Eigen::VectorXf Dnull;
200 TripleBuffer<Inferface2rtData> interface2rtBuffer;
202 struct Interface2CtrlData
207 TripleBuffer<Interface2CtrlData> interface2CtrlBuffer;
210 DMP::Vec<DMP::DMPState> currentJointState;
215 std::vector<const SensorValue1DoFActuatorTorque*> torqueSensors;
216 std::vector<const SensorValue1DoFActuatorVelocity*> velocitySensors;
217 std::vector<const SensorValue1DoFActuatorPosition*> positionSensors;
218 std::vector<ControlTarget1DoFActuatorTorque*> targets;
224 VirtualRobot::RobotNodeSetPtr rns;
231 double posToOriRatio;
234 NJointTaskSpaceAdaptiveDMPControllerConfigPtr cfg;
235 VirtualRobot::DifferentialIKPtr ik;
236 VirtualRobot::RobotNodePtr tcp;
240 Eigen::Vector3f kpos;
241 Eigen::Vector3f kori;
242 Eigen::Vector3f dpos;
243 Eigen::Vector3f dori;
244 Eigen::VectorXf knull;
245 Eigen::VectorXf dnull;
248 bool useNullSpaceJointDMP;
249 bool isNullSpaceJointDMPLearned;
252 Eigen::VectorXf defaultNullSpaceJointValues;
253 std::vector<std::string> jointNames;
257 bool started =
false;
258 bool stopped =
false;
259 Eigen::Vector3f forceOffset;
262 const SensorValueForceTorque* forceSensor;
263 Eigen::Vector3f filteredForce;