38 #include <PanTilt/DPPanTiltControl.hh>
43 int main(
int argc,
char *argv[])
53 cout <<
"Initialising PTU failed!" << endl;
58 panTiltControl.
SetMode(ABSOLUTEMODE);
63 if (argv[2][0] ==
'-' && argv[2][1] ==
'r') {
65 cout <<
"Reset pan-tilt unit." << endl;
73 int actPan = -DPPTU_MINPAN;
76 panTiltControl.
SetSpeed(DPPTU_MAXSPEED/10, DPPTU_MAXSPEED/10);
80 actPan = (int)((
double)degree/panTiltControl.
GetPanResolution()) + DPPTU_MINPAN;
82 if (actPan > DPPTU_MAXPAN || actTilt > DPPTU_MAXTILT ||
83 actPan < DPPTU_MINPAN || actTilt < DPPTU_MINTILT) {
93 <<
" degree reached. Continue? (y/n) ";
96 if (input ==
'N' || input ==
'n') quit =
true;
void AwaitCompletion()
Await completion of currently executed command.
char SetSpeed(int nPanSpeed, int nTiltSpeed)
Set speed for movement.
Basic controller interface for Directed Perception Pan Tilt Unit.
void SetPosition(int nPanPos, int nTiltPos, bool bWaitComplete=true)
Set the current position of the PTU in steps.
int SetMode(int nMode)
Set the mode in which the camera is to operate.
void ClosePanTiltUnit()
closes the comport stream connected to PTU
double GetPanResolution()
Get the resolution of the pan axis.
bool InitPanTiltUnit(int nPort, bool bUSB=false)
Open the given serial port and initialize the pan tilt unit.
char SetAcceleration(int nPanAcc, int nTiltAcc)
Set acceleration for movement.