fix bugs
This commit is contained in:
parent
4d32450e3d
commit
35d88aaa93
|
@ -42,6 +42,7 @@
|
||||||
"usb_device.h": "c",
|
"usb_device.h": "c",
|
||||||
"vofa_protocol.h": "c",
|
"vofa_protocol.h": "c",
|
||||||
"master_process.h": "c",
|
"master_process.h": "c",
|
||||||
"stdint-gcc.h": "c"
|
"stdint-gcc.h": "c",
|
||||||
|
"string.h": "c"
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -76,9 +76,7 @@ void CANRegister(can_instance* ins,can_instance_config config)
|
||||||
instance[idx]->rx_id = config.rx_id;
|
instance[idx]->rx_id = config.rx_id;
|
||||||
instance[idx]->can_module_callback = config.can_module_callback;
|
instance[idx]->can_module_callback = config.can_module_callback;
|
||||||
|
|
||||||
CANAddFilter(instance[idx]);
|
CANAddFilter(instance[idx++]);
|
||||||
|
|
||||||
return instance[idx++];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void CANTransmit(can_instance *_instance)
|
void CANTransmit(can_instance *_instance)
|
||||||
|
|
|
@ -30,7 +30,7 @@ static void USARTServiceInit(usart_instance *_instance)
|
||||||
|
|
||||||
void USARTRegister(usart_instance *_instance)
|
void USARTRegister(usart_instance *_instance)
|
||||||
{
|
{
|
||||||
static instance_idx;
|
static uint8_t instance_idx;
|
||||||
USARTServiceInit(_instance);
|
USARTServiceInit(_instance);
|
||||||
instance[instance_idx++] = _instance;
|
instance[instance_idx++] = _instance;
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,7 +96,7 @@ typedef struct
|
||||||
float frame_period; //ʱ<><CAB1><EFBFBD><EFBFBD>
|
float frame_period; //ʱ<><CAB1><EFBFBD><EFBFBD>
|
||||||
} ramp_function_source_t;
|
} ramp_function_source_t;
|
||||||
|
|
||||||
typedef __packed struct
|
typedef struct
|
||||||
{
|
{
|
||||||
uint16_t Order;
|
uint16_t Order;
|
||||||
uint32_t Count;
|
uint32_t Count;
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
#include "QuaternionEKF.h"
|
#include "QuaternionEKF.h"
|
||||||
#include "bsp_temperature.h"
|
#include "bsp_temperature.h"
|
||||||
#include "spi.h"
|
#include "spi.h"
|
||||||
|
#include "user_lib.h"
|
||||||
|
|
||||||
static INS_t INS;
|
static INS_t INS;
|
||||||
IMU_Param_t IMU_Param;
|
IMU_Param_t IMU_Param;
|
||||||
|
|
|
@ -8,14 +8,6 @@
|
||||||
#define VISION_RECV_SIZE 36u
|
#define VISION_RECV_SIZE 36u
|
||||||
#define VISION_SEND_SIZE 36u
|
#define VISION_SEND_SIZE 36u
|
||||||
|
|
||||||
|
|
||||||
typedef struct
|
|
||||||
{
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 调用此函数初始化和视觉的串口通信
|
* @brief 调用此函数初始化和视觉的串口通信
|
||||||
*
|
*
|
||||||
|
@ -30,5 +22,4 @@ Vision_Recv_s* VisionInit(UART_HandleTypeDef* handle);
|
||||||
*/
|
*/
|
||||||
void VisionSend(Vision_Send_s *send);
|
void VisionSend(Vision_Send_s *send);
|
||||||
|
|
||||||
|
|
||||||
#endif // !MASTER_PROCESS_H
|
#endif // !MASTER_PROCESS_H
|
|
@ -139,4 +139,5 @@ uint16_t get_protocol_info(uint8_t *rx_buf, //接收到的原始数据
|
||||||
return pro.cmd_id;
|
return pro.cmd_id;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,7 @@ static void DecodeJoint(can_instance* motor_instance)
|
||||||
uint16_t tmp;
|
uint16_t tmp;
|
||||||
for (size_t i = 0; i < HT_MOTOR_CNT; i++)
|
for (size_t i = 0; i < HT_MOTOR_CNT; i++)
|
||||||
{
|
{
|
||||||
if(&joint_motor_info[i]->motor_can_instace==motor_instance)
|
if(joint_motor_info[i]->motor_can_instace==motor_instance)
|
||||||
{
|
{
|
||||||
tmp = (motor_instance->rx_buff[1] << 8) | motor_instance->rx_buff[2];
|
tmp = (motor_instance->rx_buff[1] << 8) | motor_instance->rx_buff[2];
|
||||||
joint_motor_info[i]->last_ecd=joint_motor_info[i]->ecd;
|
joint_motor_info[i]->last_ecd=joint_motor_info[i]->ecd;
|
||||||
|
@ -40,7 +40,8 @@ joint_instance* HTMotorInit(can_instance_config config)
|
||||||
{
|
{
|
||||||
static uint8_t idx;
|
static uint8_t idx;
|
||||||
joint_motor_info[idx]=(joint_instance*)malloc(sizeof(joint_instance));
|
joint_motor_info[idx]=(joint_instance*)malloc(sizeof(joint_instance));
|
||||||
CANRegister(&joint_motor_info[idx++]->motor_can_instace,config);
|
CANRegister(joint_motor_info[idx++]->motor_can_instace,config);
|
||||||
|
return joint_motor_info[idx++];
|
||||||
}
|
}
|
||||||
|
|
||||||
void JointControl(joint_instance* _instance,float current)
|
void JointControl(joint_instance* _instance,float current)
|
||||||
|
|
|
@ -6,7 +6,7 @@ static void DecodeDriven(can_instance* _instance)
|
||||||
{
|
{
|
||||||
for (size_t i = 0; i < LK_MOTOR_CNT; i++)
|
for (size_t i = 0; i < LK_MOTOR_CNT; i++)
|
||||||
{
|
{
|
||||||
if(&driven_motor_info[i]->motor_can_instance==_instance)
|
if (driven_motor_info[i]->motor_can_instance == _instance)
|
||||||
{
|
{
|
||||||
driven_motor_info[i]->last_ecd = driven_motor_info[i]->ecd;
|
driven_motor_info[i]->last_ecd = driven_motor_info[i]->ecd;
|
||||||
driven_motor_info[i]->ecd = (uint16_t)((_instance->rx_buff[7] << 8) | _instance->rx_buff[6]);
|
driven_motor_info[i]->ecd = (uint16_t)((_instance->rx_buff[7] << 8) | _instance->rx_buff[6]);
|
||||||
|
@ -23,7 +23,8 @@ driven_instance* LKMotroInit(can_instance_config config)
|
||||||
static uint8_t idx;
|
static uint8_t idx;
|
||||||
driven_motor_info[idx] = (driven_instance *)malloc(sizeof(driven_instance));
|
driven_motor_info[idx] = (driven_instance *)malloc(sizeof(driven_instance));
|
||||||
config.can_module_callback = DecodeDriven;
|
config.can_module_callback = DecodeDriven;
|
||||||
CANRegister(driven_motor_info[idx++]->motor_can_instance,config);
|
CANRegister(driven_motor_info[idx]->motor_can_instance, config);
|
||||||
|
return driven_motor_info[idx++];
|
||||||
}
|
}
|
||||||
|
|
||||||
void DrivenControl(int16_t motor1_current, int16_t motor2_current)
|
void DrivenControl(int16_t motor1_current, int16_t motor2_current)
|
||||||
|
@ -44,4 +45,3 @@ void SetDrivenMode(driven_mode cmd,uint16_t motor_id)
|
||||||
|
|
||||||
// CANTransmit(driven_mode)
|
// CANTransmit(driven_mode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#ifndef MOTOR_DEF_H
|
#ifndef MOTOR_DEF_H
|
||||||
#define MOTOR_DEF_H
|
#define MOTOR_DEF_H
|
||||||
|
|
||||||
|
#include "controller.h"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief 闭环类型,如果需要多个闭环,则使用或运算
|
* @brief 闭环类型,如果需要多个闭环,则使用或运算
|
||||||
* 例如需要速度环和电流环: CURRENT_LOOP|SPEED_LOOP
|
* 例如需要速度环和电流环: CURRENT_LOOP|SPEED_LOOP
|
||||||
|
|
Loading…
Reference in New Issue