roboglia.dynamixel.DynamixelDevice¶
-
class
DynamixelDevice(**kwargs)[source]¶ Bases:
roboglia.base.device.BaseDeviceImplements specific functionality for Dynamixel devices.
Differences are:
different version of
get_model_path()that will point to the localdevicedirectory in thedynamixelmodulethe initialization parameters are the same as for the class
BaseDevice
-
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
sizewith bytes ordered lowest first.
- (list) List of bytes of len
-
__str__()¶ Return str(self).
-
property
bus¶ The bus where the device is connected to.
-
close()¶ Perform device closure.
BaseDeviceimplementation does nothing.
-
default_register()¶ Default register for the device in case is not explicitly provided in the device definition file.
Subclasses of
BaseDevicecan overide the method to derive their own class.BaseDevicesuggests as default registerBaseRegister.
-
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
syncreplication and, ifinitparameter provided initializes the indicated registers with the values from theinitparamters.
-
read_register(register)¶ Implements the read of a register using the associated bus. More complex devices should overwrite the method to provide specific functionality.
BaseDevicesimply calls the bus’sreadfunction 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
Noneif 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.
BaseDevicesimply calls the bus’swritefunction and returns the value received.