Robot
The embedded systems for UTRA's autonomous humanoid soccer-playing robot
|
Implements the primitive IO instructions supported in V1 of the protocol. More...
![]() |
Functions | |
void | Dynamixel_DataWriter (Dynamixel_HandleTypeDef *hdynamixel, uint8_t *args, uint8_t numArgs) |
Sends an array of data to a motor as per its configuration details. More... | |
uint16_t | Dynamixel_DataReader (Dynamixel_HandleTypeDef *hdynamixel, uint8_t readAddr, uint8_t readLength) |
Reads data back from the motor passed in by reference. More... | |
void | Dynamixel_RegWrite (Dynamixel_HandleTypeDef *hdynamixel, uint8_t arrSize, uint8_t writeAddr, uint8_t param1, uint8_t param2) |
Implementation of the REG WRITE instruction with 2 parameters. More... | |
void | Dynamixel_Action (Dynamixel_HandleTypeDef *hdynamixel) |
Implementation of the ACTION instruction. More... | |
int8_t | Dynamixel_Ping (Dynamixel_HandleTypeDef *hdynamixel) |
Implementation of the PING instruction. More... | |
void | Dynamixel_Init (Dynamixel_HandleTypeDef *hdynamixel, uint8_t ID, UART_HandleTypeDef *UART_Handle, GPIO_TypeDef *DataDirPort, uint16_t DataDirPinNum, enum motorTypes_e motorType) |
Initializes a motor handle. More... | |
void | Dynamixel_Reset (Dynamixel_HandleTypeDef *hdynamixel) |
Resets motor control table. More... | |
Implements the primitive IO instructions supported in V1 of the protocol.
void Dynamixel_Action | ( | Dynamixel_HandleTypeDef * | hdynamixel | ) |
Implementation of the ACTION instruction.
This triggers the instruction registered by the REG WRITE instruction. This way, time delays can be reduced for the concurrent motion of several motors
hdynamixel | pointer to a Dynamixel_HandleTypeDef structure that contains the configuration information for the motor |
Definition at line 592 of file DynamixelProtocolV1_IO.c.
uint16_t Dynamixel_DataReader | ( | Dynamixel_HandleTypeDef * | hdynamixel, |
uint8_t | readAddr, | ||
uint8_t | readLength | ||
) |
Reads data back from the motor passed in by reference.
Uses the READ DATA instruction, 0x02, in the motor instruction set. The status packet returned will be of the following form
Where N = readLength. Also, this function computes the checksum of data using the same algorithm as the motors, and it sets ‘hdynamixel -> _lastReadIsValid’ if the computations match, and clears this field otherwise. This is a basic data integrity check that reduces the probability of passing invalid data to the application
hdynamixel | pointer to a Dynamixel_HandleTypeDef structure that contains the configuration information for the motor |
readAddr | the address inside the motor memory table where reading is to begin |
readLength | the number of bytes to be read. Must be either 1 or 2 |
Definition at line 489 of file DynamixelProtocolV1_IO.c.
void Dynamixel_DataWriter | ( | Dynamixel_HandleTypeDef * | hdynamixel, |
uint8_t * | args, | ||
uint8_t | numArgs | ||
) |
Sends an array of data to a motor as per its configuration details.
Uses the WRITE DATA instruction, 0x03, in the motor instruction set.
hdynamixel | pointer to a Dynamixel_HandleTypeDef structure that contains the configuration information for the motor |
args | an array of arguments of the form {ADDR, PARAM_1, ... , PARAM_N} |
numArgs | this must be equal to sizeof(args) , and must be either 2 or 3 |
Definition at line 438 of file DynamixelProtocolV1_IO.c.
void Dynamixel_Init | ( | Dynamixel_HandleTypeDef * | hdynamixel, |
uint8_t | ID, | ||
UART_HandleTypeDef * | UART_Handle, | ||
GPIO_TypeDef * | DataDirPort, | ||
uint16_t | DataDirPinNum, | ||
enum motorTypes_e | motorType | ||
) |
Initializes a motor handle.
hdynamixel | pointer to a Dynamixel_HandleTypeDef structure that contains the configuration information for the motor |
ID | the ID the motor has. Note that this function will not set the ID in case there are multiple actuators on the same bus |
UART_Handle | the handle to the UART that will be used to communicate with this motor |
DataDirPort | the pointer to the port that the data direction pin for the motor is on |
DataDirPinNum | the number corresponding to the pin that controls data direction (a power of two, e.g. 2^0 for pin 0, 2^15 for pin 15) |
motorType | indicates whether motor is AX12A or MX28 |
Definition at line 657 of file DynamixelProtocolV1_IO.c.
int8_t Dynamixel_Ping | ( | Dynamixel_HandleTypeDef * | hdynamixel | ) |
Implementation of the PING instruction.
Used only for returning a status packet or checking the existence of a motor with a specified ID. Does not command any operations
hdynamixel | pointer to a Dynamixel_HandleTypeDef structure that contains the configuration information for the motor |
Definition at line 616 of file DynamixelProtocolV1_IO.c.
void Dynamixel_RegWrite | ( | Dynamixel_HandleTypeDef * | hdynamixel, |
uint8_t | arrSize, | ||
uint8_t | writeAddr, | ||
uint8_t | param1, | ||
uint8_t | param2 | ||
) |
Implementation of the REG WRITE instruction with 2 parameters.
hdynamixel | pointer to a Dynamixel_HandleTypeDef structure that contains the configuration information for the motor |
arrSize | the size of the array to be written (either 1 or 2) |
writeAddr | the starting address for where the data is to be written |
param1 | the first parameter |
param2 | the second parameter |
Definition at line 553 of file DynamixelProtocolV1_IO.c.
void Dynamixel_Reset | ( | Dynamixel_HandleTypeDef * | hdynamixel | ) |
Resets motor control table.
Resets the control table values of the motor to the Factory Default Value settings. Note that post-reset, motor ID will be 1. Thus, if several motors with ID 1 are connected on the same bus, there will not be a way to assign them unique IDs without first disconnecting them. Need to wait around 500 ms before motor becomes valid again
hdynamixel | pointer to a Dynamixel_HandleTypeDef structure that contains the configuration information for the motor |
Definition at line 683 of file DynamixelProtocolV1_IO.c.