55 #include <visp3/core/vpConfig.h> 56 #include <visp3/core/vpDebug.h> 58 #ifdef VISP_HAVE_AFMA4 63 #include <visp3/io/vpParseArgv.h> 64 #include <visp3/robot/vpRobotAfma4.h> 67 #define GETOPTARGS "mh" 77 void usage(
const char *name,
const char *badparam)
80 Example of a positionning control followed by a velocity control \n\ 81 of the Afma4 robot.\n \ 90 Turn off the control of the robot. This option is\n\ 91 essentially useful for security reasons during nightly\n\ 95 Print the help.\n\n");
98 fprintf(stderr,
"ERROR: \n");
99 fprintf(stderr,
"\nBad parameter [%s]\n", badparam);
114 bool getOptions(
int argc,
const char **argv,
bool &control)
125 usage(argv[0], NULL);
130 usage(argv[0], optarg);
136 if ((c == 1) || (c == -1)) {
138 usage(argv[0], NULL);
139 std::cerr <<
"ERROR: " << std::endl;
140 std::cerr <<
" Bad argument " << optarg << std::endl << std::endl;
147 int main(
int argc,
const char **argv)
153 if (getOptions(argc, argv, control) ==
false) {
170 std::cout <<
"Position control: in articular..." << std::endl;
171 std::cout <<
" position to reach: " << qd.t() << std::endl;
178 std::cout <<
" measured position: " << q.t();
187 std::cout <<
"Velocity control: in articular..." << std::endl;
191 std::cout <<
" rotation arround vertical axis: " << q[0] << std::endl;
198 std::cout <<
" vertical translation: " << q[1] << std::endl;
205 std::cout <<
" vertical translation: " << q[1] << std::endl;
211 std::cout <<
" pan rotation: " << q[2] << std::endl;
218 std::cout <<
" tilt rotation: " << q[3] << std::endl;
227 std::cout <<
"Velocity control: in camera frame..." << std::endl;
231 std::cout <<
" rx rotation: " << q[0] << std::endl;
239 std::cout <<
" ry rotation: " << q[1] << std::endl;
244 std::cout <<
"The end" << std::endl;
247 std::cout <<
"Catch a ViSP exception: " << e << std::endl;
254 std::cout <<
"You do not have an afma4 robot connected to your computer..." << std::endl;
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &velocity)
Initialize the position controller.
error that can be emited by ViSP classes.
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
void setPosition(const vpRobot::vpControlFrameType frame, const vpColVector &position)
Initialize the velocity controller.
void getPosition(const vpRobot::vpControlFrameType frame, vpColVector &position)
static const unsigned int njoint
Number of joint.
static double rad(double deg)
vpRobot::vpRobotStateType setRobotState(vpRobot::vpRobotStateType newState)
Implementation of column vector and the associated operations.
Control of Irisa's cylindrical robot named Afma4.