Skip to content

Commit 4034fce

Browse files
committed
[ECU] Define speed end enkoders values signed
1 parent 3a85fae commit 4034fce

File tree

1 file changed

+11
-12
lines changed

1 file changed

+11
-12
lines changed

docs/platform/ecu/protocol.md

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,7 @@ This is the core protocol used in both TCP and UART modes.
2626
| Offset | Size (bytes) | Field | Description |
2727
|--------|-------------|---------------|-------------|
2828
| 0 | 1 | `command_id` | Unique command identifier |
29-
| 1 | 1 | `payload_size` | Number of bytes in the payload |
30-
| 2 | N | `payload` | Command-specific data |
29+
| 1 | N | `payload` | Command-specific data |
3130

3231
## 3. Command Set
3332
| Command ID | Command Name | Description |
@@ -61,7 +60,7 @@ Sets the speed of a specific motor.
6160
|--------|-------------|------------------|--------|
6261
| 0 | 1 | command_id | 0x02 |
6362
| 1 | 1 | motor_id | Motor ID (0-3) |
64-
| 2 | 4 | speed | Speed in RPM multiplied by 100 |
63+
| 2 | 4 | speed | Speed in RPM multiplied by 100 (signed value, negative value means reverse direction) |
6564

6665
**Response**
6766
| Offset | Size (bytes) | Field Description | Values |
@@ -75,10 +74,10 @@ Sets the speed for all four motors in a single command.
7574
| Offset | Size (bytes) | Field Description | Values |
7675
|--------|-------------|------------------|--------|
7776
| 0 | 1 | command_id | 0x03 |
78-
| 1 | 4 | speed_motor_1 | Speed in RPM multiplied by 100 |
79-
| 5 | 4 | speed_motor_2 | Speed in RPM multiplied by 100 |
80-
| 9 | 4 | speed_motor_3 | Speed in RPM multiplied by 100 |
81-
| 13 | 4 | speed_motor_4 | Speed in RPM multiplied by 100 |
77+
| 1 | 4 | speed_motor_1 | Speed in RPM multiplied by 100 (signed value, negative value means reverse direction) |
78+
| 5 | 4 | speed_motor_2 | Speed in RPM multiplied by 100 (signed value, negative value means reverse direction) |
79+
| 9 | 4 | speed_motor_3 | Speed in RPM multiplied by 100 (signed value, negative value means reverse direction) |
80+
| 13 | 4 | speed_motor_4 | Speed in RPM multiplied by 100 (signed value, negative value means reverse direction) |
8281

8382
**Response**
8483
| Offset | Size (bytes) | Field Description | Values |
@@ -98,7 +97,7 @@ Retrieves the encoder value for a specific motor.
9897
| Offset | Size (bytes) | Field Description | Values |
9998
|--------|-------------|------------------|--------|
10099
| 0 | 1 | command_id | 0x04 |
101-
| 1 | 4 | encoder_value | Encoder value |
100+
| 1 | 4 | encoder_value | Encoder value (signed value, negative value means reverse direction) |
102101

103102
### get_all_encoders (0x05)
104103
Retrieves the encoder values for all motors.
@@ -112,8 +111,8 @@ Retrieves the encoder values for all motors.
112111
| Offset | Size (bytes) | Field Description | Values |
113112
|--------|-------------|------------------|--------|
114113
| 0 | 1 | command_id | 0x05 |
115-
| 1 | 4 | encoder_value_motor_1 | Encoder value |
116-
| 5 | 4 | encoder_value_motor_2 | Encoder value |
117-
| 9 | 4 | encoder_value_motor_3 | Encoder value |
118-
| 13 | 4 | encoder_value_motor_4 | Encoder value |
114+
| 1 | 4 | encoder_value_motor_1 | Encoder value (signed value, negative value means reverse direction) |
115+
| 5 | 4 | encoder_value_motor_2 | Encoder value (signed value, negative value means reverse direction) |
116+
| 9 | 4 | encoder_value_motor_3 | Encoder value (signed value, negative value means reverse direction) |
117+
| 13 | 4 | encoder_value_motor_4 | Encoder value (signed value, negative value means reverse direction) |
119118

0 commit comments

Comments
 (0)