grpc_client/protos/cmvr/msgs/motor.proto
2025-11-13 03:01:00 +08:00

119 lines
4.0 KiB
Protocol Buffer
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

syntax = "proto3";
import "cmvr/msgs/canopen.proto";
package cmvr.msgs;
/* --------------------------------------------------------
* CAN OPEN 定义
* --------------------------------------------------------*/
// 电机控制模式Operation Mode
enum RunMode {
// 未指定
RUN_MODE_UNSPECIFIED = 0;
// Profile Position Mode - 位置模式
RUN_MODE_PROFILE_POSITION = 1;
// Velocity Mode - 简单速度模式
RUN_MODE_VELOCITY = 2;
// Profile Velocity Mode - 速度模式(带轮廓)
RUN_MODE_PROFILE_VELOCITY = 3;
// Torque Mode - 转矩模式
RUN_MODE_TORQUE = 4;
// Homing Mode - 回零模式
RUN_MODE_HOMING = 5;
// Interpolation Mode - 位置插补模式
RUN_MODE_INTERPOLATED_POSITION = 7;
// Cyclic Synchronous Position Mode - 周期位置模式
RUN_MODE_CYCLIC_SYNC_POSITION = 8;
// Cyclic Synchronous Velocity Mode - 周期速度模式
RUN_MODE_CYCLIC_SYNC_VELOCITY = 9;
// Cyclic Synchronous Current Mode - 周期转矩模式
RUN_MODE_CYCLIC_SYNC_CURRENT = 10;
}
// 电机状态数据
message MotorStatus {
RunMode run_mode = 1; // 当前运行模式
int32 current = 2; // 当前电流单位mA
int32 target_current = 3; // 目标电流单位mA
int32 speed = 4; // 当前速度,转换为度每秒:(speed / 100 / 减速比) * 360
int32 target_speed = 5; // 目标速度,单位同上
int32 position = 6; // 当前电机位置(位置转角度:(position / 65536 / 减速比) * 360
int32 target_position = 7; // 目标位置(非位置模式无效)
uint32 error_state = 8; // 错误状态位(见位说明)
int32 speed_kp = 9; // 速度环Kp含模式和速度信息bit复用
int32 speed_ki = 10; // 速度环Ki含模式和速度信息bit复用
int32 speed_kd = 11; // 速度环Kd
int32 position_kp = 12; // 位置环Kp
int32 position_ki = 13; // 位置环Ki
int32 position_kd = 14; // 位置环Kd
int32 bus_voltage = 15; // 母线电压
int32 max_abs_current = 16; // 最大电流绝对值单位mA
int32 max_pos_current = 17; // 最大正电流单位mA
int32 min_neg_current = 18; // 最小负电流单位mA
int32 max_pos_accel = 19; // 最大正向加速度
int32 min_neg_accel = 20; // 最小负向加速度
int32 max_pos_velocity = 21; // 最大正向速度(转化为度/秒)
int32 min_neg_velocity = 22; // 最小负向速度(转化为度/秒)
int32 max_pos_position = 23; // 最大正向位置(角度)
int32 min_neg_position = 24; // 最小负向位置(角度)
int32 motor_temp = 25; // 电机温度(单位:摄氏度)
int32 board_temp = 26; // 电路板温度(单位:摄氏度)
int32 current_kp = 27; // 电流P
int32 current_ki = 28; // 电流I
int32 current_kd = 29; // 电流D
int32 motor_type = 30; // 电机型号复合字段包含刹车、ACTUATOR_TYPE等
int32 motor_version = 31; // 电机版本号(软件+硬件16进制格式
int32 software_version = 32;// 软件版本号16进制格式
int32 position_offset = 33; // 当前位置偏移(编码器位置 - 偏移值)
bytes csp_data = 34; // 获取CSP8字节数据
int32 encoder_voltage = 35; // 编码器电池电压(新版硬件支持)
int32 encoder_state = 36; // 编码器状态(双编码器=外圈位置,单编码器=状态)
int32 overvoltage_limit = 37; // 过压阈值单位V
int32 undervoltage_limit = 38; // 欠压阈值单位V
int32 coil_over_temp = 39; // 电机线圈过温阈值(单位:℃)
int32 driver_over_temp = 40; // 驱动板过温阈值(单位:℃)
/* ---------------------
* CANOPEN 特有的参数
* --------------------*/
SdoFrame sdo_response = 41;
NmtState nmt_state = 42;
// 只保留值,具体值在使用的时候使用联合体去解析
uint32 ctrl_word = 43;
uint32 status_word = 44;
}