3 #include <VirtualRobot/VirtualRobot.h>
8 #include <RobotAPI/interface/units/RobotUnit/NJointCartesianWaypointController.h>
22 public NJointCartesianWaypointControllerInterface
25 using ConfigPtrT = NJointCartesianWaypointControllerConfigPtr;
27 const NJointCartesianWaypointControllerConfigPtr& config,
31 std::string
getClassName(
const Ice::Current& = Ice::emptyCurrent)
const override;
58 void setConfig(
const NJointCartesianWaypointControllerRuntimeConfig& cfg,
59 const Ice::Current& = Ice::emptyCurrent)
override;
60 void setWaypoints(
const std::vector<Eigen::Matrix4f>& wps,
61 const Ice::Current& = Ice::emptyCurrent)
override;
63 const Ice::Current& = Ice::emptyCurrent)
override;
65 const Ice::Current& = Ice::emptyCurrent)
override;
67 const std::vector<Eigen::Matrix4f>& wps,
68 const Ice::Current& = Ice::emptyCurrent)
override;
71 const Ice::Current& = Ice::emptyCurrent)
override;
72 void stopMovement(
const Ice::Current& = Ice::emptyCurrent)
override;
74 FTSensorValue
getFTSensorValue(
const Ice::Current& = Ice::emptyCurrent)
override;
78 const Ice::Current& = Ice::emptyCurrent)
override;
89 std::vector<Eigen::Matrix4f> wps;
90 NJointCartesianWaypointControllerRuntimeConfig cfg;
91 float skipRad2mmFactor = 500;
92 bool wpsUpdated =
false;
93 bool cfgUpdated =
false;
94 bool skipToClosestWaypoint =
true;
104 Eigen::Vector3f ftUsed = Eigen::Vector3f::Zero();
109 void setNullVelocity();
111 using Ctrl = CartesianWaypointController;
115 VirtualRobot::RobotNodeSetPtr _rtRns;
116 VirtualRobot::RobotNodePtr _rtTcp;
117 VirtualRobot::RobotNodePtr _rtFT;
118 VirtualRobot::RobotNodePtr _rtRobotRoot;
120 std::unique_ptr<Ctrl> _rtWpController;
121 Eigen::VectorXf _rtJointVelocityFeedbackBuffer;
123 std::vector<const float*> _rtVelSensors;
124 std::vector<float*> _rtVelTargets;
126 const Eigen::Vector3f* _rtForceSensor =
nullptr;
127 const Eigen::Vector3f* _rtTorqueSensor =
nullptr;
129 Eigen::Vector3f _rtForceOffset;
131 float _rtForceThreshold = -1;
132 bool _rtOptimizeNullspaceIfTargetWasReached =
false;
133 bool _rtForceThresholdInRobotRootZ =
true;
134 bool _rtHasWps =
false;
135 bool _rtStopConditionReached =
false;
138 std::atomic_bool _publishIsAtTarget{
false};
139 std::atomic_bool _publishIsAtForceLimit{
false};
140 std::atomic_bool _setFTOffset{
false};
143 mutable std::recursive_mutex _tripBufWpCtrlMut;
144 WriteBufferedTripleBuffer<CtrlData> _tripBufWpCtrl;
146 mutable std::recursive_mutex _tripRt2NonRtMutex;
147 TripleBuffer<RtToNonRtData> _tripRt2NonRt;
149 TripleBuffer<Eigen::Matrix4f> _tripRt2NonRtRobotGP;
152 std::atomic_size_t _publishWpsNum{0};
153 std::atomic_size_t _publishWpsCur{0};
154 std::atomic<float> _publishErrorPos{0};
155 std::atomic<float> _publishErrorOri{0};
156 std::atomic<float> _publishErrorPosMax{0};
157 std::atomic<float> _publishErrorOriMax{0};
158 std::atomic<float> _publishForceThreshold{0};
159 std::atomic<float> _publishForceCurrent{0};
160 std::atomic_bool _publishForceThresholdInRobotRootZ{0};