46 #include <visp3/core/vpTime.h>
47 #include <visp3/robot/vpVirtuose.h>
48 #include <visp3/robot/vpRobotAfma6.h>
52 #if defined(VISP_HAVE_VIRTUOSE) && defined(VISP_HAVE_AFMA6)
67 float force_limit = 15;
68 int force_increase_rate = 500;
70 double cube_size = 0.15;
73 rMv[0][0] = rMv[0][2] = 0;
74 rMv[1][1] = rMv[1][2] = 0;
75 rMv[2][0] = rMv[2][1] = 0;
76 rMv[0][1] = rMv[1][0] = rMv[2][2] = -1;
77 std::cout <<
"rMv:\n" << rMv << std::endl;
92 for (
unsigned int i=0; i<3; i++) {
93 min[i] = robot_cart_position_init[i] - cube_size/2;
94 max[i] = robot_cart_position_init[i] + cube_size/2;
96 std::cout <<
"min: " << min.
t() << std::endl;
97 std::cout <<
"max: " << max.
t() << std::endl;
102 for(
unsigned int iter=0; iter<10000; iter++) {
104 std::cout <<
"Virtuose velocity: " << virt_velocity.
t() << std::endl;
108 for (
int i=0; i < 3; i++) {
109 if (robot_cart_position[i] >= max[i])
111 force_feedback_robot[i] = (max[i] - robot_cart_position[i]) * force_increase_rate;
112 if (force_feedback_robot[i] <= -force_limit) force_feedback_robot[i] = -force_limit;
114 else if (robot_cart_position[i] <= min[i])
116 force_feedback_robot[i] = (min[i] - robot_cart_position[i]) * force_increase_rate;
117 if (force_feedback_robot[i] >= force_limit) force_feedback_robot[i] = force_limit;
120 force_feedback_robot[i] = 0;
125 std::cout <<
"Force feedback: " << force_feedback_virt.
t() << std::endl;
127 robot_velocity = rVv * virt_velocity;
132 force_feedback.insert(0, force_feedback_virt);
140 std::cout <<
"The end" << std::endl;
147 std::cout <<
"You should install Virtuose SDK to use this binary..." << std::endl;
VISP_EXPORT int wait(double t0, double t)
vpRotationMatrix inverse() const
Implementation of an homogeneous matrix and operations on such kind of matrices.
void setPosition(const vpRobot::vpControlFrameType frame, const vpPoseVector &pose)
Initialize the position controller.
error that can be emited by ViSP classes.
void setForce(const vpColVector &force)
void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &position)
void setPositioningVelocity(const double velocity)
Control of Irisa's gantry robot named Afma6.
Initialize the velocity controller.
vpRotationMatrix getRotationMatrix() const
void setVerbose(bool mode)
void setCommandType(const VirtCommandType &type)
vpColVector getVelocity() const
vpRobot::vpRobotStateType setRobotState(vpRobot::vpRobotStateType newState)
Implementation of a velocity twist matrix and operations on such kind of matrices.
Perspective projection with distortion model.
Implementation of column vector and the associated operations.
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &velocity)
const std::string & getStringMessage(void) const
Send a reference (constant) related the error message (can be empty).