58 #include <visp/vpConfig.h>
59 #include <visp/vpDebug.h>
61 #ifdef VISP_HAVE_AFMA4
66 #include <visp/vpParseArgv.h>
67 #include <visp/vpRobotAfma4.h>
70 #define GETOPTARGS "mh"
80 void usage(
const char *name,
const char *badparam)
83 Example of a positionning control followed by a velocity control \n\
84 of the Afma4 robot.\n \
93 Turn off the control of the robot. This option is\n\
94 essentially useful for security reasons during nightly\n\
98 Print the help.\n\n");
101 fprintf(stderr,
"ERROR: \n" );
102 fprintf(stderr,
"\nBad parameter [%s]\n", badparam);
118 bool getOptions(
int argc,
const char **argv,
bool &control)
125 case 'm': control =
false;
break;
126 case 'h': usage(argv[0], NULL);
return false;
break;
129 usage(argv[0], optarg);
return false;
break;
133 if ((c == 1) || (c == -1)) {
135 usage(argv[0], NULL);
136 std::cerr <<
"ERROR: " << std::endl;
137 std::cerr <<
" Bad argument " << optarg << std::endl << std::endl;
145 main(
int argc,
const char ** argv)
152 if (getOptions(argc, argv, control) ==
false) {
169 std::cout <<
"Position control: in articular..." << std::endl;
170 std::cout <<
" position to reach: " << qd.t() << std::endl;
178 std::cout <<
" measured position: " << q.t() ;
186 std::cout <<
"Velocity control: in articular..." << std::endl;
190 std::cout <<
" rotation arround vertical axis: " << q[0] << std::endl;
197 std::cout <<
" vertical translation: " << q[1] << std::endl;
204 std::cout <<
" vertical translation: " << q[1] << std::endl;
210 std::cout <<
" pan rotation: " << q[2] << std::endl;
217 std::cout <<
" tilt rotation: " << q[3] << std::endl;
226 std::cout <<
"Velocity control: in camera frame..." << std::endl;
230 std::cout <<
" rx rotation: " << q[0] << std::endl;
238 std::cout <<
" ry rotation: " << q[1] << std::endl;
243 std::cout <<
"The end" << std::endl;
247 std::cout <<
"Catch a ViSP exception: " << e << std::endl;
255 vpERROR_TRACE(
"You do not have an afma4 robot connected to your computer...");
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)
Class that provides a data structure for the column vectors as well as a set of operations on these v...
Control of Irisa's cylindrical robot named Afma4.