201 lines
4.7 KiB
C
201 lines
4.7 KiB
C
//#include "app_config.h"
|
|
//#include "app_dependence.h"
|
|
//#include "interface.h"
|
|
//
|
|
//#include "app_frm_monitor.h"
|
|
//#include "app_frm_signal.h"
|
|
//#include "app_frm_timer.h"
|
|
//
|
|
//#include "sdrv_vic.h"
|
|
//
|
|
//
|
|
//
|
|
///**
|
|
// * @brief 电机失能函数
|
|
// * @param motorIndex 电机索引 (0, 1, 2)
|
|
// * @return 0: 成功, -1: 失败
|
|
// */
|
|
//int motorDisable(uint8_t motorIndex)
|
|
//{
|
|
// // 检查电机索引有效性
|
|
// if (motorIndex > MAX_MOTOR_INDEX) {
|
|
// return -1;
|
|
// }
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
// // TODO: 添加电机失能的具体实现
|
|
// // 根据motorIndex执行对应电机的失能操作
|
|
//
|
|
// return 0;
|
|
//}
|
|
//
|
|
///**
|
|
// * @brief 电机使能函数
|
|
// * @param motorIndex 电机索引 (0, 1, 2)
|
|
// * @return 0: 成功, -1: 失败
|
|
// */
|
|
//int motorEnable(uint8_t motorIndex)
|
|
//{
|
|
// // 检查电机索引有效性
|
|
// if (motorIndex > MAX_MOTOR_INDEX) {
|
|
// return -1;
|
|
// }
|
|
//
|
|
// // TODO: 添加电机使能的具体实现
|
|
// // 根据motorIndex执行对应电机的使能操作
|
|
//
|
|
// return 0;
|
|
//}
|
|
//
|
|
///**
|
|
// * @brief 设置电机模式函数
|
|
// * @param motorIndex 电机索引 (0, 1, 2)
|
|
// * @param mode 电机模式参数
|
|
// * @return 0: 成功, -1: 失败
|
|
// */
|
|
//int setMotorMode(uint8_t motorIndex, uint8_t mode)
|
|
//{
|
|
// // 检查电机索引有效性
|
|
// if (motorIndex > MAX_MOTOR_INDEX) {
|
|
// return -1;
|
|
// }
|
|
//
|
|
// // TODO: 添加设置电机模式的具体实现
|
|
// // 根据motorIndex和mode参数设置对应电机的工作模式
|
|
//
|
|
// return 0;
|
|
//}
|
|
//
|
|
///**
|
|
// * @brief 设置电机速度函数
|
|
// * @param motorIndex 电机索引 (0, 1, 2)
|
|
// * @param speed 电机速度参数
|
|
// * @return 0: 成功, -1: 失败
|
|
// */
|
|
//int setMotorSpeed(uint8_t motorIndex, float speed)
|
|
//{
|
|
// // 检查电机索引有效性
|
|
// if (motorIndex > MAX_MOTOR_INDEX) {
|
|
// return -1;
|
|
// }
|
|
//
|
|
// // TODO: 添加设置电机速度的具体实现
|
|
// // 根据motorIndex和speed参数设置对应电机的速度
|
|
//
|
|
// return 0;
|
|
//}
|
|
//
|
|
///**
|
|
// * @brief 设置电机电流函数
|
|
// * @param motorIndex 电机索引 (0, 1, 2)
|
|
// * @param current 电机电流参数
|
|
// * @return 0: 成功, -1: 失败
|
|
// */
|
|
//int setMotorCurrent(uint8_t motorIndex, float current)
|
|
//{
|
|
// // 检查电机索引有效性
|
|
// if (motorIndex > MAX_MOTOR_INDEX) {
|
|
// return -1;
|
|
// }
|
|
//
|
|
// // TODO: 添加设置电机电流的具体实现
|
|
// // 根据motorIndex和current参数设置对应电机的电流
|
|
//
|
|
// return 0;
|
|
//}
|
|
//
|
|
///**
|
|
// * @brief 设置电机位置函数
|
|
// * @param motorIndex 电机索引 (0, 1, 2)
|
|
// * @param position 电机位置参数
|
|
// * @return 0: 成功, -1: 失败
|
|
// */
|
|
//int setMotorPosition(uint8_t motorIndex, float position)
|
|
//{
|
|
// // 检查电机索引有效性
|
|
// if (motorIndex > MAX_MOTOR_INDEX) {
|
|
// return -1;
|
|
// }
|
|
//
|
|
// switch(motorIndex)
|
|
// {
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
// }
|
|
//
|
|
// un_sdo_output3.bit_data.index = 0x0;
|
|
// un_sdo_output3.bit_data.object_index = 0x0;
|
|
// un_sdo_output3.bit_data.data = 0x0;//
|
|
// publishMessage(&un_sdo_output3, 1);
|
|
//
|
|
//
|
|
//
|
|
// // TODO: 添加设置电机位置的具体实现
|
|
// // 根据motorIndex和position参数设置对应电机的位置
|
|
//
|
|
// return 0;
|
|
//}
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//void motorInit(void *signal_id)
|
|
//{
|
|
// if(turn_data.current_state == POWER_WORKING)
|
|
// {
|
|
// un_sdo_output4.bit_data.index = RUM_MODE;
|
|
// un_sdo_output4.bit_data.object_index = 0x0;
|
|
// un_sdo_output4.bit_data.data = POSITION_MODE_CSP;//设定位置模式
|
|
// publishMessage(&un_sdo_output4, 1);
|
|
//
|
|
// un_sdo_output8.bit_data.index = RUM_MODE;
|
|
// un_sdo_output8.bit_data.object_index = 0x0;
|
|
// un_sdo_output8.bit_data.data = POSITION_MODE_CSP;//设定位置模式
|
|
// publishMessage(&un_sdo_output8, 1);
|
|
//
|
|
// un_sdo_output3.bit_data.index = 0x0;
|
|
// un_sdo_output3.bit_data.object_index = 0x0;
|
|
// un_sdo_output3.bit_data.data = 0x0;//
|
|
// publishMessage(&un_sdo_output3, 1);
|
|
//
|
|
// un_sdo_output7.bit_data.index = 0x0;
|
|
// un_sdo_output7.bit_data.object_index = 0x0;
|
|
// un_sdo_output7.bit_data.data = 0x0;//
|
|
// publishMessage(&un_sdo_output7, 1);
|
|
// }
|
|
//// timerStart(&turn_timer2,1000,1);//1s调用一次
|
|
//}
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|
|
//
|