Definition at line 40 of file CServoeNeck.h.
#include <mrpt/hwdrivers/CServoeNeck.h>
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). |
mrpt::hwdrivers::CServoeNeck::CServoeNeck | ( | ) |
mrpt::hwdrivers::CServoeNeck::~CServoeNeck | ( | ) |
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).
The | angle to convert. |
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).
bool mrpt::hwdrivers::CServoeNeck::disableServo | ( | const uint8_t | servo = 0 | ) |
Disables the servo so the neck will be loose.
Servo,: | the id of the servo to move (in our ATMEGA16, from 0 to 2). |
bool mrpt::hwdrivers::CServoeNeck::enableServo | ( | const uint8_t | servo = 0 | ) |
Enables the servo so the neck will be tight.
Servo,: | the id of the servo to move (in our ATMEGA16, from 0 to 2). |
bool mrpt::hwdrivers::CServoeNeck::getCurrentAngle | ( | double & | angle, |
const uint8_t | servo = 0 |
||
) |
Gets the current angle of the servo (in radians within (-pi,pi))
Angle,: | [OUT] The current angle. |
Servo,: | [IN] The id of the servo (in our ATMEGA16, from 0 to 2). |
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.
out_firmwareVersion,: | [OUTPUT] A string containing the firmware version. |
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).
The | value to convert. |
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)
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 |
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.
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 |
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_.
double mrpt::hwdrivers::CServoeNeck::m_MaxValue [protected] |
The value set in the ICR register within the ATMEGA16 controller.
Definition at line 109 of file CServoeNeck.h.
unsigned int mrpt::hwdrivers::CServoeNeck::m_NumPrevAngles [protected] |
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.
double mrpt::hwdrivers::CServoeNeck::m_TruncateFactor [protected] |
The range of turn of the servo will be truncated to "+-m_truncate_factor*(pi/2)".
Definition at line 110 of file CServoeNeck.h.
std::string mrpt::hwdrivers::CServoeNeck::m_usbSerialNumber [protected] |
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:16:28 UTC 2011 |