Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions | Private Attributes
PTU46::PTU46 Class Reference

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

#include <ptu46_driver.h>

List of all members.

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
int fd
 serial port descriptor
struct termios oldtio
 old terminal settings
float pr
 pan resolution (rads/count)
float tr
 tilt resolution (rads/count)

Private Member Functions

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

Private Attributes

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

Detailed Description

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

Player - One Hell of a Robot Server Copyright (C) 2000 Brian Gerkey & Kasper Stoy gerkey@usc.edu kaspers@robotics.usc.edu

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 52 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 59 of file ptu46_driver.cc.

Definition at line 220 of file ptu46_driver.cc.


Member Function Documentation

void PTU46::PTU46::Disconnect ( ) [protected]

Cleanly disconnect

Definition at line 224 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 277 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 96 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 111 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 89 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 104 of file ptu46_driver.h.

Get the control mode, position or velocity

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

Definition at line 431 of file ptu46_driver.cc.

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

Definition at line 300 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 254 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 81 of file ptu46_driver.h.

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

Definition at line 357 of file ptu46_driver.cc.

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

Definition at line 61 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 411 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 324 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 382 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 234 of file ptu46_driver.cc.


Member Data Documentation

read buffer

Definition at line 184 of file ptu46_driver.h.

int PTU46::PTU46::fd [protected]

serial port descriptor

Definition at line 181 of file ptu46_driver.h.

struct termios PTU46::PTU46::oldtio [protected]

old terminal settings

Definition at line 182 of file ptu46_driver.h.

int PTU46::PTU46::PMax [private]

Max Pan in Counts.

Definition at line 169 of file ptu46_driver.h.

int PTU46::PTU46::PMin [private]

Min Pan in Counts.

Definition at line 168 of file ptu46_driver.h.

float PTU46::PTU46::pr [protected]

pan resolution (rads/count)

Definition at line 179 of file ptu46_driver.h.

int PTU46::PTU46::PSMax [private]

Max Pan Speed in Counts/second.

Definition at line 175 of file ptu46_driver.h.

int PTU46::PTU46::PSMin [private]

Min Pan Speed in Counts/second.

Definition at line 174 of file ptu46_driver.h.

int PTU46::PTU46::TMax [private]

Max Tilt in Counts.

Definition at line 167 of file ptu46_driver.h.

int PTU46::PTU46::TMin [private]

Min Tilt in Counts.

Definition at line 166 of file ptu46_driver.h.

float PTU46::PTU46::tr [protected]

tilt resolution (rads/count)

Definition at line 178 of file ptu46_driver.h.

int PTU46::PTU46::TSMax [private]

Max Tilt Speed in Counts/second.

Definition at line 173 of file ptu46_driver.h.

int PTU46::PTU46::TSMin [private]

Min Tilt Speed in Counts/second.

Definition at line 172 of file ptu46_driver.h.


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


ptu46
Author(s): Erik Karulf, David V. Lu!!
autogenerated on Fri Aug 28 2015 12:58:57