39 #include <visp3/core/vpConfig.h> 40 #ifdef VISP_HAVE_QBDEVICE 44 #include <visp3/robot/vpQbSoftHand.h> 79 std::vector<short int> currents(2);
85 current[0] =
static_cast<double>(currents[0]);
105 std::vector<short int> positions;
108 position[0] =
static_cast<double>(positions[0])/static_cast<double>(
getPositionLimits()[1]);
126 std::vector<short int> commands(2);
127 if (position.
size() != 1) {
133 commands[0] =
static_cast<short int>(position[0]*position_limits[1]);
135 if(commands[0] < position_limits[0]) {
136 commands[0] = position_limits[0];
138 else if (commands[0] > position_limits[1]) {
139 commands[0] = position_limits[1];
169 double max_delta_q = 1;
170 double min_delta_t = 2.0;
171 double precision = 0.05;
173 double max_slope = max_delta_q / min_delta_t;
174 double sign = (position[0] > q_mes[0]) ? 1.0 : -1.0;
175 double vel = speed_factor;
182 double current_factor = stiffness;
183 if (current_factor < 0.0) {
184 current_factor = 0.0;
186 else if (current_factor > 1.) {
187 current_factor = 1.0;
189 double slope = sign * max_slope * vel;
192 int current_failures = 0;
195 q[0] = q_mes[0] + slope * delta_t/1000.0 * i;
206 if (std::fabs(current[0]) > current_factor*current_max) {
210 current_failures = 0;
214 }
while (!
vpMath::equal(q[0], position[0], precision) && ! (current_failures > 1));
VISP_EXPORT int wait(double t0, double t)
void setPosition(const vpColVector &position, const int &id=1)
virtual int getPositions(const int &id, const int &max_repeats, std::vector< short int > &positions)
static bool equal(double x, double y, double s=0.001)
error that can be emited by ViSP classes.
std::vector< short int > getPositionLimits() const
virtual int getCurrents(const int &id, const int &max_repeats, std::vector< short int > ¤ts)
unsigned int size() const
Return the number of elements of the 2D array.
bool m_init_done
Flag used to indicate if the device is initialized.
VISP_EXPORT double measureTimeMs()
void getCurrent(vpColVector ¤t, const int &id=1)
int m_max_repeats
Max number of trials to send a command.
virtual bool isInConnectedSet(const int &id)
void getPosition(vpColVector &position, const int &id=1)
double getCurrentMax() const
void resize(unsigned int i, bool flagNullify=true)
Implementation of column vector and the associated operations.
bool isReliable(int const &failures, int const &max_repeats)
virtual int setCommandsAsync(const int &id, std::vector< short int > &commands)
virtual bool init(const int &id)