Management class of joints. More...
#include <JointController.h>
Classes | |
class | Multiplexer |
Management class (as namespace) of multiplexer. More... | |
Public Types | |
enum | JOINT_INDEX { LEFT_SHOULDER_PITCH = 0, LEFT_THIGH_YAW = 1, LEFT_SHOULDER_ROLL = 2, LEFT_ELBOW_ROLL = 3, LEFT_THIGH_ROLL = 4, LEFT_THIGH_PITCH = 5, LEFT_KNEE_PITCH = 6, LEFT_FOOT_PITCH = 7, LEFT_FOOT_ROLL = 8, RIGHT_SHOULDER_PITCH = 12, RIGHT_THIGH_YAW = 13, RIGHT_SHOULDER_ROLL = 14, RIGHT_ELBOW_ROLL = 15, RIGHT_THIGH_ROLL = 16, RIGHT_THIGH_PITCH = 17, RIGHT_KNEE_PITCH = 18, RIGHT_FOOT_PITCH = 19, RIGHT_FOOT_ROLL = 20 } |
enum | BASIC_JOINT_SETTINGS { JOINTS_SUM = 24 } |
Public Member Functions | |
JointController () | |
Constructor. More... | |
void | loadSettings () |
Load the joint settings. More... | |
void | resetSettings () |
Reset the joint settings. More... | |
const int16_t & | getMinAngle (uint8_t joint_id) |
Get min angle of the joint given. More... | |
const int16_t & | getMaxAngle (uint8_t joint_id) |
Get max angle of the joint given. More... | |
const int16_t & | getHomeAngle (uint8_t joint_id) |
Get home angle of the joint given. More... | |
bool | setMinAngle (uint8_t joint_id, int16_t angle) |
Set min angle of the joint given. More... | |
bool | setMaxAngle (uint8_t joint_id, int16_t angle) |
Set max angle of the joint given. More... | |
bool | setHomeAngle (uint8_t joint_id, int16_t angle) |
Set home angle of the joint given. More... | |
bool | setAngle (uint8_t joint_id, int16_t angle) |
Set angle of the joint given. More... | |
bool | setAngleDiff (uint8_t joint_id, int16_t angle_diff) |
Set angle to "angle-diff + home-angle" of the joint given. More... | |
void | dump () |
Dump the joint settings. More... | |
Static Public Attributes | |
static volatile bool | m_1cycle_finished |
Finished flag of PWM output procedure 1 cycle. More... | |
static uint16_t | m_pwms [JOINTS_SUM] |
PWM buffer. More... | |
Management class of joints.
In Atmega32u4, one timer can output 3 PWM signals at a time. The MCU can control 24 servos by connecting 3bit multiplexer in each signal output lines.
PLEN2::JointController::JointController | ( | ) |
Constructor.
void PLEN2::JointController::dump | ( | ) |
Dump the joint settings.
Output result in JSON format as below.
const int16_t& PLEN2::JointController::getHomeAngle | ( | uint8_t | joint_id | ) |
Get home angle of the joint given.
[in] | joint_id | Please set the joint id from which you want to get home angle. |
-32768 | Argument error. (joint_id is invalid.) |
const int16_t& PLEN2::JointController::getMaxAngle | ( | uint8_t | joint_id | ) |
Get max angle of the joint given.
[in] | joint_id | Please set the joint id from which you want to get max angle. |
-32768 | Argument error. (joint_id is invalid.) |
const int16_t& PLEN2::JointController::getMinAngle | ( | uint8_t | joint_id | ) |
Get min angle of the joint given.
[in] | joint_id | Please set the joint id from which you want to get min angle. |
-32768 | Argument error. (joint_id is invalid.) |
void PLEN2::JointController::loadSettings | ( | ) |
Load the joint settings.
The method reads joint settings from internal EEPROM. If the EEPROM has no settings, the method also writes the default values.
void PLEN2::JointController::resetSettings | ( | ) |
Reset the joint settings.
Write default settings to internal EEPROM.
bool PLEN2::JointController::setAngle | ( | uint8_t | joint_id, |
int16_t | angle | ||
) |
Set angle of the joint given.
[in] | joint_id | Please set the joint id from which you want to set the angle. |
[in] | angle | Please set angle that has steps of degree 1/10. |
bool PLEN2::JointController::setAngleDiff | ( | uint8_t | joint_id, |
int16_t | angle_diff | ||
) |
Set angle to "angle-diff + home-angle" of the joint given.
[in] | joint_id | Please set the joint id from which you want to set the angle-diff. |
[in] | angle_diff | Please set angle-diff that has steps of degree 1/10. |
bool PLEN2::JointController::setHomeAngle | ( | uint8_t | joint_id, |
int16_t | angle | ||
) |
Set home angle of the joint given.
[in] | joint_id | Please set the joint id from which you want to define the home angle. |
[in] | angle | Please set angle that has steps of degree 1/10. |
bool PLEN2::JointController::setMaxAngle | ( | uint8_t | joint_id, |
int16_t | angle | ||
) |
Set max angle of the joint given.
[in] | joint_id | Please set the joint id from which you want to define the max angle. |
[in] | angle | Please set angle that has steps of degree 1/10. |
bool PLEN2::JointController::setMinAngle | ( | uint8_t | joint_id, |
int16_t | angle | ||
) |
Set min angle of the joint given.
[in] | joint_id | Please set the joint id from which you want to define the min angle. |
[in] | angle | Please set angle that has steps of degree 1/10. |
|
static |
Finished flag of PWM output procedure 1 cycle.
|
static |
PWM buffer.