59 #include <visp/vpConfig.h>
60 #include <visp/vpDebug.h>
62 #ifdef VISP_HAVE_AFMA4
64 #include <visp/vpParseArgv.h>
65 #include <visp/vpRobotAfma4.h>
68 #define GETOPTARGS "mh"
78 void usage(
const char *name,
const char *badparam)
81 Example of a positionning control followed by a velocity control \n\
82 of the Afma4 robot.\n \
91 Turn off the control of the robot. This option is\n\
92 essentially useful for security reasons during nightly\n\
96 Print the help.\n\n");
99 fprintf(stderr,
"ERROR: \n" );
100 fprintf(stderr,
"\nBad parameter [%s]\n", badparam);
116 bool getOptions(
int argc,
const char **argv,
bool &control)
123 case 'm': control =
false;
break;
124 case 'h': usage(argv[0], NULL);
return false;
break;
127 usage(argv[0], optarg);
return false;
break;
131 if ((c == 1) || (c == -1)) {
133 usage(argv[0], NULL);
134 std::cerr <<
"ERROR: " << std::endl;
135 std::cerr <<
" Bad argument " << optarg << std::endl << std::endl;
143 main(
int argc,
const char ** argv)
150 if (getOptions(argc, argv, control) ==
false) {
167 std::cout <<
"Position control: in articular..." << std::endl;
168 std::cout <<
" position to reach: " << qd.t() << std::endl;
176 std::cout <<
" measured position: " << q.t() ;
184 std::cout <<
"Velocity control: in articular..." << std::endl;
188 std::cout <<
" rotation arround vertical axis: " << q[0] << std::endl;
195 std::cout <<
" vertical translation: " << q[1] << std::endl;
202 std::cout <<
" vertical translation: " << q[1] << std::endl;
208 std::cout <<
" pan rotation: " << q[2] << std::endl;
215 std::cout <<
" tilt rotation: " << q[3] << std::endl;
224 std::cout <<
"Velocity control: in camera frame..." << std::endl;
228 std::cout <<
" rx rotation: " << q[0] << std::endl;
236 std::cout <<
" ry rotation: " << q[1] << std::endl;
241 std::cout <<
"The end" << std::endl;
252 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.
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.