52 #include <visp3/core/vpConfig.h>
53 #include <visp3/core/vpDebug.h>
55 #ifdef VISP_HAVE_AFMA4
60 #include <visp3/io/vpParseArgv.h>
61 #include <visp3/robot/vpRobotAfma4.h>
64 #define GETOPTARGS "mh"
74 void usage(
const char *name,
const char *badparam)
77 Example of a positioning control followed by a velocity control \n\
78 of the Afma4 robot.\n\
88 Turn off the control of the robot. This option is\n\
89 essentially useful for security reasons during nightly\n\
93 Print the help.\n\n");
96 fprintf(stderr,
"ERROR: \n");
97 fprintf(stderr,
"\nBad parameter [%s]\n", badparam);
112 bool getOptions(
int argc,
const char **argv,
bool &control)
123 usage(argv[0],
nullptr);
128 usage(argv[0], optarg);
134 if ((c == 1) || (c == -1)) {
136 usage(argv[0],
nullptr);
137 std::cerr <<
"ERROR: " << std::endl;
138 std::cerr <<
" Bad argument " << optarg << std::endl << std::endl;
145 int main(
int argc,
const char **argv)
151 if (getOptions(argc, argv, control) ==
false) {
168 std::cout <<
"Position control: in articular..." << std::endl;
169 std::cout <<
" position to reach: " << qd.t() << std::endl;
176 std::cout <<
" measured position: " << q.t();
185 std::cout <<
"Velocity control: in articular..." << std::endl;
189 std::cout <<
" rotation around vertical axis: " << q[0] << std::endl;
196 std::cout <<
" vertical translation: " << q[1] << std::endl;
203 std::cout <<
" vertical translation: " << q[1] << std::endl;
209 std::cout <<
" pan rotation: " << q[2] << std::endl;
216 std::cout <<
" tilt rotation: " << q[3] << std::endl;
225 std::cout <<
"Velocity control: in camera frame..." << std::endl;
229 std::cout <<
" rx rotation: " << q[0] << std::endl;
237 std::cout <<
" ry rotation: " << q[1] << std::endl;
242 std::cout <<
"The end" << std::endl;
245 std::cout <<
"Catch a ViSP exception: " << e << std::endl;
252 std::cout <<
"You do not have an afma4 robot connected to your computer..." << std::endl;
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
static double rad(double deg)
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
Control of Irisa's cylindrical robot named Afma4.
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)