You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
63 lines
2.4 KiB
63 lines
2.4 KiB
3 days ago
|
/*
|
||
|
* msp_TI5MOTOR.h
|
||
|
*
|
||
|
* Created on: Oct 26, 2023
|
||
|
* Author: shiya
|
||
|
*
|
||
|
*/
|
||
|
|
||
|
#ifndef INC_MSP_MSP_TI5MOTOR_H_
|
||
|
#define INC_MSP_MSP_TI5MOTOR_H_
|
||
|
|
||
|
#include "../../BASE/Inc/BSP/bsp_include.h"
|
||
|
#include "msp_Motor.pb.h"
|
||
|
#define DF_MSP_Ti5Motor_PositionMode 44
|
||
|
#define DF_MSP_Ti5Motor_SpeedMode 43
|
||
|
#define DF_MSP_Ti5Motor_CurrentMode 42
|
||
|
#define DF_MSP_Ti5Motor_State_Read 41
|
||
|
|
||
|
|
||
|
void DecodeTi5MotorCAN(uint32_t canID, uint8_t *buffer, uint32_t length);
|
||
|
|
||
|
extern int32_t Function_code;
|
||
|
//电机的ID必须是连续的,第一个电机ID需要在此定义
|
||
|
#define DF_MSP_Ti5Motor_StartID 0
|
||
|
//#define DF_MSP_Ti5Motor_StartID 1
|
||
|
//需要将此函数放置到对应的CAN接收中断函数中
|
||
|
void GF_MSP_Ti5Motor_CANRx_Callback();
|
||
|
|
||
|
//需要每间隔2ms执行一次
|
||
|
void GF_MSP_Ti5Motor_Control_Timer();
|
||
|
|
||
|
//void GF_Tis_Control_Single();
|
||
|
void GF_MSP_Ti5Motor_Error_Clean();
|
||
|
|
||
|
|
||
|
//uint8_t Motor_Control_Motor_Index;
|
||
|
//uint8_t Motor_Control_State;
|
||
|
//
|
||
|
|
||
|
void FiveByteCommand(int8_t MotorID, uint8_t command, int32_t content,FDCANHandler *Ti5_Motor_Controller,int WaitTime);
|
||
|
void OneByteCommand(int8_t MotorID, uint8_t command,FDCANHandler *Ti5_Motor_Controller,int WaitTime);
|
||
|
|
||
|
void Motor_Stop(uint8_t id,FDCANHandler *Ti5_Motor_Controller,int WaitTime);
|
||
|
void Motor_ClearFault(uint8_t id,FDCANHandler *Ti5_Motor_Controller,int WaitTime);
|
||
|
void Motor_SetVelocityModeAndTargetVelocity(uint8_t id, int32_t targetSpeed,FDCANHandler *Ti5_Motor_Controller,int WaitTime);
|
||
|
void MotorSpeedSetup();
|
||
|
void Motor_GetFaultState(uint8_t id,FDCANHandler *Ti5_Motor_Controller,int WaitTime);
|
||
|
void GetCSPByCommand(uint8_t id,FDCANHandler *Ti5_Motor_Controller,int WaitTime);
|
||
|
//void Ti5_Motor_Controller_intialize(FDCANHandler *Handler);
|
||
|
|
||
|
void SetMaximumAllowablePositiveVelocity(uint8_t id, int32_t maxSpeed,FDCANHandler *Ti5_Motor_Controller,int WaitTime);
|
||
|
|
||
|
void SetMinimumAllowableNegativeVelocity(uint8_t id, int32_t minmaxSpeed,FDCANHandler *Ti5_Motor_Controller,int WaitTime);
|
||
|
|
||
|
void SetMaximumPositivePosition(uint8_t id, int32_t position,FDCANHandler *Ti5_Motor_Controller,int WaitTime);
|
||
|
/// <summary>
|
||
|
/// 获取最小负向位置 减速机角度为:(返回值/65536/减速比)*360<
|
||
|
/// </summary>
|
||
|
void SetCurrentModeAndTargetCurent(uint8_t id, int32_t targetCurrent,FDCANHandler *Ti5_Motor_Controller,int WaitTime);
|
||
|
void SetMinimumNegativePosition(uint8_t id, int32_t position,FDCANHandler *Ti5_Motor_Controller,int WaitTime);
|
||
|
|
||
|
#endif /* INC_MSP_MSP_TI5MOTOR_H_ */
|