Main MRPT website > C++ reference
MRPT logo
Public Member Functions | Protected Member Functions | Protected Attributes | Private Member Functions

mrpt::hwdrivers::CServoeNeck Class Reference


Detailed Description

Definition at line 40 of file CServoeNeck.h.

#include <mrpt/hwdrivers/CServoeNeck.h>

Inheritance diagram for mrpt::hwdrivers::CServoeNeck:
Inheritance graph
[legend]

List of all members.

Public Member Functions

 CServoeNeck ()
 ~CServoeNeck ()
bool queryFirmwareVersion (std::string &out_firmwareVersion)
 Gets the firmware version of the eNeck board.
bool getCurrentAngle (double &angle, const uint8_t servo=0)
 Gets the current angle of the servo (in radians within (-pi,pi))
bool setAngle (double angle, const uint8_t servo=0, bool fast=false)
 Turns the servo up to the specified angle (in radians in the range -pi,pi, other values will be saturated to the maximum or the mininum)
bool setAngleWithFilter (double angle, const uint8_t servo=0, bool fast=false)
 Turns the servo up to the specified angle (in radians in the range -pi,pi) filtered by average with the last N specified angles.
bool disableServo (const uint8_t servo=0)
 Disables the servo so the neck will be loose.
bool enableServo (const uint8_t servo=0)
 Enables the servo so the neck will be tight.
bool center (const uint8_t servo=0)
 Centers the servo at zero position.
double getTruncateFactor ()
 Gets the truncate factor of the turn.
void setTruncateFactor (const double factor)
 Gets the truncate factor of the turn.
void setNumberOfPreviousAngles (const unsigned int number)
 Gets the truncate factor of the turn.
unsigned int getNumberOfPreviousAngles ()
 Gets the truncate factor of the turn.

Protected Member Functions

bool setRegisterValue (const uint16_t value, const uint8_t servo=0, bool fast=false)
bool getRegisterValue (uint16_t &value, const uint8_t servo=0)

Protected Attributes

std::string m_usbSerialNumber
 A copy of the device serial number (to open the USB FTDI chip).
double m_MaxValue
 The value set in the ICR register within the ATMEGA16 controller.
double m_TruncateFactor
 The range of turn of the servo will be truncated to "+-m_truncate_factor*(pi/2)".
std::deque< double > m_PrevAngles
 A vector containing the last N angles which where passed to the servo (for averaging)
unsigned int m_NumPrevAngles
 Number of previous angles to store for averaging.

Private Member Functions

unsigned int angle2RegValue (const double angle)
 Converts from a decimal angle (in radians) to the corresponding register value for the ATMEGA16 controller (for inner use only).
double regValue2angle (const uint16_t value)
 Converts from a certain value of the ATMEGA16 PWM register to the corresponding decimal angle (for inner use only).
bool checkConnectionAndConnect ()
 Tries to connect to the USB device (if disconnected).

Constructor & Destructor Documentation

mrpt::hwdrivers::CServoeNeck::CServoeNeck ( )
mrpt::hwdrivers::CServoeNeck::~CServoeNeck ( )

Member Function Documentation

unsigned int mrpt::hwdrivers::CServoeNeck::angle2RegValue ( const double  angle) [private]

Converts from a decimal angle (in radians) to the corresponding register value for the ATMEGA16 controller (for inner use only).

Parameters:
Theangle to convert.
Returns:
The value of the register to send.
bool mrpt::hwdrivers::CServoeNeck::center ( const uint8_t  servo = 0)

Centers the servo at zero position.

bool mrpt::hwdrivers::CServoeNeck::checkConnectionAndConnect ( ) [private]

Tries to connect to the USB device (if disconnected).

Returns:
True on connection OK, false on error.
bool mrpt::hwdrivers::CServoeNeck::disableServo ( const uint8_t  servo = 0)

Disables the servo so the neck will be loose.

Parameters:
Servo,:the id of the servo to move (in our ATMEGA16, from 0 to 2).
Returns:
Whether or not the procedure succeded.
bool mrpt::hwdrivers::CServoeNeck::enableServo ( const uint8_t  servo = 0)

Enables the servo so the neck will be tight.

