class documentation
Represents a CP command.
Class Method | unpack |
Unpacks a bytes sequence into a tagCPCmd object. |
Method | pack |
Packs the tagCPCmd object into a bytes sequence. |
Class Variable | cp |
Undocumented |
Class Variable | velocity |
Undocumented |
Class Variable | x |
Undocumented |
Class Variable | y |
Undocumented |
Class Variable | z |
Undocumented |
Unpacks a bytes sequence into a tagCPCmd object.
Parameters | |
data:bytes | The bytes to unpack, expected to be 33 bytes (1 uint8 + 4 doubles). |
Returns | |
tagCPCmd | A tagCPCmd object. |
Raises | |
struct.error | If the input bytes are not the expected size (33 bytes). |
ValueError | If the unpacked byte value for cpMode does not correspond to a valid CPMode enum member. |
Packs the tagCPCmd object into a bytes sequence.
Packs the cpMode (CPMode value as uint8) and the x, y, z, velocity_or_power (floats) into a byte string. Uses little-endian byte order.
Returns | |
bytes | A bytes object representing the packed data (1 byte + 4 * 8 bytes = 33 bytes). |