A class to control servomotors dynamixel RX-24F from Robotis via an Arduino Mega 2560 board. More...
#include <dynamixelUse.h>
Public Member Functions | |
Dynamixel () | |
~Dynamixel () | |
bool | SendPing (unsigned char ID) |
bool | ManSend (unsigned char ID, unsigned char Instruction, unsigned char *Parameters, int NbParam, int LengthToRead) |
int | CheckPacket (unsigned char *Packet) |
void | ClearReceptionBuffer () |
bool | LeaveAlarmShutdownMode (unsigned char ID) |
bool | SetGoalPosition (unsigned char ID, unsigned short Angle) |
bool | SetCWAngleLimit (unsigned char ID, unsigned short Angle) |
bool | SetCCWAngleLimit (unsigned char ID, unsigned short Angle) |
bool | SetMovSpeed (unsigned char ID, unsigned short Speed) |
bool | SetReturnDelayTime (unsigned char ID, unsigned char Delay) |
bool | SetMaxTorque (unsigned char ID, unsigned short Torque) |
bool | SetTorqueEnable (unsigned char ID, bool Enable) |
bool | SetCWComplianceMargin (unsigned char ID, unsigned char Margin) |
bool | SetCCWComplianceMargin (unsigned char ID, unsigned char Margin) |
bool | SetCWComplianceSlope (unsigned char ID, unsigned char Slope) |
bool | SetCCWComplianceSlope (unsigned char ID, unsigned char Slope) |
bool | SetTorqueLimit (unsigned char ID, unsigned short Torque) |
short | GetCWAngleLimit (unsigned char ID) |
short | GetCCWAngleLimit (unsigned char ID) |
short | GetMovSpeed (unsigned char ID) |
short | GetReturnDelayTime (unsigned char ID) |
short | GetMaxTorque (unsigned char ID) |
char | GetTorqueEnable (unsigned char ID) |
short | GetCWComplianceMargin (unsigned char ID) |
short | GetCCWComplianceMargin (unsigned char ID) |
short | GetCWComplianceSlope (unsigned char ID) |
short | GetCCWComplianceSlope (unsigned char ID) |
short | GetTorqueLimit (unsigned char ID) |
short | GetPresentPosition (unsigned char ID) |
short | GetPresentSpeed (unsigned char ID) |
short | GetPresentLoad (unsigned char ID) |
char | GetMoving (unsigned char ID) |
Public Attributes | |
unsigned long | TimeOut |
A class to control servomotors dynamixel RX-24F from Robotis via an Arduino Mega 2560 board.
See also :
dynamixelUse.h
Here is a link to the Header File Reference.
dynamixelUse.cpp
Here is a link to the C++ File Reference.
dynamixel.h
Here is a link to the library used to communicate with servomotors.
dynamixel.cpp
And here the link for his C++ File Reference.
Definition at line 23 of file dynamixelUse.h.
Dynamixel::Dynamixel | ( | ) |
Constructor, initialize communication with servomotors
Definition at line 14 of file dynamixelUse.cpp.
Dynamixel::~Dynamixel | ( | ) |
Destructor, close communication with servomotors
Definition at line 21 of file dynamixelUse.cpp.
int Dynamixel::CheckPacket | ( | unsigned char * | Packet | ) |
Check if a return packet contains no error
Packet | The packet to be checked |
Definition at line 64 of file dynamixelUse.cpp.
void Dynamixel::ClearReceptionBuffer | ( | ) |
Empty reception buffer (commonly use after an error occurenced to be sure next frame will not be affected)
Definition at line 70 of file dynamixelUse.cpp.
short Dynamixel::GetCCWAngleLimit | ( | unsigned char | ID | ) |
Get the CCW angle limit
ID | Defines the ID of the servo to talk with |
Definition at line 306 of file dynamixelUse.cpp.
short Dynamixel::GetCCWComplianceMargin | ( | unsigned char | ID | ) |
Get the CCW margin of the compliance
ID | Defines the ID of the servo to talk with |
Definition at line 405 of file dynamixelUse.cpp.
short Dynamixel::GetCCWComplianceSlope | ( | unsigned char | ID | ) |
Get the CCW margin of the compliance
ID | Defines the ID of the servo to talk with |
Definition at line 437 of file dynamixelUse.cpp.
short Dynamixel::GetCWAngleLimit | ( | unsigned char | ID | ) |
Get the CW angle limit
ID | Defines the ID of the servo to talk with |
Definition at line 289 of file dynamixelUse.cpp.
short Dynamixel::GetCWComplianceMargin | ( | unsigned char | ID | ) |
Get the CW margin of the compliance
ID | Defines the ID of the servo to talk with |
Definition at line 388 of file dynamixelUse.cpp.
short Dynamixel::GetCWComplianceSlope | ( | unsigned char | ID | ) |
Get the CW margin of the compliance
ID | Defines the ID of the servo to talk with |
Definition at line 421 of file dynamixelUse.cpp.
short Dynamixel::GetMaxTorque | ( | unsigned char | ID | ) |
Get the maximum torque i.e the default value of the torque limit(see : SetTorqueLimit and GetTorqueLimit)
ID | Defines the ID of the servo to talk with |
Definition at line 355 of file dynamixelUse.cpp.
char Dynamixel::GetMoving | ( | unsigned char | ID | ) |
Get if there is any movement on the servomotor
ID | Defines the ID of the servo to talk with |
Definition at line 522 of file dynamixelUse.cpp.
short Dynamixel::GetMovSpeed | ( | unsigned char | ID | ) |
Get the moving speed
ID | Defines the ID of the servo to talk with |
Definition at line 322 of file dynamixelUse.cpp.
short Dynamixel::GetPresentLoad | ( | unsigned char | ID | ) |
Get the actual load
ID | Defines the ID of the servo to talk with |
Definition at line 505 of file dynamixelUse.cpp.
short Dynamixel::GetPresentPosition | ( | unsigned char | ID | ) |
Get the actual position
ID | Defines the ID of the servo to talk with |
Definition at line 469 of file dynamixelUse.cpp.
short Dynamixel::GetPresentSpeed | ( | unsigned char | ID | ) |
Get the actual speed
ID | Defines the ID of the servo to talk with |
Definition at line 485 of file dynamixelUse.cpp.
short Dynamixel::GetReturnDelayTime | ( | unsigned char | ID | ) |
Get the return delay time (the time between the execution and the return packet)
ID | Defines the ID of the servo to talk with |
Definition at line 338 of file dynamixelUse.cpp.
char Dynamixel::GetTorqueEnable | ( | unsigned char | ID | ) |
Get if torque is enable or disable
ID | Defines the ID of the servo to talk with |
Definition at line 372 of file dynamixelUse.cpp.
short Dynamixel::GetTorqueLimit | ( | unsigned char | ID | ) |
Get the torque limit (the default value use is the MaxTorque (see : SetMaxTorque and GetMaxTorque).
ID | Defines the ID of the servo to talk with |
Definition at line 453 of file dynamixelUse.cpp.
bool Dynamixel::LeaveAlarmShutdownMode | ( | unsigned char | ID | ) |
Quit the Alarm Shutdown mode to reuse servomotors normally (Alarm Shutdown mode is activated when an error occurenced on the servomotor)
ID | Defines the ID of the servo to talk with |
Definition at line 77 of file dynamixelUse.cpp.
bool Dynamixel::ManSend | ( | unsigned char | ID, |
unsigned char | Instruction, | ||
unsigned char * | Parameters, | ||
int | NbParam, | ||
int | LengthToRead | ||
) |
Send a packet manually to a servomotor
ID | Defines the ID of the servo to whom send the packet |
Instruction | Which Instruction to execute (see the defines of dynamixel.h to know which instruction can be send) |
Parameters | The parameters of the instruction (see Robotis documentation for additional information) |
NbParam | Just give the number of parameters for the packet |
LengthToRead | Finally, the length of data to read (this length can be known easily, in case of WRITE instruction it will always be 0, in case of READ, it depends on how many data you have asked to read |
Definition at line 48 of file dynamixelUse.cpp.
bool Dynamixel::SendPing | ( | unsigned char | ID | ) |
Send a ping to a servomotor
ID | Defines the ID of the servo to whom send the ping |
Definition at line 31 of file dynamixelUse.cpp.
bool Dynamixel::SetCCWAngleLimit | ( | unsigned char | ID, |
unsigned short | Angle | ||
) |
Set CCW Angle Limit
ID | Defines the ID of the servo to talk with |
Angle | The limit angle to set |
Definition at line 132 of file dynamixelUse.cpp.
bool Dynamixel::SetCCWComplianceMargin | ( | unsigned char | ID, |
unsigned char | Margin | ||
) |
Set the CCW margin of the compliance (0 to 255, unit is the same as goal pos)
ID | Defines the ID of the servo to talk with |
Margin | The margin to define |
Definition at line 225 of file dynamixelUse.cpp.
bool Dynamixel::SetCCWComplianceSlope | ( | unsigned char | ID, |
unsigned char | Slope | ||
) |
Set the CCW slope of the compliance (0 to 255 znd 255 is when the most flexibility is obtained)
ID | Defines the ID of the servo to talk with |
Slope | The slope to define |
Definition at line 255 of file dynamixelUse.cpp.
bool Dynamixel::SetCWAngleLimit | ( | unsigned char | ID, |
unsigned short | Angle | ||
) |
Set CW Angle Limit
ID | Defines the ID of the servo to talk with |
Angle | The limit angle to set |
Definition at line 114 of file dynamixelUse.cpp.
bool Dynamixel::SetCWComplianceMargin | ( | unsigned char | ID, |
unsigned char | Margin | ||
) |
Set the CW margin of the compliance (0 to 255, unit is the same as goal pos)
ID | Defines the ID of the servo to talk with |
Margin | The margin to define |
Definition at line 210 of file dynamixelUse.cpp.
bool Dynamixel::SetCWComplianceSlope | ( | unsigned char | ID, |
unsigned char | Slope | ||
) |
Set the CW slope of the compliance (0 to 255 znd 255 is when the most flexibility is obtained)
ID | Defines the ID of the servo to talk with |
Slope | The slope to define |
Definition at line 240 of file dynamixelUse.cpp.
bool Dynamixel::SetGoalPosition | ( | unsigned char | ID, |
unsigned short | Angle | ||
) |
Set goal position (0 to 1023 where 0 means max CW angle and 1023 means max CCW angle)
ID | Defines the ID of the servo to talk with |
Angle | The angle to reach |
Definition at line 96 of file dynamixelUse.cpp.
bool Dynamixel::SetMaxTorque | ( | unsigned char | ID, |
unsigned short | Torque | ||
) |
Set the default value of the max torque (0 to 1023 where 1023 means 100% of maximum torque)
ID | Defines the ID of the servo to talk with |
Torque | The torque limit to set |
Definition at line 180 of file dynamixelUse.cpp.
bool Dynamixel::SetMovSpeed | ( | unsigned char | ID, |
unsigned short | Speed | ||
) |
Set speed (0 to 1023 where 1023 means about 114 rpm - maximum speed)
ID | Defines the ID of the servo to talk with |
Speed | Speed to be defined |
Definition at line 150 of file dynamixelUse.cpp.
bool Dynamixel::SetReturnDelayTime | ( | unsigned char | ID, |
unsigned char | Delay | ||
) |
Set return delay time (0 to 254 where 1 data means 2 us)
ID | Defines the ID of the servo to talk with |
Delay | As explain in the description of the function, the unit is 2 us so when you put 150 inside it means 300 us of delay |
Definition at line 165 of file dynamixelUse.cpp.
bool Dynamixel::SetTorqueEnable | ( | unsigned char | ID, |
bool | Enable | ||
) |
Set if torque is enable (0 means no torque and 1 generates torque)
ID | Defines the ID of the servo to talk with |
Enable | Define if there is torque |
Definition at line 195 of file dynamixelUse.cpp.
bool Dynamixel::SetTorqueLimit | ( | unsigned char | ID, |
unsigned short | Torque | ||
) |
Set the maximum torque limit (0 to 1023 where 1023 means 100% of the maximum torque)
ID | Defines the ID of the servo to talk with |
Torque | The Torque Limit (the default value of the torque limit is define SetMaxTorque) |
Definition at line 270 of file dynamixelUse.cpp.
unsigned long Dynamixel::TimeOut |
Length of the timeout reception
Definition at line 218 of file dynamixelUse.h.