Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes | List of all members
PTU46::PTU46 Class Reference

PTU46 Pan Tilt Unit Driver Copyright (C) 2009 Erik Karulf (erik@.nosp@m.cse..nosp@m.wustl.nosp@m..edu) More...

#include <ptu46_driver.h>

Public Member Functions

float GetMax (char type)
 
float GetMaxSpeed (char type)
 
float GetMin (char type)
 
float GetMinSpeed (char type)
 
char GetMode ()
 
float GetPosition (char type)
 
float GetResolution (char type)
 
float GetSpeed (char type)
 
bool isOpen ()
 
 PTU46 (const char *port, int rate)
 
bool SetMode (char type)
 
bool SetPosition (char type, float pos, bool Block=false)
 
bool SetSpeed (char type, float speed)
 
 ~PTU46 ()
 

Protected Member Functions

void Disconnect ()
 
int Write (const char *data, int length=0)
 

Protected Attributes

char buffer [PTU46_BUFFER_LEN+1]
 read buffer More...
 
int fd
 serial port descriptor More...
 
struct termios oldtio
 old terminal settings More...
 
float pr
 pan resolution (rads/count) More...
 
float tr
 tilt resolution (rads/count) More...
 

Private Member Functions

int GetLimit (char type, char LimType)
 
float GetRes (char type)
 

Private Attributes

int PMax
 Max Pan in Counts. More...
 
int PMin
 Min Pan in Counts. More...
 
int PSMax
 Max Pan Speed in Counts/second. More...
 
int PSMin
 Min Pan Speed in Counts/second. More...
 
int TMax
 Max Tilt in Counts. More...
 
int TMin
 Min Tilt in Counts. More...
 
int TSMax
 Max Tilt Speed in Counts/second. More...
 
int TSMin
 Min Tilt Speed in Counts/second. More...
 

Detailed Description

PTU46 Pan Tilt Unit Driver Copyright (C) 2009 Erik Karulf (erik@.nosp@m.cse..nosp@m.wustl.nosp@m..edu)

Player - One Hell of a Robot Server Copyright (C) 2000 Brian Gerkey & Kasper Stoy gerke.nosp@m.y@us.nosp@m.c.edu kaspe.nosp@m.rs@r.nosp@m.oboti.nosp@m.cs.u.nosp@m.sc.ed.nosp@m.u

Id:
ptu46.cc 7798 2009-06-06 09:00:59Z thjc

Author: Toby Collett (University of Auckland) Date: 2003-02-10

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Definition at line 58 of file ptu46_driver.h.

Constructor & Destructor Documentation

PTU46::PTU46::PTU46 ( const char *  port,
int  rate 
)

Constructor - opens port

Parameters
portFilename where PTU is connected
raterate Baud rate to use

Definition at line 64 of file ptu46_driver.cc.

PTU46::PTU46::~PTU46 ( )

Definition at line 225 of file ptu46_driver.cc.

Member Function Documentation

void PTU46::PTU46::Disconnect ( )
protected

Cleanly disconnect

Definition at line 229 of file ptu46_driver.cc.

int PTU46::PTU46::GetLimit ( char  type,
char  LimType 
)
private

Get limiting position/speed in counts or counts/second

Parameters
type'p' or 't' (pan or tilt)
LimType{'n', 'x', 'l', 'u'} (min position, max position, min speed, max speed)
Returns
limiting position/speed

Definition at line 282 of file ptu46_driver.cc.

float PTU46::PTU46::GetMax ( char  type)
inline
Parameters
type'p' or 't'
Returns
Maximum position in radians

Definition at line 102 of file ptu46_driver.h.

float PTU46::PTU46::GetMaxSpeed ( char  type)
inline
Parameters
type'p' or 't'
Returns
Maximum speed in radians/second

Definition at line 117 of file ptu46_driver.h.

float PTU46::PTU46::GetMin ( char  type)
inline
Parameters
type'p' or 't'
Returns
Minimum position in radians

Definition at line 95 of file ptu46_driver.h.

float PTU46::PTU46::GetMinSpeed ( char  type)
inline
Parameters
type'p' or 't'
Returns
Minimum speed in radians/second

