同步步兵代码,暂时关闭底盘跟随

This commit is contained in:
2025-11-02 21:21:11 +08:00
parent 456cc96c81
commit 3821589bed
693 changed files with 238044 additions and 2735 deletions

View File

@@ -0,0 +1,37 @@
#ifndef __PARAMETER_H
#define __PARAMETER_H
/*=============================================结构参数=============================================*/
#define Yaw_GM6020PositionValue 4050//Yaw轴编码器值4050
#define Pitch_GM6020PositionValue 3245//Pitch轴编码器值
#define Pitch_GM6020PositionLowerLinit 3000//Pitch轴编码器值下限
#define Pitch_GM6020PositionUpperLinit 2900//Pitch轴编码器值上限
#define Pitch_GM6020AngleLowerLinit 15.0f//Pitch轴编码器值下限
#define Pitch_GM6020AngleUpperLinit -10.0f//Pitch轴编码器值上限
/*=============================================云台参数=============================================*/
#define Gimbal_FrictionWheelSpeed 500//摩擦轮转速,弹速限制30m/s
#define Gimbal_RammerSpeed -1500//拨弹盘转速,射频为7时大概冷却和热量相抵,5400是射频20的最低下限
#define Gimbal_LeverSpeedMapRate 3.0f//云台俯仰拨杆速度映射比例
#define Gimbal_YawPitchSpeedRate 2.0f//云台偏航俯仰速度比
/*=============================================操作手参数=============================================*/
#define PC_Go (Remote_RxData.Remote_Key_W)//前
#define PC_Back (Remote_RxData.Remote_Key_S)//后
#define PC_Left (Remote_RxData.Remote_Key_A)//左
#define PC_Right (Remote_RxData.Remote_Key_D)//右
#define PC_Spin (Remote_RxData.Remote_Mouse_RL)//视角水平移动
#define PC_Pitch (Remote_RxData.Remote_Mouse_DU)//视角垂直移动
#define PC_Mouse_RLSensitivity 3.0f//鼠标左右灵敏度
#define PC_Mouse_DUSensitivity 8.0f//鼠标上下灵敏度
#define PC_FrictionWheel (Remote_RxData.Remote_KeyPush_Q)//摩擦轮
#define PC_Fire (Remote_RxData.Remote_Mouse_KeyL)//发射
#define PC_Ejection (Remote_RxData.Remote_Key_E)//退弹
#define PC_GyroScope (Remote_RxData.Remote_KeyPush_Ctrl)//小陀螺
#define PC_SpeedUp (Remote_RxData.Remote_Key_Shift)//加速
#endif

View File

@@ -0,0 +1,42 @@
#ifndef __RM_C_H
#define __RM_C_H
/*==========延时==========*/
#include "Delay.h" //延时
/*==========硬件驱动==========*/
#include "TIM.h" //定时器
#include "LED.h" //LED
#include "Buzzer.h" //蜂鸣器
#include "Remote.h" //遥控器
#include "BMI088.h" //陀螺仪
#include "IST8310.h" //磁力计
#include "Laser.h" //激光
#include "M3508.h" //M3508
#include "GM6020.h" //GM6020
#include "M2006.h" //M2006
/*==========通讯协议==========*/
#include "UART.h" //串口
#include "MyI2C.h" //软件I2C
#include "CAN.h" //CAN
/*==========控制算法==========*/
#include "PID.h" //PID
/*==========功能==========*/
#include "LinkCheck.h" //CAN连接检测
#include "CloseLoopControl.h" //闭环控制
#include "CToC.h" //板间通讯
#include "IMUTemperatureControl.h" //陀螺仪恒温控制
#include "AttitudeAlgorithms.h" //姿态解算
#include "Warming.h" //报警
/*==========车体=========*/
#include "Parameter.h" //参数
#include "Gimbal.h" //云台
#include "Visual.h" //视觉
#include "RefereeSystem.h" //裁判系统
#include "Keyboard.h" //键盘
#endif

View File

@@ -0,0 +1,34 @@
#include "stm32f4xx.h" // Device header
#include "stm32f4xx_conf.h"
#include <stdio.h>
#include "RM_C.h"
#include "AttitudeAlgorithms.h"
#include "Gimbal.h"
#include "visual.h"
int main(void)
{
Warming_Init();//报警初始化
LED_BON();//蓝灯点亮表示代码在运行
AttitudeAlgorithms_Init();//姿态解算初始化
Delay_s(1);//延时,等待校准和模块启动
LinkCheck_Init();//连接检测初始化
RefereeSystem_Init();//图传链路初始化
Visual_Init();//视觉初始化
CloseLoopControl_Init();//闭环控制初始化
Remote_Init();//遥控器初始化
UART2_SendInit();//串口2初始化
//UART2_Init();
while(1)
{
IWDG_ReloadCounter();//喂狗
CToC_MasterSendControl();//CToC发送遥控器控制数据
CToC_MasterSendData();//CToC发送遥控器摇杆数据
//Debug();
//UART2_Printf("%d\n",AttitudeAlgorithms_DegYaw);
//Visual_SendData();
Delay_us(1);//延时1usCToC周期1.5ms
}
}

