Example of a real robot control, the ptu-46 robot (pan-tilt turret). The robot is controlled first in position, then in velocity.
#include <visp3/core/vpConfig.h>
#include <visp3/core/vpDebug.h>
#if !defined(_WIN32) && (defined(__unix__) || defined(__unix) || (defined(__APPLE__) && defined(__MACH__)))
#include <unistd.h>
#endif
#ifdef VISP_HAVE_PTU46
#include <visp3/robot/vpRobotPtu46.h>
int main()
{
#ifdef ENABLE_VISP_NAMESPACE
#endif
try {
vpERROR_TRACE(" ");
q = 0;
vpCTRACE <<
"Set position in the articular frame: " << q.
t();
vpCTRACE <<
"Set position in the articular frame: " << q.
t();
vpCTRACE <<
"Position in the articular frame " << qm.
t();
#if 0
qdot = 0;
vpCTRACE <<
"Set camera frame velocity " << qdot.
t();
sleep(2);
qdot = 0;
vpCTRACE <<
"Set camera frame velocity " << qdot.
t();
sleep(2);
#endif
qdot = 0;
vpCTRACE <<
"Set articular frame velocity " << qdot.
t();
sleep(2);
qdot = 0;
vpCTRACE <<
"Set articular frame velocity " << qdot.
t();
sleep(2);
}
std::cout << "Sorry PtU46 not available. Got exception: " << e << std::endl;
return EXIT_FAILURE
}
return EXIT_SUCCESS;
}
#else
int main()
{
std::cout << "You do not have an PTU46 PT robot connected to your computer..." << std::endl;
return EXIT_SUCCESS;
}
#endif
Implementation of column vector and the associated operations.
error that can be emitted by ViSP classes.
static double rad(double deg)
void setVelocity(const vpRobot::vpControlFrameType frame, const vpColVector &vel) VP_OVERRIDE
Interface for the Directed Perception ptu-46 pan, tilt head .
@ STATE_POSITION_CONTROL
Initialize the position controller.
@ STATE_VELOCITY_CONTROL
Initialize the velocity controller.
virtual vpRobotStateType setRobotState(const vpRobot::vpRobotStateType newState)