65 #include <visp/vpMath.h>
66 #include <visp/vpHomogeneousMatrix.h>
67 #include <visp/vpFeatureThetaU.h>
68 #include <visp/vpFeatureTranslation.h>
69 #include <visp/vpServo.h>
70 #include <visp/vpRobotCamera.h>
71 #include <visp/vpDebug.h>
72 #include <visp/vpParseArgv.h>
78 #define GETOPTARGS "h"
88 void usage(
const char *name,
const char *badparam)
91 Simulation of avisual servoing using theta U visual feature:\n\
92 - eye-in-hand control law,\n\
93 - velocity computed in the camera frame,\n\
106 fprintf(stdout,
"\nERROR: Bad parameter [%s]\n", badparam);
119 bool getOptions(
int argc,
const char **argv)
126 case 'h': usage(argv[0], NULL);
return false;
break;
129 usage(argv[0], optarg);
134 if ((c == 1) || (c == -1)) {
136 usage(argv[0], NULL);
137 std::cerr <<
"ERROR: " << std::endl;
138 std::cerr <<
" Bad argument " << optarg << std::endl << std::endl;
146 main(
int argc,
const char ** argv)
149 if (getOptions(argc, argv) ==
false) {
156 std::cout << std::endl ;
157 std::cout <<
"-------------------------------------------------------" << std::endl ;
158 std::cout <<
" Test program for vpServo " <<std::endl ;
159 std::cout <<
" Eye-in-hand task control, velocity computed in the camera frame" << std::endl ;
160 std::cout <<
" Simulation " << std::endl ;
161 std::cout <<
" task : servo using theta U visual feature " << std::endl ;
162 std::cout <<
"-------------------------------------------------------" << std::endl ;
163 std::cout << std::endl ;
166 vpTRACE(
"sets the initial camera location " ) ;
177 vpTRACE(
"sets the desired camera location " ) ;
183 vpTRACE(
"compute the rotation that the camera has to realize " ) ;
191 vpTRACE(
"\t we want an eye-in-hand control law") ;
192 vpTRACE(
"\t robot is controlled in the camera frame") ;
202 vpTRACE(
"Display task information " ) ;
205 unsigned int iter=0 ;
209 std::cout <<
"---------------------------------------------" << iter <<std::endl ;
212 if (iter==1)
vpTRACE(
"\t\t get the robot position ") ;
215 if (iter==1)
vpTRACE(
"\t\t new rotation to realize ") ;
220 if (iter==1)
vpTRACE(
"\t\t compute the control law ") ;
222 if (iter==1) task.
print() ;
224 if (iter==1)
vpTRACE(
"\t\t send the camera velocity to the controller ") ;
228 std::cout << ( task.
getError() ).sumSquare() <<std::endl ; ;
231 vpTRACE(
"Display task information " ) ;
The class provides a data structure for the homogeneous matrices as well as a set of operations on th...
void addFeature(vpBasicFeature &s, vpBasicFeature &s_star, const unsigned int select=vpBasicFeature::FEATURE_ALL)
create a new ste of two visual features
void setLambda(double _lambda)
set the gain lambda
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel)
static bool parse(int *argcPtr, const char **argv, vpArgvInfo *argTable, int flags)
void kill()
destruction (memory deallocation if required)
vpColVector getError() const
vpColVector computeControlLaw()
compute the desired control law
Class that defines the simplest robot: a free flying camera.
void getPosition(vpColVector &q)
void setPosition(const vpRobot::vpControlFrameType, const vpColVector &)
Set a displacement (frame has to be specified) in position control.
void buildFrom(const vpTranslationVector &t, const vpRotationMatrix &R)
Construction from translation vector and rotation matrix.
void setInteractionMatrixType(const vpServoIteractionMatrixType &interactionMatrixType, const vpServoInversionType &interactionMatrixInversion=PSEUDO_INVERSE)
Set the type of the interaction matrix (current, mean, desired, user).
static double rad(double deg)
Class that provides a data structure for the column vectors as well as a set of operations on these v...
The pose is a complete representation of every rigid motion in the euclidian space.
vpHomogeneousMatrix inverse() const
Class that defines a 3D visual feature from a axis/angle parametrization that represent the rotatio...
void print(const vpServo::vpServoPrintType display_level=ALL, std::ostream &os=std::cout)
Class required to compute the visual servoing control law.
void setServo(vpServoType _servo_type)
Choice of the visual servoing control law.