Simple example for usage of Directed Perception PTUMaximal pan positions (left,right) are -3091,+3019 = -159,+159 degree Maximal tilt positions (down,up) are -913,+602 = -47,+31 degree Resolution degree per position is 0.051428 Maximal unloaded speed is 5833 positions/second = 300 degree/second
- Author
- MIP
#include <PanTilt/DPPanTiltControl.hh>
using namespace BIAS;
using namespace std;
int main(int argc, char *argv[])
{
bool bRet = false;
if (argc < 2)
else
if (!bRet) {
cout << "Initialising PTU failed!" << endl;
return -1;
}
panTiltControl.
SetMode(ABSOLUTEMODE);
if (argc > 2) {
if (argv[2][0] == '-' && argv[2][1] == 'r') {
cout << "Reset pan-tilt unit." << endl;
return 0;
}
}
bool quit = false;
char input;
int actPan = -DPPTU_MINPAN;
int actTilt = 0;
int degree = 0;
panTiltControl.
SetSpeed(DPPTU_MAXSPEED/10, DPPTU_MAXSPEED/10);
while (!quit) {
actPan = (int)((
double)degree/panTiltControl.
GetPanResolution()) + DPPTU_MINPAN;
if (actPan > DPPTU_MAXPAN || actTilt > DPPTU_MAXTILT ||
actPan < DPPTU_MINPAN || actTilt < DPPTU_MINTILT) {
quit = true;
break;
}
<< " degree reached. Continue? (y/n) ";
cin >> input;
cout << endl;
if (input == 'N' || input == 'n') quit = true;
degree += 5;
}
return 0;
}