Test Viper 650 robot joint and cartesian control.
#include <iostream>
#include <visp3/robot/vpRobotViper650.h>
#ifdef VISP_HAVE_VIPER650
#ifdef ENABLE_VISP_NAMESPACE
#endif
{
for (unsigned int i = 0; i < 3; i++) {
if (std::fabs(t1[i] - t2[i]) > epsilon)
return false;
if (std::fabs(tu1[i] - tu2[i]) > epsilon)
return false;
}
return true;
}
{
for (
unsigned int i = 0; i < q1.
size(); i++) {
if (std::fabs(q1[i] - q2[i]) > epsilon) {
return false;
}
}
return true;
}
int main()
{
try {
#if 0
eMt[0][0] = 0;
eMt[1][0] = 0;
eMt[2][0] = -1;
eMt[0][1] = -sqrt(2)/2;
eMt[1][1] = -sqrt(2)/2;
eMt[2][1] = 0;
eMt[0][2] = -sqrt(2)/2;
eMt[1][2] = sqrt(2)/2;
eMt[2][2] = 0;
eMt[0][3] = -0.177;
eMt[1][3] = 0.177;
eMt[2][3] = 0.077;
#else
#endif
std::cout << "eMt:\n" << eMt << std::endl;
std::cout << "Connection to Viper 650 robot" << std::endl;
std::cout <<
"q: " << q.
t() << std::endl;
robot.get_fMw(q, fMw);
robot.get_fMe(q, fMe);
robot.get_fMc(q, fMt);
std::cout << "fMw:\n" << fMw << std::endl;
std::cout << "fMe:\n" << fMe << std::endl;
std::cout << "fMt:\n" << fMt << std::endl;
std::cout <<
"eMc:\n" << cMe.
inverse() << std::endl;
if (1) {
std::cout << "eMt_:\n" << eMt_ << std::endl;
std::cout << "Compare pose eMt and eMt_:" << std::endl;
if (!pose_equal(eMt, eMt_, 1e-4)) {
std::cout << " Error: Pose eMt differ" << std::endl;
std::cout << "\nTest failed" << std::endl;
return EXIT_FAILURE;
}
std::cout << " They are the same, we can continue" << std::endl;
std::cout <<
"eMc:\n" << cMe.
inverse() << std::endl;
std::cout << "Compare pose eMt and eMc:" << std::endl;
if (!pose_equal(eMt, cMe.
inverse(), 1e-4)) {
std::cout << " Error: Pose eMc differ" << std::endl;
std::cout << "\nTest failed" << std::endl;
return EXIT_FAILURE;
}
std::cout << " They are the same, we can continue" << std::endl;
}
if (1) {
for (unsigned int i = 0; i < 3; i++) {
f_t_t[i] = f_pose_t[i];
f_rxyz_t[i] = f_pose_t[i + 3];
}
std::cout << "fMt_ (from ref frame):\n" << fMt_ << std::endl;
std::cout << "Compare pose fMt and fMt_:" << std::endl;
if (!pose_equal(fMt, fMt_, 1e-4)) {
std::cout << " Error: Pose fMt differ" << std::endl;
std::cout << "\nTest failed" << std::endl;
return EXIT_FAILURE;
}
std::cout << " They are the same, we can continue" << std::endl;
}
if (1) {
robot.getInverseKinematics(fMt, q1);
std::cout << "Move robot in joint (the robot should not move)" << std::endl;
std::cout <<
"Reach joint position q2: " << q2.
t() << std::endl;
std::cout << "Compare joint position q and q2:" << std::endl;
if (!joint_equal(q, q2, 1e-4)) {
std::cout << " Error: Joint position differ" << std::endl;
std::cout << "\nTest failed" << std::endl;
return EXIT_FAILURE;
}
std::cout << " They are the same, we can continue" << std::endl;
}
if (1) {
for (unsigned int i = 0; i < 3; i++) {
f_pose_t[i] = f_t_t[i];
f_pose_t[i + 3] = f_rxyz_t[i];
}
std::cout << "Move robot in reference frame (the robot should not move)" << std::endl;
std::cout <<
"Reach joint position q3: " << q3.
t() << std::endl;
std::cout << "Compare joint position q and q3:" << std::endl;
if (!joint_equal(q, q3, 1e-4)) {
std::cout << " Error: Joint position differ" << std::endl;
std::cout << "\nTest failed" << std::endl;
return EXIT_FAILURE;
}
std::cout << " They are the same, we can continue" << std::endl;
}
if (1) {
tMt[1][3] = 0.05;
robot.getInverseKinematics(fMt_, q);
std::cout << "fMt_:\n" << fMt_ << std::endl;
std::cout << "Move robot in joint position to reach fMt_" << std::endl;
std::cout << "Compare pose fMt_ and fpt_:" << std::endl;
std::cout << " Error: Pose fMt_ differ" << std::endl;
std::cout << "\nTest failed" << std::endl;
return EXIT_FAILURE;
}
std::cout << " They are the same, we can continue" << std::endl;
}
if (1) {
v_t = 0;
std::cout << "Move robot in camera velocity" << std::endl;
}
}
if (1) {
v_t = 0;
std::cout << "Move robot in joint velocity" << std::endl;
}
}
if (1) {
v_t = 0;
std::cout << "Move robot in camera velocity" << std::endl;
}
}
if (1) {
v_t = 0;
std::cout << "Move robot in joint velocity" << std::endl;
}
}
if (1) {
robot.get_fMc(q, fMt);
tMt[1][3] = -0.05;
robot.getInverseKinematics(fMt * tMt, q);
std::cout << "Move robot in joint position" << std::endl;
}
std::cout << "The end" << std::endl;
std::cout << "Test succeed" << std::endl;
return EXIT_SUCCESS;
}
std::cout <<
"Test failed with exception: " << e.
getMessage() << std::endl;
return EXIT_FAILURE;
}
}
#else
int main()
{
std::cout << "The real Viper650 robot controller is not available." << std::endl;
return EXIT_SUCCESS;
}
#endif
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 S650 robot named Viper650.
@ 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()