yarp-devices
Loading...
Searching...
No Matches
TechnosoftIposBase.hpp
1// -*- mode:C++; tab-width:4; c-basic-offset:4; indent-tabs-mode:nil -*-
2
3#ifndef __TECHNOSOFT_IPOS_BASE_HPP__
4#define __TECHNOSOFT_IPOS_BASE_HPP__
5
6#include <cstdint>
7
8#include <atomic>
9#include <bitset>
10#include <memory>
11#include <string>
12
13#include <yarp/conf/numeric.h>
14
15#include <yarp/os/Timer.h>
16
17#include <yarp/dev/DeviceDriver.h>
18#include <yarp/dev/IAxisInfo.h>
19#include <yarp/dev/IControlLimits.h>
20#include <yarp/dev/IControlMode.h>
21#include <yarp/dev/ICurrentControl.h>
22#include <yarp/dev/IEncodersTimed.h>
23#include <yarp/dev/IImpedanceControl.h>
24#include <yarp/dev/IInteractionMode.h>
25#include <yarp/dev/IJointFault.h>
26#include <yarp/dev/IMotor.h>
27#include <yarp/dev/IMotorEncoders.h>
28#include <yarp/dev/IPidControl.h>
29#include <yarp/dev/IPositionControl.h>
30#include <yarp/dev/IPositionDirect.h>
31#include <yarp/dev/IRemoteVariables.h>
32#include <yarp/dev/ITorqueControl.h>
33#include <yarp/dev/IVelocityControl.h>
34#include <yarp/dev/PolyDriver.h>
35
36#include "CanOpenNode.hpp"
37#include "CommandBuffer.hpp"
38#include "EncoderRead.hpp"
39#include "ICanBusSharer.hpp"
40#include "PdoProtocol.hpp"
41#include "StateObserver.hpp"
42
43#include "TechnosoftIpos_ParamsParser.h"
44
45#define CHECK_JOINT(j) do { if (int ax; getAxes(&ax), (j) != ax - 1) return false; } while (0)
46
47#define CHECK_MODE(mode) do { if ((mode) != actualControlMode) return false; } while (0)
48
49namespace roboticslab
50{
51
56class TechnosoftIposBase : public yarp::dev::DeviceDriver,
57 public yarp::dev::IAxisInfoRaw,
58 public yarp::dev::IControlLimitsRaw,
59 public yarp::dev::IControlModeRaw,
60 public yarp::dev::ICurrentControlRaw,
61 public yarp::dev::IEncodersTimedRaw,
62 public yarp::dev::IImpedanceControlRaw,
63 public yarp::dev::IInteractionModeRaw,
64 public yarp::dev::IJointFaultRaw,
65 public yarp::dev::IMotorRaw,
66 public yarp::dev::IMotorEncodersRaw,
67 public yarp::dev::IPidControlRaw,
68 public yarp::dev::IPositionControlRaw,
69 public yarp::dev::IPositionDirectRaw,
70 public yarp::dev::IRemoteVariablesRaw,
71 public yarp::dev::ITorqueControlRaw,
72 public yarp::dev::IVelocityControlRaw,
73 public ICanBusSharer
74{
75public:
76
78 : params(_params)
79 {}
80
81 // --------- DeviceDriver declarations. Implementation in DeviceDriverImpl.cpp ---------
82
83 bool open(yarp::os::Searchable & config) override;
84 bool close() override;
85
86 // --------- ICanBusSharer declarations. Implementation in ICanBusSharerImpl.cpp ---------
87
88 unsigned int getId() override;
89 std::vector<unsigned int> getAdditionalIds() override;
90 bool notifyMessage(const can_message & message) override;
91 bool initialize() override;
92 bool finalize() override;
93 bool registerSender(ICanSenderDelegate * sender) override;
94
95 // --------- IAxisInfoRaw declarations. Implementation in IAxisInfoRawImpl.cpp ---------
96
97 bool getAxisNameRaw(int axis, std::string & name) override;
98 bool getJointTypeRaw(int axis, yarp::dev::JointTypeEnum & type) override;
99
100 // --------- IControlLimitsRaw declarations. Implementation in IControlLimitsRawImpl.cpp ---------
101
102 bool setLimitsRaw(int axis, double min, double max) override;
103 bool getLimitsRaw(int axis, double * min, double * max) override;
104 bool setVelLimitsRaw(int axis, double min, double max) override;
105 bool getVelLimitsRaw(int axis, double * min, double * max) override;
106
107 // --------- IControlModeRaw declarations. Implementation in IControlModeRawImpl.cpp ---------
108
109 bool getControlModesRaw(int * modes) override
110 { return getControlModeRaw(0, &modes[0]); }
111
112 bool getControlModesRaw(int n_joint, const int * joints, int * modes) override
113 { return getControlModeRaw(joints[0], &modes[0]); }
114
115 bool setControlModesRaw(int * modes) override
116 { return setControlModeRaw(0, modes[0]); }
117
118 bool setControlModesRaw(int n_joint, const int * joints, int * modes) override
119 { return setControlModeRaw(joints[0], modes[0]); }
120
121 // --------- ICurrentControlRaw declarations. Implementation in ICurrentControlRawImpl.cpp ---------
122
123 bool getCurrentRaw(int m, double * curr) override;
124
125 bool getCurrentsRaw(double * currs) override
126 { return getCurrentRaw(0, &currs[0]); }
127
128 bool getCurrentRangeRaw(int m, double * min, double * max) override;
129
130 bool getCurrentRangesRaw(double * min, double * max) override
131 { return getCurrentRangeRaw(0, min, max); }
132
133 bool setRefCurrentRaw(int m, double curr) override;
134
135 bool setRefCurrentsRaw(const double * currs) override
136 { return setRefCurrentRaw(0, currs[0]); }
137
138 bool setRefCurrentsRaw(int n_motor, const int * motors, const double * currs) override
139 { return setRefCurrentRaw(motors[0], currs[0]); }
140
141 bool getRefCurrentRaw(int m, double * curr) override;
142
143 bool getRefCurrentsRaw(double * currs) override
144 { return getRefCurrentRaw(0, &currs[0]); }
145
146 // ---------- IEncodersRaw declarations. Implementation in IEncodersRawImpl.cpp ----------
147
148 bool getAxes(int * ax) override;
149 bool resetEncoderRaw(int j) override;
150
151 bool resetEncodersRaw() override
152 { return resetEncoderRaw(0); }
153
154 bool setEncoderRaw(int j, double val) override;
155
156 bool setEncodersRaw(const double * vals) override
157 { return setEncoderRaw(0, vals[0]); }
158
159 bool getEncoderRaw(int j, double * v) override;
160
161 bool getEncodersRaw(double * encs) override
162 { return getEncoderRaw(0, &encs[0]); }
163
164 bool getEncoderSpeedRaw(int j, double * sp) override;
165
166 bool getEncoderSpeedsRaw(double * spds) override
167 { return getEncoderSpeedRaw(0, &spds[0]); }
168
169 bool getEncoderAccelerationRaw(int j, double * spds) override;
170
171 bool getEncoderAccelerationsRaw(double * accs) override
172 { return getEncoderAccelerationRaw(0, &accs[0]); }
173
174 // ---------- IEncodersTimedRaw declarations. Implementation in IEncodersRawImpl.cpp ----------
175
176 bool getEncoderTimedRaw(int j, double * encs, double * time) override;
177
178 bool getEncodersTimedRaw(double * encs, double * times) override
179 { return getEncoderTimedRaw(0, &encs[0], &times[0]); }
180
181 // ---------- IImpedanceControlRaw declarations. Implementation in IImpedanceControlRawImpl.cpp ----------
182
183 bool getImpedanceRaw(int j, double * stiffness, double * damping) override
184 { return false; }
185
186 bool setImpedanceRaw(int j, double stiffness, double damping) override
187 { return false; }
188
189 bool setImpedanceOffsetRaw(int j, double offset) override
190 { return false; }
191
192 bool getImpedanceOffsetRaw(int j, double * offset) override
193 { return false; }
194
195 bool getCurrentImpedanceLimitRaw(int j, double * min_stiff, double * max_stiff, double * min_damp, double * max_damp) override
196 { return false; }
197
198 // ---------- IInteractionModeRaw declarations. Implementation in IInteractionModeRawImpl.cpp ----------
199
200 bool getInteractionModeRaw(int axis, yarp::dev::InteractionModeEnum * mode) override
201 { return false; }
202
203 bool getInteractionModesRaw(int n_joints, int * joints, yarp::dev::InteractionModeEnum * modes) override
204 { return getInteractionModeRaw(joints[0], &modes[0]); }
205
206 bool getInteractionModesRaw(yarp::dev::InteractionModeEnum * modes) override
207 { return getInteractionModeRaw(0, &modes[0]); }
208
209 bool setInteractionModeRaw(int axis, yarp::dev::InteractionModeEnum mode) override
210 { return false; }
211
212 bool setInteractionModesRaw(int n_joints, int * joints, yarp::dev::InteractionModeEnum * modes) override
213 { return setInteractionModeRaw(joints[0], modes[0]); }
214
215 bool setInteractionModesRaw(yarp::dev::InteractionModeEnum * modes) override
216 { return setInteractionModeRaw(0, modes[0]); }
217
218 // ---------- IJointFaultRaw declarations. Implementation in IJointFaultRawImpl.cpp ----------
219
220 bool getLastJointFaultRaw(int j, int & fault, std::string & message) override;
221
222 // --------- IMotorRaw declarations. Implementation in IMotorRawImpl.cpp ---------
223
224 bool getNumberOfMotorsRaw(int * num) override;
225 bool getTemperatureRaw(int m, double * val) override;
226 bool getTemperaturesRaw(double * vals) override;
227 bool getTemperatureLimitRaw(int m, double * temp) override;
228 bool setTemperatureLimitRaw(int m, double temp) override;
229 bool getGearboxRatioRaw(int m, double * val) override;
230 bool setGearboxRatioRaw(int m, double val) override;
231
232 // --------- IMotorEncodersRaw declarations. Implementation in IMotorEncodersRawImpl.cpp ---------
233
234 bool getNumberOfMotorEncodersRaw(int * num) override;
235 bool resetMotorEncoderRaw(int m) override;
236
237 bool resetMotorEncodersRaw() override
238 { return resetMotorEncoderRaw(0); }
239
240 bool setMotorEncoderCountsPerRevolutionRaw(int m, double cpr) override;
241 bool getMotorEncoderCountsPerRevolutionRaw(int m, double * cpr) override;
242 bool setMotorEncoderRaw(int m, double val) override;
243
244 bool setMotorEncodersRaw(const double * vals) override
245 { return setMotorEncoderRaw(0, vals[0]); }
246
247 bool getMotorEncoderRaw(int m, double * v) override;
248
249 bool getMotorEncodersRaw(double * encs) override
250 { return getMotorEncoderSpeedRaw(0, &encs[0]); }
251
252 bool getMotorEncoderTimedRaw(int m, double * encs, double * stamp) override;
253
254 bool getMotorEncodersTimedRaw(double * encs, double * stamps) override
255 { return getMotorEncoderTimedRaw(0, &encs[0], &stamps[0]); }
256
257 bool getMotorEncoderSpeedRaw(int m, double * sp) override;
258
259 bool getMotorEncoderSpeedsRaw(double * spds) override
260 { return getMotorEncoderSpeedRaw(0, &spds[0]); }
261
262 bool getMotorEncoderAccelerationRaw(int m, double * spds) override;
263
264 bool getMotorEncoderAccelerationsRaw(double * accs) override
265 { return getMotorEncoderAccelerationRaw(0, &accs[0]); }
266
267 // --------- IPidControlRaw declarations. Implementation in IPidControlRawImpl.cpp ---------
268
269 bool setPidRaw(const yarp::dev::PidControlTypeEnum & pidtype, int j, const yarp::dev::Pid & pid) override
270 { return false; }
271
272 bool setPidsRaw(const yarp::dev::PidControlTypeEnum & pidtype, const yarp::dev::Pid * pids) override
273 { return setPidRaw(pidtype, 0, pids[0]); }
274
275 bool setPidReferenceRaw(const yarp::dev::PidControlTypeEnum & pidtype, int j, double ref) override
276 { return false; }
277
278 bool setPidReferencesRaw(const yarp::dev::PidControlTypeEnum & pidtype, const double * refs) override
279 { return setPidReferenceRaw(pidtype, 0, refs[0]); }
280
281 bool setPidErrorLimitRaw(const yarp::dev::PidControlTypeEnum & pidtype, int j, double limit) override
282 { return false; }
283
284 bool setPidErrorLimitsRaw(const yarp::dev::PidControlTypeEnum & pidtype, const double * limits) override
285 { return setPidErrorLimitRaw(pidtype, 0, limits[0]); }
286
287 bool getPidErrorRaw(const yarp::dev::PidControlTypeEnum & pidtype, int j, double * err) override
288 { return false; }
289
290 bool getPidErrorsRaw(const yarp::dev::PidControlTypeEnum & pidtype, double * errs) override
291 { return getPidErrorRaw(pidtype, 0, &errs[0]); }
292
293 bool getPidOutputRaw(const yarp::dev::PidControlTypeEnum & pidtype, int j, double * out) override
294 { return false; }
295
296 bool getPidOutputsRaw(const yarp::dev::PidControlTypeEnum & pidtype, double * outs) override
297 { return getPidOutputRaw(pidtype, 0, &outs[0]); }
298
299 bool getPidRaw(const yarp::dev::PidControlTypeEnum & pidtype, int j, yarp::dev::Pid * pid) override
300 { return false; }
301
302 bool getPidsRaw(const yarp::dev::PidControlTypeEnum & pidtype, yarp::dev::Pid * pids) override
303 { return getPidRaw(pidtype, 0, &pids[0]); }
304
305 bool getPidReferenceRaw(const yarp::dev::PidControlTypeEnum & pidtype, int j, double * ref) override
306 { return false; }
307
308 bool getPidReferencesRaw(const yarp::dev::PidControlTypeEnum & pidtype, double * refs) override
309 { return getPidReferenceRaw(pidtype, 0, &refs[0]); }
310
311 bool getPidErrorLimitRaw(const yarp::dev::PidControlTypeEnum & pidtype, int j, double * limit) override
312 { return false; }
313
314 bool getPidErrorLimitsRaw(const yarp::dev::PidControlTypeEnum & pidtype, double * limits) override
315 { return getPidErrorLimitRaw(pidtype, 0, &limits[0]); }
316
317 bool resetPidRaw(const yarp::dev::PidControlTypeEnum & pidtype, int j) override
318 { return false; }
319
320 bool disablePidRaw(const yarp::dev::PidControlTypeEnum & pidtype, int j) override
321 { return false; }
322
323 bool enablePidRaw(const yarp::dev::PidControlTypeEnum & pidtype, int j) override
324 { return false; }
325
326 bool setPidOffsetRaw(const yarp::dev::PidControlTypeEnum & pidtype, int j, double v) override
327 { return false; }
328
329 bool isPidEnabledRaw(const yarp::dev::PidControlTypeEnum & pidtype, int j, bool * enabled) override
330 { return false; }
331
332 // ------- IPositionControlRaw declarations. Implementation in IPositionControlRawImpl.cpp -------
333
334 using yarp::dev::IPositionControlRaw::positionMoveRaw;
335
336 bool positionMoveRaw(const double * refs) override
337 { return positionMoveRaw(0, refs[0]); }
338
339 bool positionMoveRaw(int n_joint, const int * joints, const double * refs) override
340 { return positionMoveRaw(joints[0], refs[0]); }
341
342 using yarp::dev::IPositionControlRaw::relativeMoveRaw;
343
344 bool relativeMoveRaw(const double * deltas) override
345 { return relativeMoveRaw(0, deltas[0]); }
346
347 bool relativeMoveRaw(int n_joint, const int * joints, const double * deltas) override
348 { return relativeMoveRaw(joints[0], deltas[0]); }
349
350 using yarp::dev::IPositionControlRaw::checkMotionDoneRaw;
351
352 bool checkMotionDoneRaw(bool * flag) override
353 { return checkMotionDoneRaw(0, flag); }
354
355 bool checkMotionDoneRaw(int n_joint, const int * joints, bool * flag) override
356 { return checkMotionDoneRaw(joints[0], flag); }
357
358 bool setRefSpeedsRaw(const double * spds) override
359 { return setRefSpeedRaw(0, spds[0]); }
360
361 bool setRefSpeedsRaw(int n_joint, const int * joints, const double * spds) override
362 { return setRefSpeedRaw(joints[0], spds[0]); }
363
364 using yarp::dev::IPositionControlRaw::setRefAccelerationRaw;
365
366 bool setRefAccelerationsRaw(const double * accs) override
367 { return setRefAccelerationRaw(0, accs[0]); }
368
369 bool setRefAccelerationsRaw(int n_joint, const int * joints, const double * accs) override
370 { return setRefAccelerationRaw(joints[0], accs[0]); }
371
372 bool getRefSpeedsRaw(double * spds) override
373 { return getRefSpeedRaw(0, &spds[0]); }
374
375 bool getRefSpeedsRaw(int n_joint, const int * joints, double * spds) override
376 { return getRefSpeedRaw(joints[0], &spds[0]); }
377
378 using yarp::dev::IPositionControlRaw::getRefAccelerationRaw;
379
380 bool getRefAccelerationsRaw(double * accs) override
381 { return getRefAccelerationRaw(0, &accs[0]); }
382
383 bool getRefAccelerationsRaw(int n_joint, const int * joints, double * accs) override
384 { return getRefAccelerationRaw(joints[0], &accs[0]); }
385
386 using yarp::dev::IPositionControlRaw::stopRaw;
387
388 bool stopRaw() override
389 { return stopRaw(0); }
390
391 bool stopRaw(int n_joint, const int * joints) override
392 { return stopRaw(joints[0]); }
393
394 bool getTargetPositionsRaw(double * refs) override
395 { return getTargetPositionRaw(0, &refs[0]); }
396
397 bool getTargetPositionsRaw(int n_joint, const int * joints, double * refs) override
398 { return getTargetPositionRaw(joints[0], &refs[0]); }
399
400 // ------- IPositionDirectRaw declarations. Implementation in IPositionDirectRawImpl.cpp -------
401
402 bool setPositionsRaw(const double * refs) override
403 { return setPositionRaw(0, refs[0]); }
404
405 bool setPositionsRaw(int n_joint, const int * joints, const double * refs) override
406 { return setPositionRaw(joints[0], refs[0]); }
407
408 bool getRefPositionsRaw(double * refs) override
409 { return getRefPositionRaw(0, &refs[0]); }
410
411 bool getRefPositionsRaw(int n_joint, const int * joints, double * refs) override
412 { return getRefPositionRaw(joints[0], &refs[0]); }
413
414 // -------- ITorqueControlRaw declarations. Implementation in ITorqueControlRawImpl.cpp --------
415
416 bool getRefTorqueRaw(int j, double * t) override;
417
418 bool getRefTorquesRaw(double * t) override
419 { return getRefTorqueRaw(0, &t[0]); }
420
421 bool setRefTorqueRaw(int j, double t) override;
422
423 bool setRefTorquesRaw(int n_joint, const int * joints, const double * t) override
424 { return setRefTorqueRaw(joints[0], t[0]); }
425
426 bool setRefTorquesRaw(const double * t) override
427 { return setRefTorqueRaw(0, t[0]); }
428
429 bool getTorqueRaw(int j, double * t) override;
430
431 bool getTorquesRaw(double * t) override
432 { return getTorqueRaw(0, &t[0]); }
433
434 bool getTorqueRangeRaw(int j, double * min, double * max) override;
435
436 bool getTorqueRangesRaw(double * min, double * max) override
437 { return getTorqueRangeRaw(0, &min[0], &max[0]); }
438
439 bool getMotorTorqueParamsRaw(int j, yarp::dev::MotorTorqueParameters * params) override;
440 bool setMotorTorqueParamsRaw(int j, const yarp::dev::MotorTorqueParameters params) override;
441
442 // --------- IVelocityControlRaw declarations. Implementation in IVelocityControlRawImpl.cpp ---------
443
444 using yarp::dev::IVelocityControlRaw::velocityMoveRaw;
445
446 bool velocityMoveRaw(const double * sp) override
447 { return velocityMoveRaw(0, sp[0]); }
448
449 bool velocityMoveRaw(int n_joint, const int * joints, const double * spds) override
450 { return velocityMoveRaw(joints[0], spds[0]); }
451
452 bool getRefVelocitiesRaw(double * vels) override
453 { return getRefVelocityRaw(0, &vels[0]); }
454
455 bool getRefVelocitiesRaw(int n_joint, const int * joints, double * vels) override
456 { return getRefVelocityRaw(joints[0], &vels[0]); }
457
458protected:
459
460 enum report_level { NONE, INFO, WARN, FAULT };
461 enum limit_switch { POSITIVE, NEGATIVE, INACTIVE };
462
464 {
465 const char * reg;
466 const std::bitset<16> & actual;
467 const std::bitset<16> & stored;
468 };
469
470 bool reportBitToggle(report_storage report, int level, std::size_t pos, const char * msgSet, const char * msgReset = nullptr);
471
472 virtual void interpretModesOfOperation(std::int8_t modesOfOperation) = 0;
473 virtual void interpretIpStatus(std::uint16_t ipStatus) {}
474 virtual void onPositionLimitTriggered() = 0;
475 virtual void reset() = 0;
476
478 bool awaitControlMode(yarp::conf::vocab32_t mode);
479
481 double degreesToInternalUnits(double value, int derivativeOrder = 0) const;
482
484 double internalUnitsToDegrees(double value, int derivativeOrder = 0) const;
485
487 std::int16_t currentToInternalUnits(double value) const;
488
490 double internalUnitsToCurrent(std::int16_t value) const;
491
493 double internalUnitsToPeakCurrent(std::int16_t value) const;
494
496 double currentToTorque(double current) const;
497
499 double torqueToCurrent(double torque) const;
500
501 CanOpenNode * can {nullptr};
502 CommandBuffer commandBuffer;
503
504 std::unique_ptr<StateObserver> controlModeObserverPtr {new StateObserver(1.0)}; // arbitrary 1 second wait
505 std::unique_ptr<EncoderRead> lastEncoderRead {nullptr};
506
507 // read/write, no concurrent access
508
509 std::bitset<16> msr;
510 std::bitset<16> mer;
511 std::bitset<16> der;
512 std::bitset<16> der2;
513 std::bitset<16> cer;
514
515 std::int8_t modesOfOperation {0};
516
518
519 bool configuredOnce {false};
520
521 // read/write with atomic access
522
523 std::atomic<std::int16_t> lastCurrentRead {0};
524
525 std::atomic<yarp::conf::vocab32_t> actualControlMode {0};
526 std::atomic<yarp::conf::vocab32_t> requestedcontrolMode {0};
527
528 std::atomic<double> tr {0.0};
529 std::atomic<double> k {0.0};
530 std::atomic<int> encoderPulses {0};
531
532 std::atomic<double> maxVel {0.0};
533 std::atomic<double> min {0.0};
534 std::atomic<double> max {0.0};
535 std::atomic<double> refSpeed {0.0};
536 std::atomic<double> refAcceleration {0.0};
537
538 std::atomic<double> lastHeartbeat {0.0};
539 std::atomic<std::uint8_t> lastNmtState {0};
540 std::atomic<std::uint16_t> lastFaultCode {0};
541 std::atomic<const char *> lastFaultMessage;
542
543 std::atomic<limit_switch> limitSwitchState {INACTIVE};
544
545 // read only after initial configuration, conceptually immutable
546
547 yarp::conf::vocab32_t initialControlMode {0};
548 yarp::conf::vocab32_t jointType {0};
549
550 PdoConfiguration tpdo1Conf;
551 PdoConfiguration tpdo2Conf;
552 PdoConfiguration tpdo3Conf;
553
554 const TechnosoftIpos_ParamsParser & params;
555
556private:
557
559 static bool validateInitialState(const TechnosoftIpos_ParamsParser & params, const std::string & id);
560
561 void interpretMsr(std::uint16_t msr);
562 void interpretMer(std::uint16_t mer);
563 void interpretDer(std::uint16_t der);
564 void interpretDer2(std::uint16_t der2);
565 void interpretCer(std::uint16_t cer);
566 void interpretStatusword(std::uint16_t statusword);
567
568 void handleTpdo1(std::uint16_t statusword, std::uint16_t msr, std::int8_t modesOfOperation);
569 void handleTpdo2(std::uint16_t mer, std::uint16_t der);
570 void handleTpdo3(std::int32_t position, std::int16_t current);
571 void handleEmcy(EmcyConsumer::code_t code, std::uint8_t reg, const std::uint8_t * msef);
572 void handleNmt(NmtState state);
573
574 bool monitorWorker(const yarp::os::YarpTimerEvent & event);
575
576 bool setLimitRaw(double limit, bool isMin);
577 bool getLimitRaw(double * limit, bool isMin);
578
579 yarp::dev::PolyDriver externalEncoderDevice;
580 yarp::dev::IEncodersTimedRaw * iEncodersTimedRawExternal {nullptr};
581 roboticslab::ICanBusSharer * iExternalEncoderCanBusSharer {nullptr};
582
583 yarp::os::Timer * monitorThread {nullptr};
584 roboticslab::ICanSenderDelegate * sender {nullptr};
585};
586
587} // namespace roboticslab
588
589#endif // __TECHNOSOFT_IPOS_BASE_HPP__
Definition TechnosoftIpos_ParamsParser.h:90
Wrapper for CAN protocol handles with handy accessors.
Definition CanOpenNode.hpp:35
std::pair< std::uint16_t, std::string > code_t
Emergency error code.
Definition EmcyConsumer.hpp:35
Abstract base for a CAN bus sharer.
Definition ICanBusSharer.hpp:25
Implementation-agnostic consumer for TX CAN transfers.
Definition ICanSenderDelegate.hpp:22
Base class for all proxied TechnosoftIpos implementations.
Definition TechnosoftIposBase.hpp:74
unsigned int getId() override
Retrieve CAN node ID.
Definition ICanBusSharerImpl.cpp:39
double internalUnitsToDegrees(double value, int derivativeOrder=0) const
Convert position, speed or acceleration to degrees.
Definition TechnosoftIposBase.cpp:659
std::int16_t currentToInternalUnits(double value) const
Convert current to internal units.
Definition TechnosoftIposBase.cpp:666
bool initialize() override
Perform CAN node initialization.
Definition ICanBusSharerImpl.cpp:67
std::vector< unsigned int > getAdditionalIds() override
Retrieve more associated CAN node IDs, if any.
Definition ICanBusSharerImpl.cpp:46
double currentToTorque(double current) const
Convert current (amperes) to torque (Nm).
Definition TechnosoftIposBase.cpp:687
double internalUnitsToPeakCurrent(std::int16_t value) const
Apply internal iPOS conversion to express drive peak current in amperes.
Definition TechnosoftIposBase.cpp:680
bool notifyMessage(const can_message &message) override
Notify observers that a new CAN message has arrived.
Definition ICanBusSharerImpl.cpp:176
bool registerSender(ICanSenderDelegate *sender) override
Pass a handle to a CAN sender delegate instance.
Definition ICanBusSharerImpl.cpp:58
double internalUnitsToCurrent(std::int16_t value) const
Convert current to amperes.
Definition TechnosoftIposBase.cpp:673
bool finalize() override
Finalize CAN node communications.
Definition ICanBusSharerImpl.cpp:134
static bool validateInitialState(const TechnosoftIpos_ParamsParser &params, const std::string &id)
Make sure stored variables actually make sense.
Definition TechnosoftIposBase.cpp:505
double torqueToCurrent(double torque) const
Convert torque (Nm) to current (amperes).
Definition TechnosoftIposBase.cpp:694
double degreesToInternalUnits(double value, int derivativeOrder=0) const
Convert position, speed or acceleration to internal units.
Definition TechnosoftIposBase.cpp:652
bool awaitControlMode(yarp::conf::vocab32_t mode)
Wait with timeout for requested control mode change.
Definition TechnosoftIposBase.cpp:645
NmtState
NMT state machine.
Definition NmtProtocol.hpp:33
DriveState
CiA 402 drive states (associated to statusword).
Definition DriveStatusMachine.hpp:22
@ NOT_READY_TO_SWITCH_ON
Not ready to switch on state.
The main, catch-all namespace for Robotics Lab UC3M.
Definition groups.dox:6
Definition TechnosoftIposBase.hpp:464
Proxy CAN message structure.
Definition CanMessage.hpp:20