Version 1 (modified by edison, 14 years ago) (diff) |
---|
CANbus Communication Specifications
Data Link Specifications
- 1Mbaud CANbus
- 8 time quanta per bit
- 75% sampling point
- Sync jump width = 1 time quanta (TQ)
- 11-bit MsgID (standard CAN)
- Proprietary protocol, not DeviceNet or CANopen
- Recommended reading: Controller Area Network by Konrad Etschberger
CANbus Timing
- 75μS to ask for position
- 75μS per puck to respond with the positions
- 125μS to send a packed torque to the lower 4DOF
- 125μS to send a packed torque to the wrist
- Control-side processing time on PC
For the 4DOF, it is: 75+(4*75)+125+PC = 500μS + PC For the 7DOF, it is: 75+(7*75)+(2*125)+PC = 850μS + PC
These numbers are limited by the 1 Mbps CANbus. Each message has a 47-bit frame (47μS), plus payload data (3 bytes, 24μS typ). CANbus transceivers are not rated above 1 Mbps due to slew-rate limitations.
ID Specifications
Message IDs
- [GFFFFFTTTTT] (11 bits, binary)
- G: Group, 0 = Directed message, 1 = Group broadcast
- F: From ID, Host = 00000, Motor N = N
- T: To ID or group
Examples:
- 00000000011 => Directed message from host to motor 3 (3 = 00011, binary)
- 10001100100 => Group broadcast from motor 3 to group 4
Motor IDs and Groups
Each motor in the robot has a unique communication ID, can be a part of any three groups (GRPA, GRPB, GRPC), and will listen for and process messages bound for its ID or any of its groups. There are a total of 32 possible groups (from 00000 to 11111). Motors 1 to 4 belong to groups 0, 1, and 4, motors 5 to 7 belong to groups 0, 2, and 5, and the host belongs to groups 3 and 6 by default. The default groups are:
- 0 = All actuators
- 1 = Lower arm torques (motors 1-4)
- 2 = Upper arm torques (motors 5-7)
- 3 = Position feedback
- 4 = Lower arm property
- 5 = Upper arm property
- 6 = Property feedback
CANbus Frame Data Payload
Standard CANbus Message Format
CAN specifies a maximum of 8 bytes/frame payload – our typical payload consists of 4-6 bytes: [APPPPPPP] [00000000] [LLLLLLLL] [mmmmmmmm] [MMMMMMMM] [HHHHHHHH]
- A: Action, 0 = Get property, 1 = Set property
- P: Property (128 possible values, 0..127, 0000000..1111111), see Motor Controller Properties and Safety Module Properties below.
- 0: Second byte (almost) always set to zero (see exceptions below)
- L: Low byte of data value
- m: mid-low byte of data value
- If sending a 16-bit integer value, the following are not used:
- M: Mid-high byte of data value
- H: High byte of data value
The CAN frame data length code (DLC) is set to the number of bytes being transmitted.
Exceptions
- The Position property (P) is a 22-bit, 2's complement number. It is packed into a 3-byte frame payload [00MMMMMM] [mmmmmmmm] [LLLLLLLL]. It is always sent to Group 3.
- Command torque can be sent as a set of four 14-bit, 2's complement numbers. It is sent to the motor controllers in 8 bytes (max):
0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 |
APPPPPPP | BBBBBBbb | bbbbbbCC | CCCCcccc | ccccDDDD | DDdddddd | ddEEEEEE | eeeeeeee |
- A = Action
- P = Property
- B = Upper 6 bits of first value
- b = Lower 8 bits of first value
- C = Upper 6 bits of second value
- c = Lower 8 bits of second value
- D = Upper 6 bits of third value
- d = Lower 8 bits of third value
- E = Upper 6 bits of fourth value
- e = Lower 8 bits of fourth value
Each motor has a property (PIDX: 1-4), which tells it which torque to use from the set of 4
Full Communication Example
This example contains:
- 3 motors with IDs of 5, 6, and 7
- A host with an ID of 0
Host sends:
- MsgID [10000000000] → Group 0
- Data [10000101] [00000000] [00000010] [0000000] → Set property 5 (STAT) to 2 (STATUS_READY)
- The motors start up with STAT = 0 (STATUS_RESET)
- Setting STAT to READY gets the motors ready to receive additional data
- Motors will only respond to STAT and VERS commands while in RESET (for safety)
Host sends:
- MsgID [10000000000] → Group 0
- Data [10001000] [00000000] [00000010] [00000000] → Set property 8 (MODE) to 2 (MODE_TORQUE)
- The motors default to MODE = 0 (MODE_IDLE)
- Setting MODE to MODE_TORQUE tells the motors to apply any torque sent to them
- When MODE = MODE_IDLE, motors will ignore any torque commands sent and apply braking
- When using a WAM, the safety system will set the MODE when you press the IDLE/ACTIVATE buttons
- Do not try to bypass the WAM’s safety system by setting the MODE directly, this will cause undesired operation.
Host sends:
- MsgID [10000000000] → Group 0
- Data [00110000] → Get property 48 (P)
Motors send:
- MsgID [10010100011] → From ID 5 to Group 3
- Data [00000000] [00000000] [0000010] → My position is 2 encoder counts
- MsgID [10011000011] → From ID 6 to Group 3
- Data [00000000] [00000000] [0000111] → My position is 7 encoder counts
- MsgID [10011100011] → From ID 7 to Group 3
- Data [00111111] [11111111] [11111110] → My position is -2 encoder counts
Host uses these positions to calculate a torque.
Host sends:
- MsgID [10000000010] → Group 2
- Data [10101010] [AAAAAAaa] [aaaaaaBB] [BBBBbbbb] [bbbbCCCC] [CCcccccc] [cc000000] [00000000]
- Set torques to new values AAAAAAaaaaaaaa, etc.