3 #include <VirtualRobot/VirtualRobot.h>
13 #include <armarx/control/deprecated_njoint_mp_controller/bimanual/ControllerInterface.h>
17 class SensorValue1DoFActuatorTorque;
18 class SensorValue1DoFActuatorVelocity;
19 class SensorValue1DoFActuatorPosition;
20 class SensorValue1DoFActuatorAcceleration;
21 class ControlTarget1DoFActuatorVelocity;
22 class ControlTarget1DoFActuatorTorque;
23 class SensorValueForceTorque;
39 using ViaPoint = std::pair<double, DMP::DVec>;
66 using ConfigPtrT = NJointBimanualCCDMPVelocityControllerConfigPtr;
68 const NJointControllerConfigPtr& config,
72 std::string
getClassName(
const Ice::Current&)
const override;
81 learnDMPFromFiles(
const std::string&,
const Ice::StringSeq&,
const Ice::Current&)
override;
83 const Ice::StringSeq&,
84 const Ice::Current&)
override;
88 void setRatios(
const Ice::DoubleSeq& ratios,
const Ice::Current&)
override;
90 void runDMP(
const Ice::DoubleSeq& leftGoals,
91 const Ice::DoubleSeq& rightGoals,
92 const Ice::Current&)
override;
95 void setGoals(
const Ice::DoubleSeq& goals,
const Ice::Current&)
override;
113 Eigen::VectorXf getControlWrench(
const Eigen::VectorXf& twist,
119 Eigen::Matrix4f getLocalPose(
const std::vector<double>& newCoordinateVec,
120 const std::vector<double>& globalTargetPoseVec);
122 struct DebugBufferData
124 StringFloatDictionary desired_velocities;
125 StringFloatDictionary constrained_force;
126 float leftTargetPose_x;
127 float leftTargetPose_y;
128 float leftTargetPose_z;
129 float rightTargetPose_x;
130 float rightTargetPose_y;
131 float rightTargetPose_z;
133 float leftCurrentPose_x;
134 float leftCurrentPose_y;
135 float leftCurrentPose_z;
136 float rightCurrentPose_x;
137 float rightCurrentPose_y;
138 float rightCurrentPose_z;
140 float leftControlSignal_x;
141 float leftControlSignal_y;
142 float leftControlSignal_z;
143 float leftControlSignal_ro;
144 float leftControlSignal_pi;
145 float leftControlSignal_ya;
147 float rightControlSignal_x;
148 float rightControlSignal_y;
149 float rightControlSignal_z;
150 float rightControlSignal_ro;
151 float rightControlSignal_pi;
152 float rightControlSignal_ya;
160 struct NJointBimanualCCDMPVelocityControllerSensorData
166 Eigen::VectorXf currentLeftTwist;
167 Eigen::VectorXf currentRightTwist;
172 struct NJointBimanualCCDMPVelocityControllerInterfaceData
177 Eigen::VectorXf currentLeftJointVals;
178 Eigen::VectorXf currentRightJointVals;
184 std::vector<ControlTarget1DoFActuatorVelocity*> leftTargets;
185 std::vector<const SensorValue1DoFActuatorAcceleration*> leftAccelerationSensors;
186 std::vector<const SensorValue1DoFActuatorVelocity*> leftVelocitySensors;
187 std::vector<const SensorValue1DoFActuatorPosition*> leftPositionSensors;
189 std::vector<ControlTarget1DoFActuatorVelocity*> rightTargets;
190 std::vector<const SensorValue1DoFActuatorAcceleration*> rightAccelerationSensors;
191 std::vector<const SensorValue1DoFActuatorVelocity*> rightVelocitySensors;
192 std::vector<const SensorValue1DoFActuatorPosition*> rightPositionSensors;
197 NJointBimanualCCDMPVelocityControllerConfigPtr cfg;
198 VirtualRobot::DifferentialIKPtr leftIK;
199 VirtualRobot::DifferentialIKPtr rightIK;
201 std::vector<tsvmp::TaskSpaceDMPControllerPtr> leftGroup;
202 std::vector<tsvmp::TaskSpaceDMPControllerPtr> rightGroup;
203 std::vector<tsvmp::TaskSpaceDMPControllerPtr> bothLeaderGroup;
206 bool isLeftJointLearned;
207 bool isRightJointLearned;
210 std::string leaderName;
212 VirtualRobot::RobotNodePtr tcpLeft;
213 VirtualRobot::RobotNodePtr tcpRight;
220 Eigen::VectorXf leftDesiredJointValues;
221 Eigen::VectorXf rightDesiredJointValues;
223 Eigen::Vector3f leftKpos;
224 Eigen::Vector3f leftKori;
225 Eigen::Vector3f leftDpos;
226 Eigen::Vector3f leftDori;
228 Eigen::Vector3f rightKpos;
229 Eigen::Vector3f rightKori;
230 Eigen::Vector3f rightDpos;
231 Eigen::Vector3f rightDori;
237 std::vector<std::string> leftJointNames;
238 std::vector<std::string> rightJointNames;
241 VirtualRobot::RobotNodeSetPtr leftRNS;
242 VirtualRobot::RobotNodeSetPtr rightRNS;
244 Eigen::VectorXf leftNullSpaceCoefs;
245 Eigen::VectorXf rightNullSpaceCoefs;
257 DMP::Vec<DMP::DMPState> currentLeftJointState;
258 DMP::Vec<DMP::DMPState> currentRightJointState;