class documentation
Represents an EMOTOR command.
Class Method | unpack |
Unpacks a bytes sequence into a tagEMOTOR object. |
Method | pack |
Packs the tagEMOTOR object into a bytes sequence. |
Class Variable | address |
Undocumented |
Class Variable | ins |
Undocumented |
Class Variable | speed |
Undocumented |
Unpacks a bytes sequence into a tagEMOTOR object.
Parameters | |
data:bytes | The bytes to unpack, expected to be 10 bytes (2 uint8s + 1 double). |
Returns | |
tagEMOTOR | A tagEMOTOR object. |
Raises | |
struct.error | If the input bytes are not the expected size (10 bytes). |
ValueError | If the unpacked byte value for index does not correspond to a valid EMotorIndex enum member. |
Packs the tagEMOTOR object into a bytes sequence.
Packs the index (EMotorIndex value as uint8), insEnabled (boolean as uint8), and speed (double) into a byte string. Uses little-endian byte order.
Returns | |
bytes | A bytes object representing the packed data (1 + 1 + 8 = 10 bytes). |