11
CAN/CAN.h@2:9418258519ea, 2021-08-06 (annotated)
- Committer:
- yezhong
- Date:
- Fri Aug 06 09:03:02 2021 +0000
- Revision:
- 2:9418258519ea
- Parent:
- 0:dd5d4837292c
111
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
panzhan | 0:dd5d4837292c | 1 | #ifndef _CAN_H |
panzhan | 0:dd5d4837292c | 2 | #define _CAN_H |
panzhan | 0:dd5d4837292c | 3 | |
panzhan | 0:dd5d4837292c | 4 | // 头文件 |
panzhan | 0:dd5d4837292c | 5 | #include "mbed.h" |
panzhan | 0:dd5d4837292c | 6 | #include "math_ops.h" |
panzhan | 0:dd5d4837292c | 7 | #include "leg_message.h" |
panzhan | 0:dd5d4837292c | 8 | #include "used_leg_message.h" |
panzhan | 0:dd5d4837292c | 9 | |
panzhan | 0:dd5d4837292c | 10 | |
panzhan | 0:dd5d4837292c | 11 | // 宏定义 |
panzhan | 0:dd5d4837292c | 12 | #define CAN_ID 0x01 // Master CAN ID |
panzhan | 0:dd5d4837292c | 13 | |
panzhan | 0:dd5d4837292c | 14 | #define P_MIN -12.5f // Value Limits |
panzhan | 0:dd5d4837292c | 15 | #define P_MAX 12.5f |
panzhan | 0:dd5d4837292c | 16 | #define V_MIN -45.0f |
panzhan | 0:dd5d4837292c | 17 | #define V_MAX 45.0f |
panzhan | 0:dd5d4837292c | 18 | #define KP_MIN 0.0f |
panzhan | 0:dd5d4837292c | 19 | #define KP_MAX 500.0f |
panzhan | 0:dd5d4837292c | 20 | #define KD_MIN 0.0f |
panzhan | 0:dd5d4837292c | 21 | #define KD_MAX 5.0f |
panzhan | 0:dd5d4837292c | 22 | #define T_MIN -18.0f |
panzhan | 0:dd5d4837292c | 23 | #define T_MAX 18.0f // Value Limits |
panzhan | 0:dd5d4837292c | 24 | |
panzhan | 0:dd5d4837292c | 25 | |
panzhan | 0:dd5d4837292c | 26 | // 对象外部申明 |
panzhan | 0:dd5d4837292c | 27 | extern CAN knee_can,ankle_can; // 设备的外部申明 |
panzhan | 0:dd5d4837292c | 28 | extern CANMessage knee_rxMsg, ankle_rxMsg; // 主控收到的CAN消息 |
panzhan | 0:dd5d4837292c | 29 | extern CANMessage knee_txMsg, ankle_txMsg; // 主控发送的CAN消息 |
panzhan | 0:dd5d4837292c | 30 | |
panzhan | 0:dd5d4837292c | 31 | // 函数外部申明 |
panzhan | 0:dd5d4837292c | 32 | void pack_cmd(CANMessage * msg, joint_control joint); |
panzhan | 0:dd5d4837292c | 33 | void PackAll(); |
panzhan | 0:dd5d4837292c | 34 | void WriteAll(); |
panzhan | 0:dd5d4837292c | 35 | void unpack_reply(CANMessage msg, leg_state * state); |
panzhan | 0:dd5d4837292c | 36 | |
panzhan | 0:dd5d4837292c | 37 | |
panzhan | 0:dd5d4837292c | 38 | |
panzhan | 0:dd5d4837292c | 39 | #endif |