MRPT logo

mrpt::hwdrivers::CServoeNeck Class Reference

#include <mrpt/hwdrivers/CServoeNeck.h>

Inheritance diagram for mrpt::hwdrivers::CServoeNeck:
Inheritance graph
[legend]
Collaboration diagram for mrpt::hwdrivers::CServoeNeck:
Collaboration 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)
 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 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.

Protected Member Functions

bool setRegisterValue (const uint16_t value, const uint8_t servo=0)
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).

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).

Detailed Description

Definition at line 40 of file CServoeNeck.h.


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:
The angle 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.
bool mrpt::hwdrivers::CServoeNeck::getRegisterValue ( uint16_t &  value,
const uint8_t  servo = 0 
) [protected]
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:
The value to convert.
Returns:
The corresponding angle.
bool mrpt::hwdrivers::CServoeNeck::setAngle ( double  angle,
const uint8_t  servo = 0 
)

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).
Returns:
Whether or not the procedure succeded.
bool mrpt::hwdrivers::CServoeNeck::setRegisterValue ( const uint16_t  value,
const uint8_t  servo = 0 
) [protected]

Member Data Documentation

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

Definition at line 83 of file CServoeNeck.h.




Page generated by Doxygen 1.6.2 for MRPT 0.8.1 SVN:exported at Mon Feb 15 22:01:07 UTC 2010