Parameters:
Servo,:the id of the servo to move (in our ATMEGA16, from 0 to 2).
Returns:
Whether or not the procedure succeded.
bool mrpt::hwdrivers::CServoeNeck::getCurrentAngle ( double &  angle,
const uint8_t  servo = 0 
)

Gets the current angle of the servo (in radians within (-pi,pi))

Parameters:
Angle,:[OUT] The current angle.
Servo,:[IN] The id of the servo (in our ATMEGA16, from 0 to 2).
Returns:
Whether or not the procedure succeded.
unsigned int mrpt::hwdrivers::CServoeNeck::getNumberOfPreviousAngles ( ) [inline]

Gets the truncate factor of the turn.

Definition at line 105 of file CServoeNeck.h.

bool mrpt::hwdrivers::CServoeNeck::getRegisterValue ( uint16_t &  value,
const uint8_t  servo = 0 
) [protected]
double mrpt::hwdrivers::CServoeNeck::getTruncateFactor ( ) [inline]

Gets the truncate factor of the turn.

Definition at line 93 of file CServoeNeck.h.

bool mrpt::hwdrivers::CServoeNeck::queryFirmwareVersion ( std::string &  out_firmwareVersion)

Gets the firmware version of the eNeck board.

Parameters:
out_firmwareVersion,:[OUTPUT] A string containing the firmware version.
Returns:
Whether or not the procedure succeded.
double mrpt::hwdrivers::CServoeNeck::regValue2angle ( const uint16_t  value) [private]

Converts from a certain value of the ATMEGA16 PWM register to the corresponding decimal angle (for inner use only).

Parameters:
Thevalue to convert.
Returns:
The corresponding angle.
bool mrpt::hwdrivers::CServoeNeck::setAngle ( double  angle,
const uint8_t  servo = 0,
bool  fast = false 
)

Turns the servo up to the specified angle (in radians in the range -pi,pi, other values will be saturated to the maximum or the mininum)

Parameters:
Angle,:the desired angle to turn.
Servo,:the id of the servo to move (in our ATMEGA16, from 0 to 2).
Fast,:indicates if the servo must reach the angle at maximum speed
Returns:
Whether or not the procedure succeded.
bool mrpt::hwdrivers::CServoeNeck::setAngleWithFilter ( double  angle,
const uint8_t  servo = 0,
bool  fast = false 
)

Turns the servo up to the specified angle (in radians in the range -pi,pi) filtered by average with the last N specified angles.

Parameters:
Angle,:the new desired angle to turn.
Servo,:the id of the servo to move (in our ATMEGA16, from 0 to 2).
Fast,:indicates if the servo must reach the angle at maximum speed
Returns:
Whether or not the procedure succeded.
void mrpt::hwdrivers::CServoeNeck::setNumberOfPreviousAngles ( const unsigned int  number) [inline]

Gets the truncate factor of the turn.

Definition at line 101 of file CServoeNeck.h.

bool mrpt::hwdrivers::CServoeNeck::setRegisterValue ( const uint16_t  value,
const uint8_t  servo = 0,
bool  fast = false 
) [protected]
void mrpt::hwdrivers::CServoeNeck::setTruncateFactor ( const double  factor) [inline]

Gets the truncate factor of the turn.

Definition at line 97 of file CServoeNeck.h.

References ASSERT_.


Member Data Documentation

The value set in the ICR register within the ATMEGA16 controller.

Definition at line 109 of file CServoeNeck.h.

Number of previous angles to store for averaging.

Definition at line 112 of file CServoeNeck.h.

std::deque<double> mrpt::hwdrivers::CServoeNeck::m_PrevAngles [protected]

A vector containing the last N angles which where passed to the servo (for averaging)

Definition at line 111 of file CServoeNeck.h.

The range of turn of the servo will be truncated to "+-m_truncate_factor*(pi/2)".

Definition at line 110 of file CServoeNeck.h.

A copy of the device serial number (to open the USB FTDI chip).

Definition at line 108 of file CServoeNeck.h.




Page generated by Doxygen 1.7.3 for MRPT 0.9.4 SVN: at Sat Mar 26 06:40:17 UTC 2011