19 #ifndef OBSERVER_THREAD
20 #define OBSERVER_THREAD
22 #include <yarp/os/all.h>
23 #include <yarp/sig/all.h>
24 #include <yarp/dev/all.h>
36 using namespace yarp::os;
37 using namespace yarp::sig;
38 using namespace yarp::math;
76 bool iCub_not_moving{};
87 inertial_w0.resize(3); inertial_w0.zero();
88 inertial_dw0.resize(3); inertial_dw0.zero();
89 inertial_d2p0.resize(3); inertial_d2p0.zero();
90 all_q_up.resize(3+7+7); all_q_up.zero();
91 all_dq_up.resize(3+7+7); all_dq_up.zero();
92 all_d2q_up.resize(3+7+7); all_d2q_up.zero();
93 all_q_low.resize(3+6+6); all_q_low.zero();
94 all_dq_low.resize(3+6+6); all_dq_low.zero();
95 all_d2q_low.resize(3+6+6); all_d2q_low.zero();
96 ft_arm_left.resize(6); ft_arm_left.zero();
97 ft_arm_right.resize(6); ft_arm_right.zero();
98 ft_leg_left.resize(6); ft_leg_left.zero();
99 ft_leg_right.resize(6); ft_leg_right.zero();
100 ft_foot_left.resize(6); ft_foot_left.zero();
101 ft_foot_right.resize(6); ft_foot_right.zero();
123 bool checkIcubNotMoving();
150 IEncoders *iencs_arm_left;
151 IEncoders *iencs_arm_right;
152 IEncoders *iencs_head;
153 IInteractionMode *iint_arm_left;
154 IInteractionMode *iint_arm_right;
155 IInteractionMode *iint_head;
156 IControlMode *icmd_arm_left;
157 IControlMode *icmd_arm_right;
158 IControlMode *icmd_head;
159 ISixAxisForceTorqueSensors* m_left_arm_FT{
nullptr};
160 ISixAxisForceTorqueSensors* m_right_arm_FT{
nullptr};
161 ISixAxisForceTorqueSensors* m_left_leg_FT{
nullptr};
162 ISixAxisForceTorqueSensors* m_right_leg_FT{
nullptr};
168 IEncoders *iencs_leg_left;
169 IEncoders *iencs_leg_right;
170 IEncoders *iencs_torso;
171 IInteractionMode *iint_leg_left;
172 IInteractionMode *iint_leg_right;
173 IInteractionMode *iint_torso;
174 IControlMode *icmd_leg_left;
175 IControlMode *icmd_leg_right;
176 IControlMode *icmd_torso;
180 const long double zero_sens_tolerance;
181 double skinContactsTimestamp;
184 BufferedPort<Vector> *port_inertial_thread;
185 BufferedPort<iCub::skinDynLib::skinContactList> *port_skin_contacts;
188 BufferedPort<Bottle> *port_RATorques;
189 BufferedPort<Bottle> *port_RLTorques;
190 BufferedPort<Bottle> *port_RWTorques;
191 BufferedPort<Bottle> *port_LATorques;
192 BufferedPort<Bottle> *port_LLTorques;
193 BufferedPort<Bottle> *port_LWTorques;
194 BufferedPort<Bottle> *port_TOTorques;
195 BufferedPort<Bottle> *port_HDTorques;
196 BufferedPort<Vector> *port_external_wrench_RA;
197 BufferedPort<Vector> *port_external_wrench_LA;
198 BufferedPort<Vector> *port_external_wrench_RL;
199 BufferedPort<Vector> *port_external_wrench_LL;
200 BufferedPort<Vector> *port_external_wrench_RF;
201 BufferedPort<Vector> *port_external_wrench_LF;
202 BufferedPort<Vector> *port_external_cartesian_wrench_RA;
203 BufferedPort<Vector> *port_external_cartesian_wrench_LA;
204 BufferedPort<Vector> *port_external_cartesian_wrench_RL;
205 BufferedPort<Vector> *port_external_cartesian_wrench_LL;
206 BufferedPort<Vector> *port_external_cartesian_wrench_RF;
207 BufferedPort<Vector> *port_external_cartesian_wrench_LF;
208 BufferedPort<Vector> *port_sensor_wrench_RL;
209 BufferedPort<Vector> *port_sensor_wrench_LL;
210 BufferedPort<Vector> *port_model_wrench_RL;
211 BufferedPort<Vector> *port_model_wrench_LL;
212 BufferedPort<Vector> *port_external_wrench_TO;
213 BufferedPort<Vector> *port_com_all;
214 BufferedPort<Vector> *port_com_all_foot;
215 BufferedPort<Vector> *port_com_lb;
216 BufferedPort<Vector> *port_com_ub;
217 BufferedPort<Vector> *port_com_la;
218 BufferedPort<Vector> *port_com_ra;
219 BufferedPort<Vector> *port_com_ll;
220 BufferedPort<Vector> *port_com_rl;
221 BufferedPort<Vector> *port_com_hd;
222 BufferedPort<Vector> *port_com_to;
223 BufferedPort<Vector> *port_monitor;
224 BufferedPort<iCub::skinDynLib::skinContactList> *port_contacts;
225 BufferedPort<Vector> *port_dumpvel;
226 BufferedPort<Vector> *port_COM_vel;
227 BufferedPort<Matrix> *port_COM_Jacobian;
228 BufferedPort<Vector> *port_all_velocities;
229 BufferedPort<Vector> *port_all_positions;
230 BufferedPort<Matrix> *port_root_position_mat;
231 BufferedPort<Vector> *port_root_position_vec;
234 BufferedPort<Vector> *port_external_ft_arm_left;
235 BufferedPort<Vector> *port_external_ft_arm_right;
236 BufferedPort<Vector> *port_external_ft_leg_left;
237 BufferedPort<Vector> *port_external_ft_leg_right;
238 yarp::os::Stamp timestamp;
255 size_t status_queue_size;
256 list<iCubStatus> previous_status;
257 list<iCubStatus> not_moving_status;
259 Vector encoders_arm_left;
260 Vector encoders_arm_right;
261 Vector encoders_head;
263 Vector encoders_leg_left;
264 Vector encoders_leg_right;
265 Vector encoders_torso;
268 Vector F_LArm, F_RArm;
269 Vector F_iDyn_LArm, F_iDyn_RArm, Offset_LArm, Offset_RArm;
270 Vector F_ext_left_arm, F_ext_right_arm, F_ext_torso;
271 Vector F_ext_cartesian_left_arm, F_ext_cartesian_right_arm;
272 Vector F_ext_left_leg, F_ext_right_leg;
273 Vector F_ext_left_foot, F_ext_right_foot;
274 Vector F_sns_left_leg, F_sns_right_leg;
275 Vector F_mdl_left_leg, F_mdl_right_leg;
276 Vector F_ext_cartesian_left_leg, F_ext_cartesian_right_leg;
277 Vector F_ext_cartesian_left_foot, F_ext_cartesian_right_foot;
278 Vector F_LLeg, F_RLeg;
279 Vector F_LFoot, F_RFoot;
280 Vector F_iDyn_LLeg, F_iDyn_RLeg, Offset_LLeg, Offset_RLeg;
281 Vector F_iDyn_LFoot, F_iDyn_RFoot, Offset_LFoot, Offset_RFoot;
282 Matrix F_sens_up, F_sens_low, F_ext_up, F_ext_low;
283 Vector F_ext_sens_right_arm, F_ext_sens_left_arm;
284 Vector F_ext_sens_right_leg, F_ext_sens_left_leg;
292 Matrix FM_sens_up,FM_sens_low;
297 Vector evalVelUp(
const Vector &
x);
298 Vector evalVelLow(
const Vector &
x);
299 Vector eval_domega(
const Vector &
x);
300 Vector evalAccUp(
const Vector &
x);
301 Vector evalAccLow(
const Vector &
x);
305 void setUpperMeasure(
bool _init=
false);
306 void setLowerMeasure(
bool _init=
false);
308 void addSkinContacts();
312 PolyDriver *_ddH, PolyDriver *_ddLL, PolyDriver *_ddLR,
313 PolyDriver *_ddT,
string _robot_name,
string _local_name,
315 ISixAxisForceTorqueSensors* m_left_arm_FT =
nullptr,
316 ISixAxisForceTorqueSensors* m_right_arm_FT =
nullptr,
317 ISixAxisForceTorqueSensors* m_left_leg_FT =
nullptr,
318 ISixAxisForceTorqueSensors* m_right_leg_FT =
nullptr);
319 bool threadInit()
override;
323 return thread_status;
327 void threadRelease()
override;
328 void closePort(Contactable *_port);
329 void writeTorque(Vector _values,
int _address, BufferedPort<Bottle> *_port);
330 template <
class T>
void broadcastData(
T& _values, BufferedPort<T> *_port);
332 bool readAndUpdate(
bool waitMeasure=
false,
bool _init=
false);
333 bool getLowerEncodersSpeedAndAcceleration();
334 bool getUpperEncodersSpeedAndAcceleration();
335 void setZeroJntAngVelAcc();
336 void sendMonitorData();
337 void sendVelAccData();
Adaptive window linear fitting to estimate the first derivative.
Adaptive window quadratic fitting to estimate the second derivative.
A class for connecting UpperTorso and LowerTorso of the iCub, then getting the WholeBody in the dynam...
thread_status_enum getThreadStatus()
double lpf_ord1_3hz(double input, int j)
constexpr int8_t MAX_FILTER_ORDER
constexpr float_t SKIN_EVENTS_TIMEOUT