Robot
The embedded systems for UTRA's autonomous humanoid soccer-playing robot

Implements the primitive IO instructions supported in V1 of the protocol. More...

Collaboration diagram for IO Primitives:

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

Detailed Description

Implements the primitive IO instructions supported in V1 of the protocol.

Function Documentation

◆ Dynamixel_Action()

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

Parameters
hdynamixelpointer to a Dynamixel_HandleTypeDef structure that contains the configuration information for the motor
Returns
None

Definition at line 592 of file DynamixelProtocolV1_IO.c.

Here is the call graph for this function:

◆ Dynamixel_DataReader()

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

{0xFF, 0xFF, ID, LENGTH, ERR, PARAM_1,...,PARAM_N, CHECKSUM}

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

Parameters
hdynamixelpointer to a Dynamixel_HandleTypeDef structure that contains the configuration information for the motor
readAddrthe address inside the motor memory table where reading is to begin
readLengththe number of bytes to be read. Must be either 1 or 2
Returns
A 16-bit value containing 1 or both bytes received, as applicable. The 1st byte received will be the LSB and the 2nd byte received will be the MSB

Definition at line 489 of file DynamixelProtocolV1_IO.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dynamixel_DataWriter()

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.

Parameters
hdynamixelpointer to a Dynamixel_HandleTypeDef structure that contains the configuration information for the motor
argsan array of arguments of the form {ADDR, PARAM_1, ... , PARAM_N}
numArgsthis must be equal to sizeof(args), and must be either 2 or 3
Returns
None

Definition at line 438 of file DynamixelProtocolV1_IO.c.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Dynamixel_Init()

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.

Parameters
hdynamixelpointer to a Dynamixel_HandleTypeDef structure that contains the configuration information for the motor
IDthe ID the motor has. Note that this function will not set the ID in case there are multiple actuators on the same bus
UART_Handlethe handle to the UART that will be used to communicate with this motor
DataDirPortthe pointer to the port that the data direction pin for the motor is on
DataDirPinNumthe 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)
motorTypeindicates whether motor is AX12A or MX28
Returns
None

Definition at line 657 of file DynamixelProtocolV1_IO.c.

Here is the caller graph for this function:

◆ Dynamixel_Ping()

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

Parameters
hdynamixelpointer to a Dynamixel_HandleTypeDef structure that contains the configuration information for the motor
Returns
The motor ID seen in status packet if received a valid status packet, otherwise the max uint8_t value

Definition at line 616 of file DynamixelProtocolV1_IO.c.

Here is the call graph for this function:

◆ Dynamixel_RegWrite()

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.

Parameters
hdynamixelpointer to a Dynamixel_HandleTypeDef structure that contains the configuration information for the motor
arrSizethe size of the array to be written (either 1 or 2)
writeAddrthe starting address for where the data is to be written
param1the first parameter
param2the second parameter
Returns
None

Definition at line 553 of file DynamixelProtocolV1_IO.c.

Here is the call graph for this function:

◆ Dynamixel_Reset()

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

Parameters
hdynamixelpointer to a Dynamixel_HandleTypeDef structure that contains the configuration information for the motor
Returns
None

Definition at line 683 of file DynamixelProtocolV1_IO.c.

Here is the call graph for this function: