25 #ifndef PanTiltControlInterface_HH_
26 #define PanTiltControlInterface_HH_
28 #include <PanTilt/DPPanTiltControl.hh>
47 virtual void StartControl() = 0;
50 virtual void StopControl() = 0;
53 virtual void ResumeControl() = 0;
56 virtual void StartMoveTo(
const long int pan,
const long int tilt) {};
64 bool bRet = ptControl.InitPanTiltUnit(device.c_str());
66 std::cout <<
"PanTiltControlInterface : Initialising PTU failed!" << std::endl;
71 ptControl.SendRawCommand(
"PU2000 PA2000 PB60 TU2000 TA2000 TB60 PMR TMR %%1R600 DS\n");
75 while (ptControl.ReadRawLine(s) != 0) {
76 std::cout <<
"Read from PTU controller : " << s.c_str() << std::endl;
78 ptControl.SetMode(ABSOLUTEMODE);
80 ptControl.SetSpeed(DPPTU_MAXSPEED, DPPTU_MAXSPEED);
81 ptControl.SetPosition(0,0);
83 ptControl.GetCurrentPosition(cur_pan, cur_tilt);
84 ptControl.GetCurrentPosition(cur_pan, cur_tilt);
85 ptControl.QueryResolution(presolution,tresolution);
91 ptControl.SetMode(ABSOLUTEMODE);
92 ptControl.SetSpeed(DPPTU_MAXSPEED/4, DPPTU_MAXSPEED/4);
93 ptControl.SetPosition(0,0);
95 ptControl.ClosePanTiltUnit();
108 panDegree = -cur_pan * presolution * M_PI / 180.0f;
109 tiltDegree = cur_tilt * tresolution * M_PI / 180.0f;
113 void SetPosition(
long int pan,
long int tilt,
bool waitComplete =
true)
115 ptControl.SetMode(ABSOLUTEMODE);
117 ptControl.SetPosition(pan, tilt, waitComplete);
126 ptControl.GetCurrentPosition(cur_pan, cur_tilt);
151 #endif // PanTiltControlInterface_HH_
abstract control class for control of Directed Perception Pan Tilt Unit.
Basic controller interface for Directed Perception Pan Tilt Unit.
virtual ~PanTiltControlFactory()
BIAS::DPPanTiltControl ptControl
static double presolution
static void GetPosition(long int &pan, long int &tilt)
Get position, values should be updated by derived classes.
static void GetPositionDegrees(double &panDegree, double &tiltDegree)
Get position in degrees, values should be updated by derived classes.
void SetPosition(long int pan, long int tilt, bool waitComplete=true)
Set the position to move to.
static double tresolution
virtual ~PanTiltControlInterface()
Default destructor.
void AwaitCompletion()
Waits until the current command is completed.
virtual PanTiltControlInterface * Create(std::string device, bool heavyDutyMode)=0
virtual void StartMoveTo(const long int pan, const long int tilt)
Starts movement to given pan and tilt position.
Abstract controller factory used to create all different kinds of PTU controls.
PanTiltControlInterface(std::string device, bool heavyDutyMode)
Initialize PTU, called by derived classes.