Simple functions to communicate with servomotors RX-24F from Robotis. More...
#include <WProgram.h>
#include <TimerOne/TimerOne.h>
Go to the source code of this file.
Defines | |
#define | PING 0x01 |
#define | READ 0x02 |
#define | READ_DATA 0x02 |
#define | WRITE 0x03 |
#define | WRITE_DATA 0x03 |
#define | REG_WRITE 0x04 |
#define | ACTION 0x05 |
#define | RESET 0x06 |
#define | SYNC_WRITE 0x83 |
#define | __DEBUG__DYNAMIXEL__ |
Functions | |
void | InitDynamixel () |
void | SendPacket (unsigned char ID, unsigned char Instruction, unsigned char *Parameters, int Nb) |
int | ReceivePacket (unsigned char *Buffer, int NbMax, long TimeOut_Us) |
int | Errors (unsigned char *Packet) |
void | EmptyReceptionBuffer () |
void | ISR_TimeOut_Dynamixel () |
Simple functions to communicate with servomotors RX-24F from Robotis.
For more information about frames, see the Robotis documentation and go to Product Information > Dynamixel > Communication > Instruction / Status Packet.
dynamixel.cpp
The C++ File Reference.
Dynamixel
A class which uses the present library.
Definition in file dynamixel.h.
#define ACTION 0x05 |
Instruction which execute the last REG_WRITE send (if any)
Definition at line 44 of file dynamixel.h.
#define PING 0x01 |
Instruction to send a ping
Definition at line 32 of file dynamixel.h.
#define READ 0x02 |
Instruction to read a data
Definition at line 34 of file dynamixel.h.
#define READ_DATA 0x02 |
Equivalent to READ
Definition at line 36 of file dynamixel.h.
#define REG_WRITE 0x04 |
Instruction that works like WRITE but wait ACTION to execute
Definition at line 42 of file dynamixel.h.
#define RESET 0x06 |
Instruction to return servo to factory presets
Definition at line 46 of file dynamixel.h.
#define SYNC_WRITE 0x83 |
Instruction to command several servos simultaneously
Definition at line 48 of file dynamixel.h.
#define WRITE 0x03 |
Instruction to write a data
Definition at line 38 of file dynamixel.h.
#define WRITE_DATA 0x03 |
Equivalent to WRITE
Definition at line 40 of file dynamixel.h.
void EmptyReceptionBuffer | ( | ) |
Empty the reception buffer (usefull when a reception error occurenced)
Definition at line 176 of file dynamixel.cpp.
int Errors | ( | unsigned char * | Packet | ) |
Check if a return packet contains no error
Packet | The return packet to check (a character's array) |
Definition at line 127 of file dynamixel.cpp.
void InitDynamixel | ( | ) |
Initialize transmission with servomotors
Definition at line 14 of file dynamixel.cpp.
void ISR_TimeOut_Dynamixel | ( | ) |
int ReceivePacket | ( | unsigned char * | Buffer, |
int | NbMax, | ||
long | TimeOut_Us | ||
) |
Receive a return packet for servomotors (a timeout is specified to prevent a reception error)
Buffer | Used to save communication reception |
NbMax | Defines the length of data to read |
TimeOut_Us | Defines the length of the time out in microseconds |
Definition at line 81 of file dynamixel.cpp.
void SendPacket | ( | unsigned char | ID, |
unsigned char | Instruction, | ||
unsigned char * | Parameters, | ||
int | Nb | ||
) |
Send a packet to all servos (if ID is defined as 0xFE) or just one (if another ID is specified)
ID | Defines the servo to communicate with |
Instruction | The instruction to send (see the defines chapter to know possible actions) |
Parameters | An array which contains the parameters of the instruction (if any) |
Nb | Specifies the number of parameters |
Definition at line 41 of file dynamixel.cpp.