Public Member Functions | Public Attributes
Dynamixel Class Reference

A class to control servomotors dynamixel RX-24F from Robotis via an Arduino Mega 2560 board. More...

#include <dynamixelUse.h>

List of all members.

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

Detailed Description

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.


Constructor & Destructor Documentation

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.


Member Function Documentation

int Dynamixel::CheckPacket ( unsigned char *  Packet)

Check if a return packet contains no error

Parameters:
PacketThe packet to be checked
Returns:
an int (see Errors from dynamixel.h to know what is returned).

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)

Returns:
no return.

Definition at line 70 of file dynamixelUse.cpp.

short Dynamixel::GetCCWAngleLimit ( unsigned char  ID)

Get the CCW angle limit

Parameters:
IDDefines the ID of the servo to talk with
Returns:
a short, the counter clockwise angle limit (in degrees) or -1 if an error occurenced.

Definition at line 306 of file dynamixelUse.cpp.

short Dynamixel::GetCCWComplianceMargin ( unsigned char  ID)

Get the CCW margin of the compliance

Parameters:
IDDefines the ID of the servo to talk with
Returns:
an unsigned char, the counter clockwise margin of the compliance (same unit as SetGoalPosition) or -1 if an error occurenced.

Definition at line 405 of file dynamixelUse.cpp.

short Dynamixel::GetCCWComplianceSlope ( unsigned char  ID)

Get the CCW margin of the compliance

Parameters:
IDDefines the ID of the servo to talk with
Returns:
a short, the counter clockwise margin of the compliance (0 to 255 znd 255 is when the most flexibility is obtained) or -1 if an error occurenced.

Definition at line 437 of file dynamixelUse.cpp.

short Dynamixel::GetCWAngleLimit ( unsigned char  ID)

Get the CW angle limit

Parameters:
IDDefines the ID of the servo to talk with
Returns:
a short, the clockwise angle limit (in degrees) or -1 if an error occurenced.

Definition at line 289 of file dynamixelUse.cpp.

short Dynamixel::GetCWComplianceMargin ( unsigned char  ID)

Get the CW margin of the compliance

Parameters:
IDDefines the ID of the servo to talk with
Returns:
a short, the clockwise margin of the compliance (same unit as SetGoalPosition) or -1 if an error occurenced.

Definition at line 388 of file dynamixelUse.cpp.

short Dynamixel::GetCWComplianceSlope ( unsigned char  ID)

Get the CW margin of the compliance

Parameters:
IDDefines the ID of the servo to talk with
Returns:
a short, the clockwise margin of the compliance (0 to 255 znd 255 is when the most flexibility is obtained) or -1 if an error occurenced.

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)

Parameters:
IDDefines the ID of the servo to talk with
Returns:
a short, the maximum torque (0 to 1023 where 1023 means 100% of maximum torque) or -1 if an error occurenced.

Definition at line 355 of file dynamixelUse.cpp.

char Dynamixel::GetMoving ( unsigned char  ID)

Get if there is any movement on the servomotor

Parameters:
IDDefines the ID of the servo to talk with
Returns:
a char, 1 means that there is no movement, 0 means that an instruction is in progress and -1 that an error occurenced.

Definition at line 522 of file dynamixelUse.cpp.

short Dynamixel::GetMovSpeed ( unsigned char  ID)

Get the moving speed

Parameters:
IDDefines the ID of the servo to talk with
Returns:
a short, the speed (0 means 0% and 0xFE means 100% of the maximum speed) or -1 if an error occurenced.

Definition at line 322 of file dynamixelUse.cpp.

short Dynamixel::GetPresentLoad ( unsigned char  ID)

Get the actual load

Parameters:
IDDefines the ID of the servo to talk with
Returns:
a short, the present load (same unit as GetTorqueLimit) or -1 if an error occurenced.

Definition at line 505 of file dynamixelUse.cpp.

short Dynamixel::GetPresentPosition ( unsigned char  ID)

Get the actual position

Parameters:
IDDefines the ID of the servo to talk with
Returns:
a short, the present position (same unit as SetGoalPosition) or -1 if an error occurenced.

Definition at line 469 of file dynamixelUse.cpp.

short Dynamixel::GetPresentSpeed ( unsigned char  ID)

Get the actual speed

