include “stm32f10x.h”
include “stm32f10x_it.h”
include “delay.h”
include “nvic_conf.h”
include “rcc_conf.h”
include “usart.h”
include “encoder.h”
include “contact.h”
include “gpio_conf.h”
include “tim2_5_6.h”
include “odometry.h”
include “tim2_5_6.h”
include “stdbool.h”
include
include “string.h”
include “math.h”
“`
/************************************* 输出 *******************************************************/
char odometry_data[21]={0}; //发送给串口的里程计数据数组
float odometry_right=0,odometry_left=0;//串口得到的左右轮速度
/************************************* 输入 *******************************************************/
extern float position_x,position_y,oriention,velocity_linear,velocity_angular; //计算得到的里程计数值
extern u8 USART_RX_BUF[USART_REC_LEN]; //串口接收缓冲,最大USART_REC_LEN个字节.
extern u16 USART_RX_STA; //串口接收状态标记
extern float Milemeter_L_Motor,Milemeter_R_Motor; //dt时间内的左右轮速度,用于里程计计算
/************************************* 变量 *******************************************************/
u8 main_sta=0; //用作处理主函数各种if,去掉多余的flag(1打印里程计)(2调用计算里程计数据函数)(3串口接收成功)(4串口接收失败)
union recieveData //接收到的数据
{
float d; //左右轮速度
unsigned char data[4];
}leftdata,rightdata; //接收的左右轮数据
union odometry //里程计数据共用体
{
float odoemtry_float;
unsigned char odometry_char[4];
}x_data,y_data,theta_data,vel_linear,vel_angular; //要发布的里程计数据,分别为:X,Y方向移动的距离,当前角度,线速度,角速度
/******************************************************************************************************/
|