Dynamixel driver

Drivers for any device using dynamixel's servomotors communication bus. More...

Detailed Description

Drivers for any device using dynamixel's servomotors communication bus.

The bus is mainly used for servomotors, but a device can be anything : sensors, other actuators.

Files

file  dynamixel_crc.h
 Interface definition for Dynamixel crc.
 
file  dynamixel_protocol.h
 Dynamixel protocol definitions.
 
file  dynamixel_reader.h
 Interface definition for Dynamixel packet reader.
 
file  dynamixel_writer.h
 Interface definition for Dynamixel packet writer.
 
file  dynamixel.h
 Interface definition for Dynamixel devices driver.
 

Data Structures

struct  dynamixel_t
 Descriptor struct for a dynamixel device. More...
 

Typedefs

typedef uint8_t dynamixel_id_t
 device id type
 
typedef uint16_t dynamixel_addr_t
 register address type
 

Enumerations

enum  { DYNAMIXEL_OK, DYNAMIXEL_TIMEOUT, DYNAMIXEL_BUFFER_TOO_SMALL, DYNAMIXEL_INVALID_MESSAGE }
 Possible dynamixel return values. More...
 

Functions

int dynamixel_ping (uart_half_duplex_t *stream, dynamixel_id_t id)
 Send a PING message to a device. More...
 
void dynamixel_init (dynamixel_t *device, uart_half_duplex_t *stream, dynamixel_id_t id)
 Initialize a Dynamixel device. More...
 
int dynamixel_write8 (const dynamixel_t *device, dynamixel_addr_t reg, uint8_t value)
 Write to a device 8bits register. More...
 
int dynamixel_write16 (const dynamixel_t *device, dynamixel_addr_t reg, uint16_t value)
 Write to a device 16bits register. More...
 
int dynamixel_write (const dynamixel_t *device, dynamixel_addr_t reg, const uint8_t *data, size_t length)
 Write to a device address. More...
 
int dynamixel_read8 (const dynamixel_t *device, dynamixel_addr_t reg, uint8_t *value)
 Read from a device 8bits register. More...
 
int dynamixel_read16 (const dynamixel_t *device, dynamixel_addr_t reg, uint16_t *value)
 Read from a device 16bits register. More...
 
int dynamixel_read (const dynamixel_t *device, dynamixel_addr_t reg, uint8_t *data, size_t length)
 Read from a device address. More...
 

Enumeration Type Documentation

◆ anonymous enum

anonymous enum

Possible dynamixel return values.

Enumerator
DYNAMIXEL_OK 

Success.

DYNAMIXEL_TIMEOUT 

No response from the device.

DYNAMIXEL_BUFFER_TOO_SMALL 

Buffer is too small for the message.

DYNAMIXEL_INVALID_MESSAGE 

Invalid message received.

Definition at line 51 of file dynamixel.h.

Function Documentation

◆ dynamixel_init()

void dynamixel_init ( dynamixel_t device,
uart_half_duplex_t stream,
dynamixel_id_t  id 
)

Initialize a Dynamixel device.

Parameters
[out]devicethe Dynamixel device
[in]streamthe stream
[in]idthe device address

◆ dynamixel_ping()

int dynamixel_ping ( uart_half_duplex_t stream,
dynamixel_id_t  id 
)

Send a PING message to a device.

Parameters
[in]streamthe stream
[in]idthe device address
Returns
DYNAMIXEL_OK if a device answered
DYNAMIXEL_TIMEOUT if the device did not answer
DYNAMIXEL_BUFFER_TOO_SMALL if buffer is too small for the message
DYNAMIXEL_INVALID_MESSAGE if an invalid message was received

◆ dynamixel_read()

int dynamixel_read ( const dynamixel_t device,
dynamixel_addr_t  reg,
uint8_t *  data,
size_t  length 
)

Read from a device address.

Parameters
[in]devicethe Dynamixel device
[in]regthe address to start read
[out]datathe data buffer to fill
[in]lengththe data length
Returns
DYNAMIXEL_OK on success
DYNAMIXEL_TIMEOUT if the device did not answer
DYNAMIXEL_BUFFER_TOO_SMALL if buffer is too small for the message
DYNAMIXEL_INVALID_MESSAGE if an invalid message was received

◆ dynamixel_read16()

int dynamixel_read16 ( const dynamixel_t device,
dynamixel_addr_t  reg,
uint16_t *  value 
)

Read from a device 16bits register.

Parameters
[in]devicethe Dynamixel device
[in]regthe register to read
[out]valuethe value to read
Returns
DYNAMIXEL_OK on success
DYNAMIXEL_TIMEOUT if the device did not answer
DYNAMIXEL_BUFFER_TOO_SMALL if buffer is too small for the message
DYNAMIXEL_INVALID_MESSAGE if an invalid message was received

◆ dynamixel_read8()

int dynamixel_read8 ( const dynamixel_t device,
dynamixel_addr_t  reg,
uint8_t *  value 
)

Read from a device 8bits register.

Parameters
[in]devicethe Dynamixel device
[in]regthe register to read
[out]valuethe value to read
Returns
DYNAMIXEL_OK on success
DYNAMIXEL_TIMEOUT if the device did not answer
DYNAMIXEL_BUFFER_TOO_SMALL if buffer is too small for the message
DYNAMIXEL_INVALID_MESSAGE if an invalid message was received

◆ dynamixel_write()

int dynamixel_write ( const dynamixel_t device,
dynamixel_addr_t  reg,
const uint8_t *  data,
size_t  length 
)

Write to a device address.

Parameters
[in]devicethe Dynamixel device
[in]regthe address to start write
[in]datathe data to write
[in]lengththe data length
Returns
DYNAMIXEL_OK on success
DYNAMIXEL_TIMEOUT if the device did not answer
DYNAMIXEL_BUFFER_TOO_SMALL if buffer is too small for the message
DYNAMIXEL_INVALID_MESSAGE if an invalid message was received

◆ dynamixel_write16()

int dynamixel_write16 ( const dynamixel_t device,
dynamixel_addr_t  reg,
uint16_t  value 
)

Write to a device 16bits register.

Parameters
[in]devicethe Dynamixel device
[in]regthe register to write
[in]valuethe value to write
Returns
DYNAMIXEL_OK on success
DYNAMIXEL_TIMEOUT if the device did not answer
DYNAMIXEL_BUFFER_TOO_SMALL if buffer is too small for the message
DYNAMIXEL_INVALID_MESSAGE if an invalid message was received

◆ dynamixel_write8()

int dynamixel_write8 ( const dynamixel_t device,
dynamixel_addr_t  reg,
uint8_t  value 
)

Write to a device 8bits register.

Parameters
[in]devicethe Dynamixel device
[in]regthe register to write
[in]valuethe value to write
Returns
DYNAMIXEL_OK on success
DYNAMIXEL_TIMEOUT if the device did not answer
DYNAMIXEL_BUFFER_TOO_SMALL if buffer is too small for the message
DYNAMIXEL_INVALID_MESSAGE if an invalid message was received