Difference between revisions of "CanServo/Protocol/Control/en"
(Created page with "CAN servo is controlled by sending CAN packets with CAN ID set in CanServo/ID2/en and data following the message format below. According to the message type of CAN Data, t...") |
|||
(12 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
CAN servo is controlled by sending CAN packets with CAN ID set in [[CanServo/ID2/en]] and data following the message format below. | This protocol is used when [[CanServo/MODE/CAN/en]] = 2.0A or 2.0B. | ||
For protocol in UAVCAN state, refer to [[CanServo/Protocol/UAVCAN/en]]. | |||
CAN servo is controlled by sending CAN packets with CAN ID set in Register [[CanServo/ID2/en]] and data following the message format below. | |||
Depending on the message type of CAN Data, the servo register can be changed or read. | |||
* As a simple example, when the following packet is sent, all received servos change the value of Register 0x30 to 0x1234. | * As a simple example, when the following packet is sent, all received servos change the value of Register 0x30 to 0x1234. | ||
** CAN ID = 0 | ** CAN ID = 0 | ||
** CAN DATA = 'w', 0, 0x30, 0x34, 0x12 | ** CAN DATA = 'w', 0, 0x30, 0x34, 0x12 | ||
** DLC = 5 | ** DLC = 5 | ||
* However, the Can Packet Type is determined according to the [[CanServo/MODE/CAN/en]] setting value. | |||
Line 17: | Line 22: | ||
Old Format: | V0: Old Format: | ||
Line 42: | Line 47: | ||
New Format: (checksum removed) | V1: New Format: (checksum removed) | ||
Latest revision as of 01:58, 29 September 2022
This protocol is used when CanServo/MODE/CAN/en = 2.0A or 2.0B. For protocol in UAVCAN state, refer to CanServo/Protocol/UAVCAN/en.
CAN servo is controlled by sending CAN packets with CAN ID set in Register CanServo/ID2/en and data following the message format below.
Depending on the message type of CAN Data, the servo register can be changed or read.
- As a simple example, when the following packet is sent, all received servos change the value of Register 0x30 to 0x1234.
- CAN ID = 0
- CAN DATA = 'w', 0, 0x30, 0x34, 0x12
- DLC = 5
- However, the Can Packet Type is determined according to the CanServo/MODE/CAN/en setting value.
There are 11 types of messages in 8 data bytes of CAN Packet, 3 old types and 8 new types.
The first byte indicates the kind of message.
The second byte is the servo ID.
Here, Target Servo ID must match the value of CanServo/ID1/en of Servo.
Or if 0 is specified, all servos will react.
For the exact procedure, refer to CanServo/Packet Accept Rule/en.
V0: Old Format:
- Old Write Command
- write 1 register
- 0x96, (target servo id), (address), 2, (data low byte), (data high byte), (chksum)
- DLC = 7
- write 1 register
- Old Read Command
- read 1 register
- 0x96, (target servo id), (address), 0, (chksum)
- DLC = 5
- read 1 register
- Old Return Message
- return 1 register
- 0x69, (servo id), (address), 2, (data low byte), (data high byte), (chksum)
- DLC = 7
- return 1 register
- Old message's chksum
- add all bytes before chksum, except first byte
V1: New Format: (checksum removed)
- Write Command
- write 1 register
- 'w', (target servo id), (address), (data low byte), (data high byte)
- DLC = 5
- write 2 registers
- 'W', (target servo id), (address 0), (data 0 low byte), (data 0 high byte), (address 1), (data 1 low byte), (data 1 high byte)
- DLC = 8
- write 1 register
- Read Command
- read 1 register
- 'r', (target servo id), (address)
- DLC = 3
- read 2 registers
- 'R', (target servo id), (address 0), (address 1)
- DLC = 4
- read 1 register
- Write and Read Command
- write and read: 1 register
- 'x', (target servo id), (address), (data low byte), (data high byte)
- DLC = 5
- write and read: 2 registers
- 'X', (target servo id), (address 0), (data 0 low byte), (data 0 high byte), (address 1), (data 1 low byte), (data 1 high byte)
- DLC = 8
- write and read: 1 register
- Return Message : Servo --> Host
- return 1 register
- 'v', (servo id), (address), (data low byte), (data high byte)
- DLC = 5
- return 2 registers
- 'V', (servo id), (address 0), (data 0 low byte), (data 0 high byte), (address 1), (data 1 low byte), (data 1 high byte)
- DLC = 8
- return 1 register