The Set Speed command is used to set the motor controller’s target current output. The motor controller’s current operating mode will be set to CURRENT mode. The command timeout counter is reset when this command is received.
If the commanded current is less than the configured minimum current, the motor is stopped unless the CAN bus command is sent with a specified Current Off Delay.
Command Parameters
Parameter | Units | Description |
---|---|---|
Current | amps | Target motor current, in amps |
Current Off Delay | sec | (CAN bus only) Optional parameter. If commanded, the current controller will be prevented from switching off modulation for target currents less than the configured minimum current for this amount of time. This parameter is only functional when operating an FOC motor. |
[reveal1 title=”Web App”]
- Switch to
Operate
tab - From the
Control Mode
selection box, selectCurrent Control
- Under
Current Control
, specify a minimum and maximum commandable amperage - a. Drag the slider to change the commanded current
OR
b. Type a current value into the manual entry box and clickSet Current
[/reveal1]
[reveal1 title=”Serial Interface”]
This command follows the standard VESC serial packet format.
Command Structure
Byte | Datatype | Value | Scaler | Description |
---|---|---|---|---|
0 | uint8 | 0x02 | Packet start byte | |
1 | uint8 | 0x05 | Packet length | |
2 | uint8 | 0x06 | Packet ID [COMM_SET_CURRENT] | |
3 | int32 | 1000 | Target current, in amps | |
7 | uint16 | CRC16 of data section | ||
9 | uint8 | 0x03 | Stop byte |
Command Examples
The following table shows an example command to set the target current to 5 amps.
Start Byte | Length | PID | Current | CRC16 | End Byte | |
---|---|---|---|---|---|---|
Hex | 0x02 | 0x05 | 0x06 | 0x00001388 | 0x8B25 | 0x03 |
Integer | 2 | 5 | 6 | 5000 | 35621 | 3 |
The following table shows an example command to set the target current to -10 amps.
Start Byte | Length | PID | Current | CRC16 | End Byte | |
---|---|---|---|---|---|---|
Hex | 0x02 | 0x05 | 0x06 | 0x FFFFD8F0 | 0x3AD4 | 0x03 |
Integer | 2 | 5 | 6 | -10000 | 15060 | 3 |
Command Response
There is no response for this command.
[/reveal1]
[reveal1 title=”CAN Bus Interface”]
This command follows the standard VESC CAN command frame format.
The CAN bus command has two formats – one with the optional minimum current controller timeout and one without.
Without the timeout:
Packet Identifier: | 0x0 1 [CAN_PACKET_SET_CURRENT] |
Data Length Code: | 4 |
Contents: | [int32] Target current * 1000 |
With the timeout:
Packet Identifier: | 0x0 1 [CAN_PACKET_SET_CURRENT] |
Data Length Code: | 6 |
Contents: | [int16] Current timeout * 1000 [int32] Target current * 1000 |
Command Response
There is no response for this command.
[/reveal1]