41 #include <visp3/robot/vpRobotViper850.h>
43 #ifdef VISP_HAVE_VIPER850
44 #ifdef ENABLE_VISP_NAMESPACE
56 for (
unsigned int i = 0; i < 3; i++) {
57 if (std::fabs(t1[i] - t2[i]) > epsilon)
59 if (std::fabs(tu1[i] - tu2[i]) > epsilon)
67 for (
unsigned int i = 0; i < q1.
size(); i++) {
68 if (std::fabs(q1[i] - q2[i]) > epsilon) {
87 eMt[0][1] = -sqrt(2)/2;
88 eMt[1][1] = -sqrt(2)/2;
91 eMt[0][2] = -sqrt(2)/2;
92 eMt[1][2] = sqrt(2)/2;
104 std::cout <<
"eMt:\n" << eMt << std::endl;
107 std::cout <<
"Connection to Viper 850 robot" << std::endl;
122 std::cout <<
"q: " << q.
t() << std::endl;
125 robot.get_fMw(q, fMw);
126 robot.get_fMe(q, fMe);
127 robot.get_fMc(q, fMt);
130 std::cout <<
"fMw:\n" << fMw << std::endl;
131 std::cout <<
"fMe:\n" << fMe << std::endl;
132 std::cout <<
"fMt:\n" << fMt << std::endl;
133 std::cout <<
"eMc:\n" << cMe.
inverse() << std::endl;
139 std::cout <<
"eMt_:\n" << eMt_ << std::endl;
142 std::cout <<
"Compare pose eMt and eMt_:" << std::endl;
143 if (!pose_equal(eMt, eMt_, 1e-4)) {
144 std::cout <<
" Error: Pose eMt differ" << std::endl;
145 std::cout <<
"\nTest failed" << std::endl;
148 std::cout <<
" They are the same, we can continue" << std::endl;
153 std::cout <<
"eMc:\n" << cMe.
inverse() << std::endl;
155 std::cout <<
"Compare pose eMt and eMc:" << std::endl;
156 if (!pose_equal(eMt, cMe.
inverse(), 1e-4)) {
157 std::cout <<
" Error: Pose eMc differ" << std::endl;
158 std::cout <<
"\nTest failed" << std::endl;
161 std::cout <<
" They are the same, we can continue" << std::endl;
171 for (
unsigned int i = 0; i < 3; i++) {
172 f_t_t[i] = f_pose_t[i];
173 f_rxyz_t[i] = f_pose_t[i + 3];
176 std::cout <<
"fMt_ (from ref frame):\n" << fMt_ << std::endl;
178 std::cout <<
"Compare pose fMt and fMt_:" << std::endl;
179 if (!pose_equal(fMt, fMt_, 1e-4)) {
180 std::cout <<
" Error: Pose fMt differ" << std::endl;
181 std::cout <<
"\nTest failed" << std::endl;
184 std::cout <<
" They are the same, we can continue" << std::endl;
190 robot.getInverseKinematics(fMt, q1);
192 std::cout <<
"Move robot in joint (the robot should not move)" << std::endl;
198 std::cout <<
"Reach joint position q2: " << q2.
t() << std::endl;
200 std::cout <<
"Compare joint position q and q2:" << std::endl;
201 if (!joint_equal(q, q2, 1e-4)) {
202 std::cout <<
" Error: Joint position differ" << std::endl;
203 std::cout <<
"\nTest failed" << std::endl;
206 std::cout <<
" They are the same, we can continue" << std::endl;
214 for (
unsigned int i = 0; i < 3; i++) {
215 f_pose_t[i] = f_t_t[i];
216 f_pose_t[i + 3] = f_rxyz_t[i];
219 std::cout <<
"Move robot in reference frame (the robot should not move)" << std::endl;
223 std::cout <<
"Reach joint position q3: " << q3.
t() << std::endl;
224 std::cout <<
"Compare joint position q and q3:" << std::endl;
225 if (!joint_equal(q, q3, 1e-4)) {
226 std::cout <<
" Error: Joint position differ" << std::endl;
227 std::cout <<
"\nTest failed" << std::endl;
230 std::cout <<
" They are the same, we can continue" << std::endl;
242 robot.getInverseKinematics(fMt_, q);
244 std::cout <<
"fMt_:\n" << fMt_ << std::endl;
246 std::cout <<
"Move robot in joint position to reach fMt_" << std::endl;
255 std::cout <<
"Compare pose fMt_ and fpt_:" << std::endl;
257 std::cout <<
" Error: Pose fMt_ differ" << std::endl;
258 std::cout <<
"\nTest failed" << std::endl;
261 std::cout <<
" They are the same, we can continue" << std::endl;
272 std::cout <<
"Move robot in camera velocity" << std::endl;
294 std::cout <<
"Move robot in joint velocity" << std::endl;
313 std::cout <<
"Move robot in camera velocity" << std::endl;
334 std::cout <<
"Move robot in joint velocity" << std::endl;
351 robot.get_fMc(q, fMt);
358 robot.getInverseKinematics(fMt * tMt, q);
360 std::cout <<
"Move robot in joint position" << std::endl;
364 std::cout <<
"The end" << std::endl;
365 std::cout <<
"Test succeed" << std::endl;
369 std::cout <<
"Test failed with exception: " << e.
getMessage() << std::endl;
377 std::cout <<
"The real Viper850 robot controller is not available." << std::endl;
unsigned int size() const
Return the number of elements of the 2D array.
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
const char * getMessage() const
Implementation of an homogeneous matrix and operations on such kind of matrices.
vpRotationMatrix getRotationMatrix() const
vpHomogeneousMatrix & buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
vpHomogeneousMatrix inverse() const
vpTranslationVector getTranslationVector() const
void extract(vpRotationMatrix &R) const
static double rad(double deg)
Implementation of a matrix and operations on matrices.
vpMatrix pseudoInverse(double svThreshold=1e-6) const
Implementation of a pose vector and operations on poses.
void get_eJe(vpMatrix &eJe) VP_OVERRIDE
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel) VP_OVERRIDE
Control of Irisa's Viper S850 robot named Viper850.
@ STATE_POSITION_CONTROL
Initialize the position controller.
@ STATE_VELOCITY_CONTROL
Initialize the velocity controller.
@ STATE_STOP
Stops robot motion especially in velocity and acceleration control.
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
Implementation of a rotation matrix and operations on such kind of matrices.
Implementation of a rotation vector as Euler angle minimal representation.
Implementation of a rotation vector as axis-angle minimal representation.
Class that consider the case of a translation vector.
vpHomogeneousMatrix get_cMe() const
VISP_EXPORT double measureTimeMs()