roboglia.dynamixel.DynamixelSyncReadLoop

class DynamixelSyncReadLoop(**kwargs)[source]

Bases: roboglia.base.sync.BaseSync

Implements SyncRead as specified in the frequency parameter.

The devices are provided in the group parameter and the registers in the registers as a list of register names. We will trigger as many SyncRead packets as registers as Dynamixel does not support multiple registers in one go and you cannot include the same device twice in a SyncRead. It will update the int_value of each register in every device with the result of the call. Will raise exceptions if the SyncRead cannot be setup or fails to execute. Only works with Protocol 2.0.

__init__(**kwargs)[source]

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

setup()[source]

Prepares to start the loop.

atomic()[source]

Executes a SyncRead.

property auto_start

Shows if the sync should be started automatically when the robot starts.

property bus

The bus this sync works with.

property devices

The devices used by the sync.

property frequency

Loop frequency.

get_register_range()

Determines the start address of the range of registers and the whole length. Registers do not need to be order, but be careful that not all communication protocols can support gaps in the bulk read of registers.

property name

Returns the name of the thread.

pause()

Requests the thread to pause.

property paused

Indicates the thread was paused.

property period

Loop period = 1 / frequency.

process_devices()

Processes the provided devices.

The devices are exected as a set in the init_dict. This is normally performed by the robot class when reading the robot definition by replacing the name of the group with the actual content of the group. This method checks that all devices are assigned to the same bus otherwise raises an exception. It returns the single instance of the bus that manages all devices.

process_registers()

Checks that the supplied registers are available in all devices.

property register_names

The register names used by the sync.

resume()

Requests the thread to resume.

property review

Indicates the amount of time in seconds before the thread will review the actual frequency against the target and take action.

run()

Run method of the thread.

property running

Indicates if the thread is running.

start()

Checks that the bus is open, then refreshes the register, sets the sync flag before calling the inherited :py:meth:BaseLoop.`start.

property started

Indicates if the thread was started.

stop()

Before calling the inherited method it unflags the registers for syncing.

property stopped

Indicates if the thread was stopped.

teardown()

Thread cleanup. Subclasses should override.

property warning

Control the warning level for the warning message, the setter is smart: if the value is larger than 2 it will assume it is a percentage and divied it by 100 and ignore if the number is higher than 110. The over 100 is available for testing purposes.