roboglia.dynamixel.DynamixelDevice

class DynamixelDevice(**kwargs)[source]

Bases: roboglia.base.device.BaseDevice

Implements specific functionality for Dynamixel devices.

Differences are:

  • different version of get_model_path() that will point to the local device directory in the dynamixel module

  • the initialization parameters are the same as for the class BaseDevice

__init__(**kwargs)[source]

Initialize self. See help(type(self)) for accurate signature.

get_model_path()[source]

Builds the path to the .yml documents.

Returns

A full document path including the name of the model and the

extension .yml.

Return type

str

register_low_endian(value, size)[source]

Converts a value into a list of bytes in little endian order.

Parameters
  • value (int) – the value of the register

  • size (int) – the size of the register

Returns

(list) List of bytes of len size with bytes ordered lowest

first.

__str__()

Return str(self).

property bus

The bus where the device is connected to.

Returns

The bus object using this device.

Return type

BaseBus or SharedBus or subclass

close()

Perform device closure. BaseDevice implementation does nothing.

default_register()

Default register for the device in case is not explicitly provided in the device definition file.

Subclasses of BaseDevice can overide the method to derive their own class.

BaseDevice suggests as default register BaseRegister.

property dev_id

The device number.

Returns

The device number

Return type

int

property name

Device name.

Returns

The name of the device

Return type

str

open()

Performs initialization of the device by reading all registers that are not flagged for sync replication and, if init parameter provided initializes the indicated registers with the values from the init paramters.

read_register(register)

Implements the read of a register using the associated bus. More complex devices should overwrite the method to provide specific functionality.

BaseDevice simply calls the bus’s read function and returns the value received.

register_by_address(address)

Returns the register identified by the given address. If the address is not available in the device it will return None.

Returns

The device at address or None if no register with that address exits.

Return type

BaseDevice or subclass or None

property registers

Device registers as dict.

Returns

The dictionary of registers with the register name as key.

Return type

dict

write_register(register, value)

Implements the write of a register using the associated bus. More complex devices should overwrite the method to provide specific functionality.

BaseDevice simply calls the bus’s write function and returns the value received.