View File

@@ -0,0 +1,164 @@
/**
******************************************************************************
* @file Project/STM32F4xx_StdPeriph_Templates/stm32f4xx_conf.h
* @author MCD Application Team
* @version V1.8.1
* @date 27-January-2022
* @brief Library configuration file.
******************************************************************************
* @attention
*
* Copyright (c) 2016 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F4xx_CONF_H
#define __STM32F4xx_CONF_H
/* Includes ------------------------------------------------------------------*/
/* Uncomment the line below to enable peripheral header file inclusion */
#include "stm32f4xx_adc.h"
#include "stm32f4xx_crc.h"
#include "stm32f4xx_dbgmcu.h"
#include "stm32f4xx_dma.h"
#include "stm32f4xx_exti.h"
#include "stm32f4xx_flash.h"
#include "stm32f4xx_gpio.h"
#include "stm32f4xx_i2c.h"
#include "stm32f4xx_iwdg.h"
#include "stm32f4xx_pwr.h"
#include "stm32f4xx_rcc.h"
#include "stm32f4xx_rtc.h"
#include "stm32f4xx_sdio.h"
#include "stm32f4xx_spi.h"
#include "stm32f4xx_syscfg.h"
#include "stm32f4xx_tim.h"
#include "stm32f4xx_usart.h"
#include "stm32f4xx_wwdg.h"
#include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */
#if defined(STM32F429_439xx) || defined(STM32F446xx) || defined(STM32F469_479xx)
#include "stm32f4xx_cryp.h"
#include "stm32f4xx_hash.h"
#include "stm32f4xx_rng.h"
#include "stm32f4xx_can.h"
#include "stm32f4xx_dac.h"
#include "stm32f4xx_dcmi.h"
#include "stm32f4xx_dma2d.h"
#include "stm32f4xx_fmc.h"
#include "stm32f4xx_ltdc.h"
#include "stm32f4xx_sai.h"
#endif /* STM32F429_439xx || STM32F446xx || STM32F469_479xx */
#if defined(STM32F427_437xx)
#include "stm32f4xx_cryp.h"
#include "stm32f4xx_hash.h"
#include "stm32f4xx_rng.h"
#include "stm32f4xx_can.h"
#include "stm32f4xx_dac.h"
#include "stm32f4xx_dcmi.h"
#include "stm32f4xx_dma2d.h"
#include "stm32f4xx_fmc.h"
#include "stm32f4xx_sai.h"
#endif /* STM32F427_437xx */
#if defined(STM32F40_41xxx)
#include "stm32f4xx_cryp.h"
#include "stm32f4xx_hash.h"
#include "stm32f4xx_rng.h"
#include "stm32f4xx_can.h"
#include "stm32f4xx_dac.h"
#include "stm32f4xx_dcmi.h"
#include "stm32f4xx_fsmc.h"
#endif /* STM32F40_41xxx */
#if defined(STM32F410xx)
#include "stm32f4xx_rng.h"
#include "stm32f4xx_dac.h"
#endif /* STM32F410xx */
#if defined(STM32F411xE)
#include "stm32f4xx_flash_ramfunc.h"
#endif /* STM32F411xE */
#if defined(STM32F446xx) || defined(STM32F469_479xx)
#include "stm32f4xx_qspi.h"
#endif /* STM32F446xx || STM32F469_479xx */
#if defined(STM32F410xx) || defined(STM32F446xx)
#include "stm32f4xx_fmpi2c.h"
#endif /* STM32F410xx || STM32F446xx */
#if defined(STM32F446xx)
#include "stm32f4xx_spdifrx.h"
#include "stm32f4xx_cec.h"
#endif /* STM32F446xx */
#if defined(STM32F469_479xx)
#include "stm32f4xx_dsi.h"
#endif /* STM32F469_479xx */
#if defined(STM32F410xx)
#include "stm32f4xx_lptim.h"
#endif /* STM32F410xx */
#if defined(STM32F412xG)
#include "stm32f4xx_rng.h"
#include "stm32f4xx_can.h"
#include "stm32f4xx_qspi.h"
#include "stm32f4xx_rng.h"
#include "stm32f4xx_fsmc.h"
#include "stm32f4xx_dfsdm.h"
#endif /* STM32F412xG */
#if defined(STM32F413_423xx)
#include "stm32f4xx_cryp.h"
#include "stm32f4xx_fmpi2c.h"
#include "stm32f4xx_rng.h"
#include "stm32f4xx_can.h"
#include "stm32f4xx_qspi.h"
#include "stm32f4xx_rng.h"
#include "stm32f4xx_fsmc.h"
#include "stm32f4xx_dfsdm.h"
#endif /* STM32F413_423xx */
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* If an external clock source is used, then the value of the following define
should be set to the value of the external clock source, else, if no external
clock is used, keep this define commented */
/*#define I2S_EXTERNAL_CLOCK_VAL 12288000 */ /* Value of the external clock in Hz */
/* Uncomment the line below to expanse the "assert_param" macro in the
Standard Peripheral Library drivers code */
/* #define USE_FULL_ASSERT 1 */
/* Exported macro ------------------------------------------------------------*/
#ifdef USE_FULL_ASSERT
/**
* @brief The assert_param macro is used for function's parameters check.
* @param expr: If expr is false, it calls assert_failed function
* which reports the name of the source file and the source
* line number of the call that failed.
* If expr is true, it returns no value.
* @retval None
*/
#define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
/* Exported functions ------------------------------------------------------- */
void assert_failed(uint8_t* file, uint32_t line);
#else
#define assert_param(expr) ((void)0)
#endif /* USE_FULL_ASSERT */
#endif /* __STM32F4xx_CONF_H */

