Go to the documentation of this file.
5 #include <VirtualRobot/VirtualRobot.h>
8 #include <dmp/representation/dmp/umitsmp.h>
21 #include <armarx/control/deprecated_njoint_mp_controller/task_space/ControllerInterface.h>
25 class SensorValue1DoFActuatorTorque;
26 class SensorValue1DoFActuatorVelocity;
27 class SensorValue1DoFActuatorPosition;
28 class ControlTarget1DoFActuatorTorque;
29 class SensorValueForceTorque;
39 using ViaPoint = std::pair<double, DMP::DVec>;
72 float derivative = (error - lastError) /
dt;
73 float retVal = Kp * error + Kd * derivative;
80 using ConfigPtrT = NJointTaskSpaceDMPControllerConfigPtr;
82 const NJointControllerConfigPtr& config,
86 std::string
getClassName(
const Ice::Current&)
const override;
94 void learnDMPFromFiles(
const Ice::StringSeq& fileNames,
const Ice::Current&)
override;
102 void runDMP(
const Ice::DoubleSeq& goals,
Ice::Double tau,
const Ice::Current&)
override;
105 const Ice::Current&)
override;
112 void setGoals(
const Ice::DoubleSeq& goals,
const Ice::Current&)
override;
116 const Ice::Current&)
override;
117 void setTorqueKp(
const StringFloatDictionary& torqueKp,
const Ice::Current&)
override;
119 const Ice::Current&)
override;
122 void pauseDMP(
const Ice::Current&)
override;
123 void resumeDMP(
const Ice::Current&)
override;
125 void resetDMP(
const Ice::Current&)
override;
126 void stopDMP(
const Ice::Current&)
override;
131 return dmpCtrl->canVal;
136 const Ice::Current&)
override;
139 Eigen::VectorXf
calcIK(
const Eigen::VectorXf& cartesianVel,
140 const Eigen::VectorXf& nullspace,
144 void setMPWeights(
const DoubleSeqSeq& weights,
const Ice::Current&)
override;
145 DoubleSeqSeq
getMPWeights(
const Ice::Current&)
override;
166 std::vector<std::string> jointNames;
168 struct DebugBufferData
170 StringFloatDictionary latestTargetVelocities;
171 StringFloatDictionary dmpTargets;
172 StringFloatDictionary currentPose;
173 double currentCanVal;
186 Eigen::VectorXf targetJointVels;
191 struct RTToControllerData
196 Eigen::VectorXf currentTwist;
206 TripleBuffer<RTToUserData> rt2UserData;
211 std::vector<const SensorValue1DoFActuatorTorque*> torqueSensors;
212 std::vector<const SensorValue1DoFGravityTorque*> gravityTorqueSensors;
213 std::vector<ControlTarget1DoFActuatorVelocity*> targets;
214 std::vector<const SensorValue1DoFActuatorVelocity*> velocitySensors;
215 std::vector<const SensorValue1DoFActuatorPosition*> positionSensors;
218 std::vector<pidController> torquePIDs;
220 std::string nodeSetName;
226 VirtualRobot::DifferentialIKPtr ik;
227 VirtualRobot::RobotNodePtr tcp;
228 VirtualRobot::RobotNodePtr refFrame;
232 NJointTaskSpaceDMPControllerConfigPtr cfg;
237 std::string debugName;
239 Eigen::VectorXf filtered_qvel;
240 Eigen::Vector3f filtered_position;
241 float vel_filter_factor;
242 float pos_filter_factor;
250 Eigen::VectorXf jointHighLimits;
251 Eigen::VectorXf jointLowLimits;
std::vector< ViaPoint > ViaPointsSet
virtual void onPublish(const SensorAndControl &, const DebugDrawerInterfacePrx &, const DebugObserverInterfacePrx &) override
void onInitNJointController() override
const VariantTypeId Float
void rtRun(const IceUtil::Time &sensorValuesTimestamp, const IceUtil::Time &timeSinceLastIteration) override
TODO make protected and use attorneys.
std::vector< float > torqueKp
void runDMPWithTime(const Ice::DoubleSeq &goals, Ice::Double timeDuration, const Ice::Current &) override
void setLinearVelocityKd(Ice::Float kd, const Ice::Current &=Ice::emptyCurrent) override
void setAngularVelocityKp(Ice::Float kp, const Ice::Current &=Ice::emptyCurrent) override
void setTorqueKp(const StringFloatDictionary &torqueKp, const Ice::Current &) override
MatrixXX< 4, 4, float > Matrix4f
void setViaPoints(Ice::Double u, const Ice::DoubleSeq &viapoint, const Ice::Current &) override
std::string getClassName(const Ice::Current &) const override
void onDisconnectNJointController() override
Eigen::VectorXf calcIK(const Eigen::VectorXf &cartesianVel, const Eigen::VectorXf &nullspace, VirtualRobot::IKSolver::CartesianSelection mode)
double getCanVal(const Ice::Current &) override
Eigen::Vector6f targetTSVel
DoubleSeqSeq getMPWeights()
NJointControllerConfigPtr ConfigPtrT
void rtPostDeactivateController() override
This function is called after the controller is deactivated.
std::pair< double, DMP::DVec > ViaPoint
std::vector< float > nullspaceJointVelocities
IceUtil::Handle< PeriodicTask< T > > pointer_type
Shared pointer type for convenience.
std::shared_ptr< CartesianVelocityController > CartesianVelocityControllerPtr
const VariantTypeId Double
void learnDMPFromFiles(const Ice::StringSeq &fileNames, const Ice::Current &) override
void rtPreActivateController() override
This function is called before the controller is activated.
void setLinearVelocityKp(Ice::Float kp, const Ice::Current &=Ice::emptyCurrent) override
VirtualRobot::IKSolver::CartesianSelection ModeFromIce(const NJointTaskSpaceDMPControllerMode::CartesianSelection mode)
void setMPWeights(const DoubleSeqSeq &weights, const Ice::Current &) override
std::vector< double > createDMPFromString(const std::string &dmpString, const Ice::Current &) override
armarx::core::time::DateTime Time
bool update(mongocxx::collection &coll, const nlohmann::json &query, const nlohmann::json &update)
void setAngularVelocityKd(Ice::Float kd, const Ice::Current &=Ice::emptyCurrent) override
NJointTSDMPController(const RobotUnitPtr &, const NJointControllerConfigPtr &config, const VirtualRobot::RobotPtr &)
void setSpeed(Ice::Double times, const Ice::Current &) override
std::vector< float > torqueKd
std::shared_ptr< TaskSpaceDMPController > TaskSpaceDMPControllerPtr
bool isFinished(const Ice::Current &) override
Eigen::Matrix4f targetPose
std::recursive_mutex MutexType
TYPEDEF_PTRS_HANDLE(DeprecatedNJointPeriodicTSDMPCompliantController)
VirtualRobot::IKSolver::CartesianSelection mode
The NJointTSDMPController class.
void setControllerTarget(Ice::Float avoidJointLimitsKp, NJointTaskSpaceDMPControllerMode::CartesianSelection mode, const Ice::Current &) override
void setNullspaceJointVelocities(const StringFloatDictionary &nullspaceJointVelocities, const Ice::Current &) override
This file offers overloads of toIce() and fromIce() functions for STL container types.
void setGoals(const Ice::DoubleSeq &goals, const Ice::Current &) override
void runDMP(const Ice::DoubleSeq &goals, Ice::Double tau, const Ice::Current &) override
std::shared_ptr< class Robot > RobotPtr
void removeAllViaPoints()