34 public yarp::dev::IControlLimits,
35 public yarp::dev::IControlMode,
36 public yarp::dev::IEncodersTimed,
37 public yarp::dev::IPositionControl,
38 public yarp::dev::IPositionDirect,
39 public yarp::dev::IVelocityControl,
40 public yarp::os::PeriodicThread,
50 bool getAxes(
int *ax)
override;
51 bool positionMove(
int j,
double ref)
override;
52 bool positionMove(
const double *refs)
override;
53 bool relativeMove(
int j,
double delta)
override;
54 bool relativeMove(
const double *deltas)
override;
55 bool checkMotionDone(
int j,
bool *flag)
override;
56 bool checkMotionDone(
bool *flag)
override;
57 bool setRefSpeed(
int j,
double sp)
override;
58 bool setRefSpeeds(
const double *spds)
override;
59 bool setRefAcceleration(
int j,
double acc)
override;
60 bool setRefAccelerations(
const double *accs)
override;
61 bool getRefSpeed(
int j,
double *ref)
override;
62 bool getRefSpeeds(
double *spds)
override;
63 bool getRefAcceleration(
int j,
double *acc)
override;
64 bool getRefAccelerations(
double *accs)
override;
65 bool stop(
int j)
override;
67 bool positionMove(
int n_joint,
const int *joints,
const double *refs)
override;
68 bool relativeMove(
int n_joint,
const int *joints,
const double *deltas)
override;
69 bool checkMotionDone(
int n_joint,
const int *joints,
bool *flags)
override;
70 bool setRefSpeeds(
int n_joint,
const int *joints,
const double *spds)
override;
71 bool setRefAccelerations(
int n_joint,
const int *joints,
const double *accs)
override;
72 bool getRefSpeeds(
int n_joint,
const int *joints,
double *spds)
override;
73 bool getRefAccelerations(
int n_joint,
const int *joints,
double *accs)
override;
74 bool stop(
int n_joint,
const int *joints)
override;
75 bool getTargetPosition(
int joint,
double *ref)
override;
76 bool getTargetPositions(
double *refs)
override;
77 bool getTargetPositions(
int n_joint,
const int *joints,
double *refs)
override;
81 bool setPosition(
int j,
double ref)
override;
82 bool setPositions(
int n_joint,
const int *joints,
const double *refs)
override;
83 bool setPositions(
const double *refs)
override;
84 bool getRefPosition(
int joint,
double *ref)
override;
85 bool getRefPositions(
double *refs)
override;
86 bool getRefPositions(
int n_joint,
const int *joints,
double *refs)
override;
90 bool resetEncoder(
int j)
override;
91 bool resetEncoders()
override;
92 bool setEncoder(
int j,
double val)
override;
93 bool setEncoders(
const double *vals)
override;
94 bool getEncoder(
int j,
double *v)
override;
95 bool getEncoders(
double *encs)
override;
96 bool getEncoderSpeed(
int j,
double *sp)
override;
97 bool getEncoderSpeeds(
double *spds)
override;
98 bool getEncoderAcceleration(
int j,
double *spds)
override;
99 bool getEncoderAccelerations(
double *accs)
override;
100 bool getEncodersTimed(
double *encs,
double *time)
override;
101 bool getEncoderTimed(
int j,
double *encs,
double *time)
override;
105 bool velocityMove(
int j,
double sp)
override;
106 bool velocityMove(
const double *sp)
override;
107 bool velocityMove(
int n_joint,
const int *joints,
const double *spds)
override;
108 bool getRefVelocity(
int joint,
double *vel)
override;
109 bool getRefVelocities(
double *vels)
override;
110 bool getRefVelocities(
int n_joint,
const int *joints,
double *vels)
override;
114 bool setLimits(
int axis,
double min,
double max)
override;
115 bool getLimits(
int axis,
double *min,
double *max)
override;
116 bool setVelLimits(
int axis,
double min,
double max)
override;
117 bool getVelLimits(
int axis,
double *min,
double *max)
override;
121 bool getControlMode(
int j,
int *mode)
override;
122 bool getControlModes(
int *modes)
override;
123 bool getControlModes(
int n_joint,
const int *joints,
int *modes)
override;
124 bool setControlMode(
int j,
const int mode)
override;
125 bool setControlModes(
int n_joint,
const int *joints,
int *modes)
override;
126 bool setControlModes(
int *modes)
override;
130 bool open(yarp::os::Searchable& config)
override;
131 bool close()
override;
135 bool threadInit()
override;
142 void setEncRaw(
const int index,
const double position);
143 void setEncsRaw(
const std::vector<double> & positions);
145 double getEncRaw(
const int index);
146 std::vector<double> getEncsRaw();
148 double getEncExposed(
const int index);
149 std::vector<double> getEncsExposed();
153 enum jmc_state { NOT_CONTROLLING, POSITION_MOVE, RELATIVE_MOVE, VELOCITY_MOVE };
154 enum jmc_mode { POSITION_MODE, VELOCITY_MODE, POSITION_DIRECT_MODE, UNKNOWN_MODE };
156 bool setPositionMode(
int j);
157 bool setVelocityMode(
int j);
158 bool setTorqueMode(
int j);
159 bool setPositionDirectMode(
int j);
162 jmc_mode controlMode {UNKNOWN_MODE};
163 double lastTime {0.0};
165 std::mutex encRawMutex;
167 std::vector<jmc_state> jointStatus;
169 std::vector<double> encRaw;
170 std::vector<double> refAcc;
171 std::vector<double> targetExposed;
172 std::vector<double> velRaw;