Definition at line 110 of file ptu46_driver.h.

char PTU46::PTU46::GetMode ( )

Get the control mode, position or velocity

Returns
'v' for velocity, 'i' for position

Definition at line 436 of file ptu46_driver.cc.

float PTU46::PTU46::GetPosition ( char  type)
Parameters
type'p' or 't'
Returns
position in radians

Definition at line 305 of file ptu46_driver.cc.

float PTU46::PTU46::GetRes ( char  type)
private

Get radian/count resolution

Parameters
type'p' or 't'
Returns
pan resolution if type=='p', tilt resolution if type=='t'

Definition at line 259 of file ptu46_driver.cc.

float PTU46::PTU46::GetResolution ( char  type)
inline
Parameters
type'p' or 't'
Returns
resolution in radians/count

Definition at line 87 of file ptu46_driver.h.

float PTU46::PTU46::GetSpeed ( char  type)
Parameters
type'p' or 't'
Returns
speed in radians/second

Definition at line 362 of file ptu46_driver.cc.

bool PTU46::PTU46::isOpen ( )
inline
Returns
true if the ptu is open/ready

Definition at line 67 of file ptu46_driver.h.

bool PTU46::PTU46::SetMode ( char  type)

Set the control mode, position or velocity

Parameters
type'v' for velocity, 'i' for position
Returns
True if successfully sent command

Definition at line 416 of file ptu46_driver.cc.

bool PTU46::PTU46::SetPosition ( char  type,
float  pos,
bool  Block = false 
)

Moves the PTU to the desired position. If Block is true, the call blocks until the desired position is reached

Parameters
type'p' or 't'
posdesired position in radians
Blockblock until ready
Returns
True if successfully sent command

Definition at line 329 of file ptu46_driver.cc.

bool PTU46::PTU46::SetSpeed ( char  type,
float  speed 
)

Sets the desired speed in radians/second

Parameters
type'p' or 't'
speeddesired speed in radians/second
Returns
True if successfully sent command

Definition at line 387 of file ptu46_driver.cc.

int PTU46::PTU46::Write ( const char *  data,
int  length = 0 
)
protected

Write Data to PTU

Parameters
data
lengthnumber of chars (default=0)
Returns
0 if successful, -1 if failure

Definition at line 239 of file ptu46_driver.cc.

Member Data Documentation

char PTU46::PTU46::buffer[PTU46_BUFFER_LEN+1]
protected

read buffer

Definition at line 190 of file ptu46_driver.h.

int PTU46::PTU46::fd
protected

serial port descriptor

Definition at line 187 of file ptu46_driver.h.

struct termios PTU46::PTU46::oldtio
protected

old terminal settings

Definition at line 188 of file ptu46_driver.h.

int PTU46::PTU46::PMax
private

Max Pan in Counts.

Definition at line 175 of file ptu46_driver.h.

int PTU46::PTU46::PMin
private

Min Pan in Counts.

Definition at line 174 of file ptu46_driver.h.

float PTU46::PTU46::pr
protected

pan resolution (rads/count)

Definition at line 185 of file ptu46_driver.h.

int PTU46::PTU46::PSMax
private

Max Pan Speed in Counts/second.

Definition at line 181 of file ptu46_driver.h.

int PTU46::PTU46::PSMin
private

Min Pan Speed in Counts/second.

Definition at line 180 of file ptu46_driver.h.

int PTU46::PTU46::TMax
private

Max Tilt in Counts.

Definition at line 173 of file ptu46_driver.h.

int PTU46::PTU46::TMin
private

Min Tilt in Counts.

Definition at line 172 of file ptu46_driver.h.

float PTU46::PTU46::tr
protected

tilt resolution (rads/count)

Definition at line 184 of file ptu46_driver.h.

int PTU46::PTU46::TSMax
private

Max Tilt Speed in Counts/second.

Definition at line 179 of file ptu46_driver.h.

int PTU46::PTU46::TSMin
private

Min Tilt Speed in Counts/second.

Definition at line 178 of file ptu46_driver.h.


The documentation for this class was generated from the following files:


ptu46
Author(s): Erik Karulf, David Lu
autogenerated on Mon Mar 2 2015 01:32:49