3 #ifndef __EMULATED_CONTROL_BOARD_HPP__
4 #define __EMULATED_CONTROL_BOARD_HPP__
8 #include <yarp/os/PeriodicThread.h>
9 #include <yarp/os/Semaphore.h>
11 #include <yarp/dev/Drivers.h>
12 #include <yarp/dev/PolyDriver.h>
13 #include <yarp/dev/ControlBoardInterfaces.h>
29 public yarp::dev::IControlLimits,
30 public yarp::dev::IControlMode,
31 public yarp::dev::IEncodersTimed,
32 public yarp::dev::IPositionControl,
33 public yarp::dev::IPositionDirect,
34 public yarp::dev::IVelocityControl,
35 public yarp::os::PeriodicThread
44 bool getAxes(
int *ax)
override;
45 bool positionMove(
int j,
double ref)
override;
46 bool positionMove(
const double *refs)
override;
47 bool relativeMove(
int j,
double delta)
override;
48 bool relativeMove(
const double *deltas)
override;
49 bool checkMotionDone(
int j,
bool *flag)
override;
50 bool checkMotionDone(
bool *flag)
override;
51 bool setRefSpeed(
int j,
double sp)
override;
52 bool setRefSpeeds(
const double *spds)
override;
53 bool setRefAcceleration(
int j,
double acc)
override;
54 bool setRefAccelerations(
const double *accs)
override;
55 bool getRefSpeed(
int j,
double *ref)
override;
56 bool getRefSpeeds(
double *spds)
override;
57 bool getRefAcceleration(
int j,
double *acc)
override;
58 bool getRefAccelerations(
double *accs)
override;
59 bool stop(
int j)
override;
61 bool positionMove(
int n_joint,
const int *joints,
const double *refs)
override;
62 bool relativeMove(
int n_joint,
const int *joints,
const double *deltas)
override;
63 bool checkMotionDone(
int n_joint,
const int *joints,
bool *flags)
override;
64 bool setRefSpeeds(
int n_joint,
const int *joints,
const double *spds)
override;
65 bool setRefAccelerations(
int n_joint,
const int *joints,
const double *accs)
override;
66 bool getRefSpeeds(
int n_joint,
const int *joints,
double *spds)
override;
67 bool getRefAccelerations(
int n_joint,
const int *joints,
double *accs)
override;
68 bool stop(
int n_joint,
const int *joints)
override;
69 bool getTargetPosition(
int joint,
double *ref)
override;
70 bool getTargetPositions(
double *refs)
override;
71 bool getTargetPositions(
int n_joint,
const int *joints,
double *refs)
override;
75 bool setPosition(
int j,
double ref)
override;
76 bool setPositions(
int n_joint,
const int *joints,
const double *refs)
override;
77 bool setPositions(
const double *refs)
override;
78 bool getRefPosition(
int joint,
double *ref)
override;
79 bool getRefPositions(
double *refs)
override;
80 bool getRefPositions(
int n_joint,
const int *joints,
double *refs)
override;
84 bool resetEncoder(
int j)
override;
85 bool resetEncoders()
override;
86 bool setEncoder(
int j,
double val)
override;
87 bool setEncoders(
const double *vals)
override;
88 bool getEncoder(
int j,
double *v)
override;
89 bool getEncoders(
double *encs)
override;
90 bool getEncoderSpeed(
int j,
double *sp)
override;
91 bool getEncoderSpeeds(
double *spds)
override;
92 bool getEncoderAcceleration(
int j,
double *spds)
override;
93 bool getEncoderAccelerations(
double *accs)
override;
94 bool getEncodersTimed(
double *encs,
double *time)
override;
95 bool getEncoderTimed(
int j,
double *encs,
double *time)
override;
99 bool velocityMove(
int j,
double sp)
override;
100 bool velocityMove(
const double *sp)
override;
101 bool velocityMove(
int n_joint,
const int *joints,
const double *spds)
override;
102 bool getRefVelocity(
int joint,
double *vel)
override;
103 bool getRefVelocities(
double *vels)
override;
104 bool getRefVelocities(
int n_joint,
const int *joints,
double *vels)
override;
108 bool setLimits(
int axis,
double min,
double max)
override;
109 bool getLimits(
int axis,
double *min,
double *max)
override;
110 bool setVelLimits(
int axis,
double min,
double max)
override;
111 bool getVelLimits(
int axis,
double *min,
double *max)
override;
115 bool getControlMode(
int j,
int *mode)
override;
116 bool getControlModes(
int *modes)
override;
117 bool getControlModes(
int n_joint,
const int *joints,
int *modes)
override;
118 bool setControlMode(
int j,
const int mode)
override;
119 bool setControlModes(
int n_joint,
const int *joints,
int *modes)
override;
120 bool setControlModes(
int *modes)
override;
124 bool open(yarp::os::Searchable& config)
override;
125 bool close()
override;
129 bool threadInit()
override;
134 void setEncRaw(
const int index,
const double position);
135 void setEncsRaw(
const std::vector<double> & positions);
137 double getEncRaw(
const int index);
138 std::vector<double> getEncsRaw();
140 double getEncExposed(
const int index);
141 std::vector<double> getEncsExposed();
147 enum jmc_state { NOT_CONTROLLING, POSITION_MOVE, RELATIVE_MOVE, VELOCITY_MOVE };
148 enum jmc_mode { POSITION_MODE, VELOCITY_MODE, POSITION_DIRECT_MODE };
150 bool setPositionMode(
int j);
151 bool setVelocityMode(
int j);
152 bool setTorqueMode(
int j);
153 bool setPositionDirectMode(
int j);
158 jmc_mode controlMode;
161 yarp::os::Semaphore encRawMutex;
163 std::vector<jmc_state> jointStatus;
165 std::vector<double> encRaw;
166 std::vector<double> encRawExposed;
167 std::vector<double> initPos;
168 std::vector<double> jointTol;
169 std::vector<double> maxLimit;
170 std::vector<double> minLimit;
171 std::vector<double> refAcc;
172 std::vector<double> refSpeed;
173 std::vector<double> targetExposed;
174 std::vector<double> velRawExposed;
175 std::vector<double> velRaw;
Implements several motor interfaces.
Definition: EmulatedControlBoard.hpp:36
The main, catch-all namespace for Robotics Lab UC3M.
Definition: groups.dox:6