Parameters:
IDDefines the ID of the servo to talk with
Returns:
a short, the present speed (same unit as SetMovSpeed) or -1 if an error occurenced.

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)

Parameters:
IDDefines the ID of the servo to talk with
Returns:
a short, the return delay time (0 to 254 where 1 data means 2 µs) or -1 if an error occurenced.

Definition at line 338 of file dynamixelUse.cpp.

char Dynamixel::GetTorqueEnable ( unsigned char  ID)

Get if torque is enable or disable

Parameters:
IDDefines the ID of the servo to talk with
Returns:
a char, 1 if torque is enable, 0 if torque is disable or -1 if an error occurenced.

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

Parameters:
IDDefines the ID of the servo to talk with
Returns:
a short, the torque limit (0 to 1023 where 1023 means 100% of maximum torque) or -1 if an error occurenced.

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)

Parameters:
IDDefines the ID of the servo to talk with
Returns:
a boolean, if true, it means it is a success and false, a failure.

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

Parameters:
IDDefines the ID of the servo to whom send the packet
InstructionWhich Instruction to execute (see the defines of dynamixel.h to know which instruction can be send)
ParametersThe parameters of the instruction (see Robotis documentation for additional information)
NbParamJust give the number of parameters for the packet
LengthToReadFinally, 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
Returns:
a boolean, if true, it means it is a success and false, a failure.

Definition at line 48 of file dynamixelUse.cpp.

bool Dynamixel::SendPing ( unsigned char  ID)

Send a ping to a servomotor

Parameters:
IDDefines the ID of the servo to whom send the ping
Returns:
a boolean, if true, it means ping is a success and false, a failure.

Definition at line 31 of file dynamixelUse.cpp.

bool Dynamixel::SetCCWAngleLimit ( unsigned char  ID,
unsigned short  Angle 
)

Set CCW Angle Limit

Parameters:
IDDefines the ID of the servo to talk with
AngleThe limit angle to set
Returns:
a boolean, if true, it means it is a success and false, a failure.

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)

Parameters:
IDDefines the ID of the servo to talk with
MarginThe margin to define
Returns:
a boolean, if true, it means it is a success and false, a failure.

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)

Parameters:
IDDefines the ID of the servo to talk with
SlopeThe slope to define
Returns:
a boolean, if true, it means it is a success and false, a failure.

Definition at line 255 of file dynamixelUse.cpp.

bool Dynamixel::SetCWAngleLimit ( unsigned char  ID,
unsigned short  Angle 
)

Set CW Angle Limit

Parameters:
IDDefines the ID of the servo to talk with
AngleThe limit angle to set
Returns:
a boolean, if true, it means it is a success and false, a failure.

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)

Parameters:
IDDefines the ID of the servo to talk with
MarginThe margin to define
Returns:
a boolean, if true, it means it is a success and false, a failure.

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)

Parameters:
IDDefines the ID of the servo to talk with
SlopeThe slope to define
Returns:
a boolean, if true, it means it is a success and false, a failure.

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)

Parameters:
IDDefines the ID of the servo to talk with
AngleThe angle to reach
Returns:
a boolean, if true, it means it is a success and false, a failure.

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)

Parameters:
IDDefines the ID of the servo to talk with
TorqueThe torque limit to set
Returns:
a boolean, if true, it means it is a success and false, a failure.

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)

Parameters:
IDDefines the ID of the servo to talk with
SpeedSpeed to be defined
Returns:
a boolean, if true, it means it is a success and false, a failure.

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)

Parameters:
IDDefines the ID of the servo to talk with
DelayAs explain in the description of the function, the unit is 2 us so when you put 150 inside it means 300 us of delay
Returns:
a boolean, if true, it means it is a success and false, a failure.

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)

Parameters:
IDDefines the ID of the servo to talk with
EnableDefine if there is torque
Returns:
a boolean, if true, it means it is a success and false, a failure.

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)

Parameters:
IDDefines the ID of the servo to talk with
TorqueThe Torque Limit (the default value of the torque limit is define SetMaxTorque)
Returns:
a boolean, if true, it means it is a success and false, a failure.

Definition at line 270 of file dynamixelUse.cpp.


Member Data Documentation

unsigned long Dynamixel::TimeOut

Length of the timeout reception

Definition at line 218 of file dynamixelUse.h.


The documentation for this class was generated from the following files: