Skip to main content
Version: 3.0.x

Motor driver command message

The motor driver can be controlled remotely over a communication interface, such as CAN Bus. Two parameters are needed: Mode and command. Both of them are described in the Driver documentation.

When this message is used for commanding the controller, the Application is overridden and the motor driver is controlled directly by the message. This override has a timeout of 200 ms. If no motor driver command message arrives within 200 ms, the motor driver will be controlled by the Application again.

If the number of bytes in the payload is even, the first byte in the payload must contain a live counter. The receiver must increment this live counter in every transmit instance, otherwise, the message will be ignored. This is to prevent a runaway situation (e.g. the transmitter is repeating the same message payload without linkage to its process context).

There are several formats of motor driver command messages. The difference is in message length and datatypes.

info

All here listed messages are unicast with SID = 25

warning

Payload byte position is not corresponding with byte position in transfer layer (CAN, UART, USB, bluetooth...) Before continuing, read carefully how to create a message for:

Driver command 1 (fixed point command)

without live counter (payload length = 3)

Payload byteDatatypeDescription
0uint8Driver mode
1-2int16Driver cmd, -32768 - 32767 mapped to range -1 - 1. Value is transfered as big-endian. (MSB first)

with live counter (payload length = 4)

Payload byteDatatypeDescription
0uint8live counter
1uint8Driver mode
2-3int16Driver cmd, -32768 - 32767 mapped to range -1 - 1. Value is transfered as big-endian. (MSB first)

Driver command 2 (floating point command)

without live counter (payload length = 5)

Payload byteDatatypeDescription
0uint8Driver mode
1-4floatDriver cmd. Float value is transfered as big-endian. (MSB first)

with live counter (payload length = 6)

Payload byteDatatypeDescription
0uint8live counter
1uint8Driver mode
2-5floatDriver cmd. Float value is transfered as big-endian. (MSB first)

Driver command 3 (fixed point command with multipliers)

without live counter (payload length = 7)

Payload byteDatatypeDescription
0uint8Driver mode
1-2int16Driver cmd, -32768 - 32767 mapped to range -1 - 1. Value is transfered as big-endian. (MSB first)
3-4uint16Driver imult and rmult, 0 - 65535 mapped to range 0 - 1
5-6uint16Driver umult, 0 - 65535 mapped to range 0 - 1