42 #include <visp3/core/vpTime.h>
43 #include <visp3/robot/vpRobotAfma6.h>
44 #include <visp3/robot/vpVirtuose.h>
48 #ifdef ENABLE_VISP_NAMESPACE
51 #if defined(VISP_HAVE_VIRTUOSE) && defined(VISP_HAVE_AFMA6)
66 float force_limit = 15;
67 int force_increase_rate = 500;
69 double cube_size = 0.15;
72 rMv[0][0] = rMv[0][2] = 0;
73 rMv[1][1] = rMv[1][2] = 0;
74 rMv[2][0] = rMv[2][1] = 0;
75 rMv[0][1] = rMv[1][0] = rMv[2][2] = -1;
76 std::cout <<
"rMv:\n" << rMv << std::endl;
86 robot.setPositioningVelocity(10);
91 for (
unsigned int i = 0; i < 3; i++) {
92 min[i] = robot_cart_position_init[i] - cube_size / 2;
93 max[i] = robot_cart_position_init[i] + cube_size / 2;
95 std::cout <<
"min: " << min.
t() << std::endl;
96 std::cout <<
"max: " << max.
t() << std::endl;
101 for (
unsigned int iter = 0; iter < 10000; iter++) {
103 std::cout <<
"Virtuose velocity: " << virt_velocity.
t() << std::endl;
107 for (
int i = 0; i < 3; i++) {
108 if (robot_cart_position[i] >= max[i]) {
109 force_feedback_robot[i] = (max[i] - robot_cart_position[i]) * force_increase_rate;
110 if (force_feedback_robot[i] <= -force_limit)
111 force_feedback_robot[i] = -force_limit;
113 else if (robot_cart_position[i] <= min[i]) {
114 force_feedback_robot[i] = (min[i] - robot_cart_position[i]) * force_increase_rate;
115 if (force_feedback_robot[i] >= force_limit)
116 force_feedback_robot[i] = force_limit;
119 force_feedback_robot[i] = 0;
124 std::cout <<
"Force feedback: " << force_feedback_virt.
t() << std::endl;
126 robot_velocity = rVv * virt_velocity;
131 force_feedback.insert(0, force_feedback_virt);
139 std::cout <<
"The end" << std::endl;
146 std::cout <<
"You should install Virtuose SDK to use this binary..." << std::endl;
@ perspectiveProjWithDistortion
Perspective projection with distortion model.
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
const std::string & getStringMessage() const
Implementation of an homogeneous matrix and operations on such kind of matrices.
vpRotationMatrix getRotationMatrix() const
Control of Irisa's gantry robot named Afma6.
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel) VP_OVERRIDE
@ STATE_POSITION_CONTROL
Initialize the position controller.
@ STATE_VELOCITY_CONTROL
Initialize the velocity controller.
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)
vpRotationMatrix inverse() const
vpColVector getVelocity() const
void setForce(const vpColVector &force)
void setCommandType(const VirtCommandType &type)
void setVerbose(bool mode)
VISP_EXPORT int wait(double t0, double t)