View File

@@ -0,0 +1,158 @@
/**
******************************************************************************
* @file Project/STM32F4xx_StdPeriph_Templates/stm32f4xx_it.c
* @author MCD Application Team
* @version V1.8.1
* @date 27-January-2022
* @brief Main Interrupt Service Routines.
* This file provides template for all exceptions handler and
* peripherals interrupt service routine.
******************************************************************************
* @attention
*
* Copyright (c) 2016 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx_it.h"
/** @addtogroup Template_Project
* @{
*/
/* Private typedef -----------------------------------------------------------*/
/* Private define ------------------------------------------------------------*/
/* Private macro -------------------------------------------------------------*/
/* Private variables ---------------------------------------------------------*/
/* Private function prototypes -----------------------------------------------*/
/* Private functions ---------------------------------------------------------*/
/******************************************************************************/
/* Cortex-M4 Processor Exceptions Handlers */
/******************************************************************************/
/**
* @brief This function handles NMI exception.
* @param None
* @retval None
*/
void NMI_Handler(void)
{
}
/**
* @brief This function handles Hard Fault exception.
* @param None
* @retval None
*/
void HardFault_Handler(void)
{
/* Go to infinite loop when Hard Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Memory Manage exception.
* @param None
* @retval None
*/
void MemManage_Handler(void)
{
/* Go to infinite loop when Memory Manage exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Bus Fault exception.
* @param None
* @retval None
*/
void BusFault_Handler(void)
{
/* Go to infinite loop when Bus Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles Usage Fault exception.
* @param None
* @retval None
*/
void UsageFault_Handler(void)
{
/* Go to infinite loop when Usage Fault exception occurs */
while (1)
{
}
}
/**
* @brief This function handles SVCall exception.
* @param None
* @retval None
*/
void SVC_Handler(void)
{
}
/**
* @brief This function handles Debug Monitor exception.
* @param None
* @retval None
*/
void DebugMon_Handler(void)
{
}
/**
* @brief This function handles PendSVC exception.
* @param None
* @retval None
*/
void PendSV_Handler(void)
{
}
/**
* @brief This function handles SysTick Handler.
* @param None
* @retval None
*/
void SysTick_Handler(void)
{
}
/******************************************************************************/
/* STM32F4xx Peripherals Interrupt Handlers */
/* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
/* available peripheral interrupt handler's name please refer to the startup */
/* file (startup_stm32f4xx.s). */
/******************************************************************************/
/**
* @brief This function handles PPP interrupt request.
* @param None
* @retval None
*/
/*void PPP_IRQHandler(void)
{
}*/
/**
* @}
*/

View File

@@ -0,0 +1,52 @@
/**
******************************************************************************
* @file Project/STM32F4xx_StdPeriph_Templates/stm32f4xx_it.h
* @author MCD Application Team
* @version V1.8.1
* @date 27-January-2022
* @brief This file contains the headers of the interrupt handlers.
******************************************************************************
* @attention
*
* Copyright (c) 2016 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __STM32F4xx_IT_H
#define __STM32F4xx_IT_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32f4xx.h"
/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
/* Exported functions ------------------------------------------------------- */
void NMI_Handler(void);
void HardFault_Handler(void);
void MemManage_Handler(void);
void BusFault_Handler(void);
void UsageFault_Handler(void);
void SVC_Handler(void);
void DebugMon_Handler(void);
void PendSV_Handler(void);
void SysTick_Handler(void);
#ifdef __cplusplus
}
#endif
#endif /* __STM32F4xx_IT_H */