自瞄加完,发射拨弹不行
This commit is contained in:
parent
23db044e59
commit
6019116451
@ -60,15 +60,14 @@ void DMA1_Stream1_IRQHandler(void);
|
||||
void CAN1_TX_IRQHandler(void);
|
||||
void CAN1_RX0_IRQHandler(void);
|
||||
void CAN1_RX1_IRQHandler(void);
|
||||
void CAN1_SCE_IRQHandler(void);
|
||||
void EXTI9_5_IRQHandler(void);
|
||||
void USART1_IRQHandler(void);
|
||||
void USART2_IRQHandler(void);
|
||||
void DMA2_Stream2_IRQHandler(void);
|
||||
void DMA2_Stream3_IRQHandler(void);
|
||||
void CAN2_TX_IRQHandler(void);
|
||||
void CAN2_RX0_IRQHandler(void);
|
||||
void CAN2_RX1_IRQHandler(void);
|
||||
void CAN2_SCE_IRQHandler(void);
|
||||
void USART6_IRQHandler(void);
|
||||
/* USER CODE BEGIN EFP */
|
||||
|
||||
|
||||
@ -128,8 +128,6 @@ void HAL_CAN_MspInit(CAN_HandleTypeDef* canHandle)
|
||||
HAL_NVIC_EnableIRQ(CAN1_RX0_IRQn);
|
||||
HAL_NVIC_SetPriority(CAN1_RX1_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(CAN1_RX1_IRQn);
|
||||
HAL_NVIC_SetPriority(CAN1_SCE_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(CAN1_SCE_IRQn);
|
||||
/* USER CODE BEGIN CAN1_MspInit 1 */
|
||||
|
||||
/* USER CODE END CAN1_MspInit 1 */
|
||||
@ -148,10 +146,10 @@ void HAL_CAN_MspInit(CAN_HandleTypeDef* canHandle)
|
||||
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
/**CAN2 GPIO Configuration
|
||||
PB5 ------> CAN2_RX
|
||||
PB6 ------> CAN2_TX
|
||||
PB12 ------> CAN2_RX
|
||||
*/
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_6|GPIO_PIN_12;
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_6;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
@ -161,10 +159,10 @@ void HAL_CAN_MspInit(CAN_HandleTypeDef* canHandle)
|
||||
/* CAN2 interrupt Init */
|
||||
HAL_NVIC_SetPriority(CAN2_TX_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(CAN2_TX_IRQn);
|
||||
HAL_NVIC_SetPriority(CAN2_RX0_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(CAN2_RX0_IRQn);
|
||||
HAL_NVIC_SetPriority(CAN2_RX1_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(CAN2_RX1_IRQn);
|
||||
HAL_NVIC_SetPriority(CAN2_SCE_IRQn, 5, 0);
|
||||
HAL_NVIC_EnableIRQ(CAN2_SCE_IRQn);
|
||||
/* USER CODE BEGIN CAN2_MspInit 1 */
|
||||
|
||||
/* USER CODE END CAN2_MspInit 1 */
|
||||
@ -195,7 +193,6 @@ void HAL_CAN_MspDeInit(CAN_HandleTypeDef* canHandle)
|
||||
HAL_NVIC_DisableIRQ(CAN1_TX_IRQn);
|
||||
HAL_NVIC_DisableIRQ(CAN1_RX0_IRQn);
|
||||
HAL_NVIC_DisableIRQ(CAN1_RX1_IRQn);
|
||||
HAL_NVIC_DisableIRQ(CAN1_SCE_IRQn);
|
||||
/* USER CODE BEGIN CAN1_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END CAN1_MspDeInit 1 */
|
||||
@ -213,15 +210,15 @@ void HAL_CAN_MspDeInit(CAN_HandleTypeDef* canHandle)
|
||||
}
|
||||
|
||||
/**CAN2 GPIO Configuration
|
||||
PB5 ------> CAN2_RX
|
||||
PB6 ------> CAN2_TX
|
||||
PB12 ------> CAN2_RX
|
||||
*/
|
||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_6|GPIO_PIN_12);
|
||||
HAL_GPIO_DeInit(GPIOB, GPIO_PIN_5|GPIO_PIN_6);
|
||||
|
||||
/* CAN2 interrupt Deinit */
|
||||
HAL_NVIC_DisableIRQ(CAN2_TX_IRQn);
|
||||
HAL_NVIC_DisableIRQ(CAN2_RX0_IRQn);
|
||||
HAL_NVIC_DisableIRQ(CAN2_RX1_IRQn);
|
||||
HAL_NVIC_DisableIRQ(CAN2_SCE_IRQn);
|
||||
/* USER CODE BEGIN CAN2_MspDeInit 1 */
|
||||
|
||||
/* USER CODE END CAN2_MspDeInit 1 */
|
||||
|
||||
@ -288,20 +288,6 @@ void CAN1_RX1_IRQHandler(void)
|
||||
/* USER CODE END CAN1_RX1_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles CAN1 SCE interrupt.
|
||||
*/
|
||||
void CAN1_SCE_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN CAN1_SCE_IRQn 0 */
|
||||
|
||||
/* USER CODE END CAN1_SCE_IRQn 0 */
|
||||
HAL_CAN_IRQHandler(&hcan1);
|
||||
/* USER CODE BEGIN CAN1_SCE_IRQn 1 */
|
||||
|
||||
/* USER CODE END CAN1_SCE_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles EXTI line[9:5] interrupts.
|
||||
*/
|
||||
@ -387,6 +373,20 @@ void CAN2_TX_IRQHandler(void)
|
||||
/* USER CODE END CAN2_TX_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles CAN2 RX0 interrupts.
|
||||
*/
|
||||
void CAN2_RX0_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN CAN2_RX0_IRQn 0 */
|
||||
|
||||
/* USER CODE END CAN2_RX0_IRQn 0 */
|
||||
HAL_CAN_IRQHandler(&hcan2);
|
||||
/* USER CODE BEGIN CAN2_RX0_IRQn 1 */
|
||||
|
||||
/* USER CODE END CAN2_RX0_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles CAN2 RX1 interrupt.
|
||||
*/
|
||||
@ -401,20 +401,6 @@ void CAN2_RX1_IRQHandler(void)
|
||||
/* USER CODE END CAN2_RX1_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles CAN2 SCE interrupt.
|
||||
*/
|
||||
void CAN2_SCE_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN CAN2_SCE_IRQn 0 */
|
||||
|
||||
/* USER CODE END CAN2_SCE_IRQn 0 */
|
||||
HAL_CAN_IRQHandler(&hcan2);
|
||||
/* USER CODE BEGIN CAN2_SCE_IRQn 1 */
|
||||
|
||||
/* USER CODE END CAN2_SCE_IRQn 1 */
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief This function handles USART6 global interrupt.
|
||||
*/
|
||||
|
||||
61
Infantry.ioc
61
Infantry.ioc
@ -79,37 +79,37 @@ Mcu.IPNb=14
|
||||
Mcu.Name=STM32F407I(E-G)Hx
|
||||
Mcu.Package=UFBGA176
|
||||
Mcu.Pin0=PB8
|
||||
Mcu.Pin1=PG14
|
||||
Mcu.Pin10=PC11
|
||||
Mcu.Pin11=PC10
|
||||
Mcu.Pin12=PG9
|
||||
Mcu.Pin13=PD5
|
||||
Mcu.Pin14=PD1
|
||||
Mcu.Pin15=PF0
|
||||
Mcu.Pin16=PA9
|
||||
Mcu.Pin17=PH0-OSC_IN
|
||||
Mcu.Pin18=PH1-OSC_OUT
|
||||
Mcu.Pin19=PF1
|
||||
Mcu.Pin2=PB4
|
||||
Mcu.Pin20=PG6
|
||||
Mcu.Pin21=PG3
|
||||
Mcu.Pin22=PA0-WKUP
|
||||
Mcu.Pin23=PA4
|
||||
Mcu.Pin24=PC4
|
||||
Mcu.Pin25=PC5
|
||||
Mcu.Pin26=PB12
|
||||
Mcu.Pin1=PB5
|
||||
Mcu.Pin10=PD0
|
||||
Mcu.Pin11=PC11
|
||||
Mcu.Pin12=PC10
|
||||
Mcu.Pin13=PG9
|
||||
Mcu.Pin14=PD5
|
||||
Mcu.Pin15=PD1
|
||||
Mcu.Pin16=PF0
|
||||
Mcu.Pin17=PA9
|
||||
Mcu.Pin18=PH0-OSC_IN
|
||||
Mcu.Pin19=PH1-OSC_OUT
|
||||
Mcu.Pin2=PG14
|
||||
Mcu.Pin20=PF1
|
||||
Mcu.Pin21=PG6
|
||||
Mcu.Pin22=PG3
|
||||
Mcu.Pin23=PA0-WKUP
|
||||
Mcu.Pin24=PA4
|
||||
Mcu.Pin25=PC4
|
||||
Mcu.Pin26=PC5
|
||||
Mcu.Pin27=PA7
|
||||
Mcu.Pin28=PB0
|
||||
Mcu.Pin29=VP_FREERTOS_VS_CMSIS_V2
|
||||
Mcu.Pin3=PB3
|
||||
Mcu.Pin3=PB4
|
||||
Mcu.Pin30=VP_SYS_VS_Systick
|
||||
Mcu.Pin31=VP_TIM10_VS_ClockSourceINT
|
||||
Mcu.Pin4=PA14
|
||||
Mcu.Pin5=PA13
|
||||
Mcu.Pin6=PB7
|
||||
Mcu.Pin7=PB6
|
||||
Mcu.Pin8=PD6
|
||||
Mcu.Pin9=PD0
|
||||
Mcu.Pin4=PB3
|
||||
Mcu.Pin5=PA14
|
||||
Mcu.Pin6=PA13
|
||||
Mcu.Pin7=PB7
|
||||
Mcu.Pin8=PB6
|
||||
Mcu.Pin9=PD6
|
||||
Mcu.PinsNb=32
|
||||
Mcu.ThirdPartyNb=0
|
||||
Mcu.UserConstants=
|
||||
@ -119,10 +119,9 @@ MxDb.Version=DB.6.0.161
|
||||
NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true\:false\:false\:false\:false
|
||||
NVIC.CAN1_RX0_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||
NVIC.CAN1_RX1_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||
NVIC.CAN1_SCE_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||
NVIC.CAN1_TX_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||
NVIC.CAN2_RX0_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||
NVIC.CAN2_RX1_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||
NVIC.CAN2_SCE_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||
NVIC.CAN2_TX_IRQn=true\:5\:0\:false\:false\:true\:true\:true\:true\:true
|
||||
NVIC.DMA1_Stream1_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||
NVIC.DMA2_Stream2_IRQn=true\:5\:0\:false\:false\:true\:true\:false\:true\:true
|
||||
@ -176,13 +175,13 @@ PB0.GPIO_Speed=GPIO_SPEED_FREQ_MEDIUM
|
||||
PB0.Locked=true
|
||||
PB0.PinState=GPIO_PIN_SET
|
||||
PB0.Signal=GPIO_Output
|
||||
PB12.Locked=true
|
||||
PB12.Mode=CAN_Activate
|
||||
PB12.Signal=CAN2_RX
|
||||
PB3.Mode=Full_Duplex_Master
|
||||
PB3.Signal=SPI1_SCK
|
||||
PB4.Mode=Full_Duplex_Master
|
||||
PB4.Signal=SPI1_MISO
|
||||
PB5.Locked=true
|
||||
PB5.Mode=CAN_Activate
|
||||
PB5.Signal=CAN2_RX
|
||||
PB6.Mode=CAN_Activate
|
||||
PB6.Signal=CAN2_TX
|
||||
PB7.Mode=Asynchronous
|
||||
|
||||
6
MDK-ARM/.vscode/keil-assistant.log
vendored
6
MDK-ARM/.vscode/keil-assistant.log
vendored
@ -5,3 +5,9 @@
|
||||
[info] project closed: Infantry
|
||||
[info] Log at : 2026/1/8|22:21:24|GMT+0800
|
||||
|
||||
[info] Log at : 2026/1/9|10:16:50|GMT+0800
|
||||
|
||||
[info] Log at : 2026/1/9|10:16:54|GMT+0800
|
||||
|
||||
[info] Log at : 2026/1/9|10:26:28|GMT+0800
|
||||
|
||||
|
||||
2
MDK-ARM/.vscode/uv4.log
vendored
2
MDK-ARM/.vscode/uv4.log
vendored
@ -1,4 +1,4 @@
|
||||
*** Using Compiler 'V6.16', folder: 'D:\Keil_v5\ARM\ARMCLANG\Bin'
|
||||
Build target 'Infantry'
|
||||
Note: source file '..\User\bsp\can.c' - object file renamed from 'Infantry\can.o' to 'Infantry\can_1.o'.Note: source file '..\User\bsp\gpio.c' - object file renamed from 'Infantry\gpio.o' to 'Infantry\gpio_1.o'.Note: source file '..\User\bsp\i2c.c' - object file renamed from 'Infantry\i2c.o' to 'Infantry\i2c_1.o'.Note: source file '..\User\bsp\spi.c' - object file renamed from 'Infantry\spi.o' to 'Infantry\spi_1.o'.Note: source file '..\User\task\ai.c' - object file renamed from 'Infantry\ai.o' to 'Infantry\ai_1.o'.Note: source file '..\User\task\dr16.c' - object file renamed from 'Infantry\dr16.o' to 'Infantry\dr16_1.o'."Infantry\Infantry.axf" - 0 Error(s), 0 Warning(s).
|
||||
Note: source file '..\User\bsp\can.c' - object file renamed from 'Infantry\can.o' to 'Infantry\can_1.o'.Note: source file '..\User\bsp\gpio.c' - object file renamed from 'Infantry\gpio.o' to 'Infantry\gpio_1.o'.Note: source file '..\User\bsp\i2c.c' - object file renamed from 'Infantry\i2c.o' to 'Infantry\i2c_1.o'.Note: source file '..\User\bsp\spi.c' - object file renamed from 'Infantry\spi.o' to 'Infantry\spi_1.o'.Note: source file '..\User\task\dr16.c' - object file renamed from 'Infantry\dr16.o' to 'Infantry\dr16_1.o'.Note: source file '..\User\task\ai.c' - object file renamed from 'Infantry\ai.o' to 'Infantry\ai_1.o'."Infantry\Infantry.axf" - 0 Error(s), 0 Warning(s).
|
||||
Build Time Elapsed: 00:00:02
|
||||
|
||||
2
MDK-ARM/.vscode/uv4.log.lock
vendored
2
MDK-ARM/.vscode/uv4.log.lock
vendored
@ -1 +1 @@
|
||||
2026/1/8 22:21:37
|
||||
2026/1/9 10:31:55
|
||||
File diff suppressed because one or more lines are too long
@ -135,7 +135,7 @@
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
<Key>CMSIS_AGDI</Key>
|
||||
<Name>-X"" -O206 -S8 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F407IGHx$CMSIS\Flash\STM32F4xx_1024.FLM)</Name>
|
||||
<Name>-X"Any" -UAny -O206 -S8 -C0 -P00000000 -N00("ARM CoreSight SW-DP") -D00(2BA01477) -L00(0) -TO65554 -TC10000000 -TT10000000 -TP20 -TDS8007 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO7 -FD20000000 -FC1000 -FN1 -FF0STM32F4xx_1024.FLM -FS08000000 -FL0100000 -FP0($$Device:STM32F407IGHx$CMSIS\Flash\STM32F4xx_1024.FLM)</Name>
|
||||
</SetRegEntry>
|
||||
<SetRegEntry>
|
||||
<Number>0</Number>
|
||||
@ -195,6 +195,21 @@
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>shoot_cmd</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>8</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>bmi088</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>9</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>shoot_cmd</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>10</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>shoot</ItemText>
|
||||
</Ww>
|
||||
</WatchWindow1>
|
||||
<Tracepoint>
|
||||
<THDelay>0</THDelay>
|
||||
|
||||
Binary file not shown.
@ -33,17 +33,11 @@ Note: source file '..\User\bsp\i2c.c' - object file renamed from 'Infantry\i2c.o
|
||||
Note: source file '..\User\bsp\spi.c' - object file renamed from 'Infantry\spi.o' to 'Infantry\spi_1.o'.
|
||||
Note: source file '..\User\task\dr16.c' - object file renamed from 'Infantry\dr16.o' to 'Infantry\dr16_1.o'.
|
||||
Note: source file '..\User\task\ai.c' - object file renamed from 'Infantry\ai.o' to 'Infantry\ai_1.o'.
|
||||
../User/task/chassis_ctrl.c(7): warning: In file included from...
|
||||
../User\task/user_task.h(73): warning: expected ';' at end of declaration list
|
||||
osMessageQueueId_t dr16/* 发射命令队列 */
|
||||
^
|
||||
;
|
||||
1 warning generated.
|
||||
compiling chassis_ctrl.c...
|
||||
compiling config.c...
|
||||
linking...
|
||||
Program Size: Code=54952 RO-data=1680 RW-data=832 ZI-data=126624
|
||||
Program Size: Code=54672 RO-data=1680 RW-data=832 ZI-data=126624
|
||||
FromELF: creating hex file...
|
||||
"Infantry\Infantry.axf" - 0 Error(s), 1 Warning(s).
|
||||
"Infantry\Infantry.axf" - 0 Error(s), 0 Warning(s).
|
||||
|
||||
<h2>Software Packages used:</h2>
|
||||
|
||||
@ -67,7 +61,7 @@ Package Vendor: Keil
|
||||
|
||||
* Component: ARM::CMSIS:CORE:5.4.0
|
||||
Include file: CMSIS\Core\Include\tz_context.h
|
||||
Build Time Elapsed: 00:00:02
|
||||
Build Time Elapsed: 00:00:03
|
||||
</pre>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -74,9 +74,9 @@
|
||||
BSP_GPIO_WritePin(BSP_GPIO_ACCL_CS, GPIO_PIN_RESET)
|
||||
|
||||
#define BMI088_GYRO_NSS_SET() \
|
||||
BSP_GPIO_WritePin(BSP_GPIO_ACCL_CS, GPIO_PIN_SET)
|
||||
BSP_GPIO_WritePin(BSP_GPIO_GYRO_CS, GPIO_PIN_SET)
|
||||
#define BMI088_GYRO_NSS_RESET() \
|
||||
BSP_GPIO_WritePin(BSP_GPIO_ACCL_CS, GPIO_PIN_RESET)
|
||||
BSP_GPIO_WritePin(BSP_GPIO_GYRO_CS, GPIO_PIN_RESET)
|
||||
|
||||
/* Private typedef ---------------------------------------------------------- */
|
||||
typedef enum {
|
||||
@ -176,7 +176,7 @@ static void BMI088_RxCpltCallback(void) {
|
||||
BMI088_ACCL_NSS_SET();
|
||||
osThreadFlagsSet(thread_alert, SIGNAL_BMI088_ACCL_RAW_REDY);
|
||||
}
|
||||
if (BSP_GPIO_ReadPin(BSP_GPIO_ACCL_CS) == GPIO_PIN_RESET) {
|
||||
if (BSP_GPIO_ReadPin(BSP_GPIO_GYRO_CS) == GPIO_PIN_RESET) {
|
||||
BMI088_GYRO_NSS_SET();
|
||||
osThreadFlagsSet(thread_alert, SIGNAL_BMI088_GYRO_RAW_REDY);
|
||||
}
|
||||
@ -212,13 +212,13 @@ int8_t BMI088_Init(BMI088_t *bmi088, const BMI088_Cali_t *cali) {
|
||||
if (BMI_ReadSingle(BMI_GYRO, BMI088_REG_GYRO_CHIP_ID) != BMI088_CHIP_ID_GYRO)
|
||||
return DEVICE_ERR_NO_DEV;
|
||||
|
||||
BSP_GPIO_DisableIRQ(BSP_GPIO_USER_KEY);
|
||||
BSP_GPIO_DisableIRQ(BSP_GPIO_USER_KEY);
|
||||
BSP_GPIO_DisableIRQ(BSP_GPIO_ACCL_INT);
|
||||
BSP_GPIO_DisableIRQ(BSP_GPIO_GYRO_INT);
|
||||
|
||||
BSP_SPI_RegisterCallback(BSP_SPI_BMI088, BSP_SPI_RX_CPLT_CB,
|
||||
BMI088_RxCpltCallback);
|
||||
BSP_GPIO_RegisterCallback(BSP_GPIO_USER_KEY, BMI088_AcclIntCallback);
|
||||
BSP_GPIO_RegisterCallback(BSP_GPIO_USER_KEY, BMI088_GyroIntCallback);
|
||||
BSP_GPIO_RegisterCallback(BSP_GPIO_ACCL_INT, BMI088_AcclIntCallback);
|
||||
BSP_GPIO_RegisterCallback(BSP_GPIO_GYRO_INT, BMI088_GyroIntCallback);
|
||||
|
||||
/* Accl init. */
|
||||
/* Filter setting: Normal. */
|
||||
@ -259,8 +259,8 @@ int8_t BMI088_Init(BMI088_t *bmi088, const BMI088_Cali_t *cali) {
|
||||
|
||||
inited = true;
|
||||
|
||||
BSP_GPIO_EnableIRQ(BSP_GPIO_USER_KEY);
|
||||
BSP_GPIO_EnableIRQ(BSP_GPIO_USER_KEY);
|
||||
BSP_GPIO_EnableIRQ(BSP_GPIO_ACCL_INT);
|
||||
BSP_GPIO_EnableIRQ(BSP_GPIO_GYRO_INT);
|
||||
return DEVICE_OK;
|
||||
}
|
||||
|
||||
|
||||
@ -1,9 +1,9 @@
|
||||
bmi088:
|
||||
bsp_config:
|
||||
BSP_GPIO_ACCL_CS: BSP_GPIO_ACCL_CS
|
||||
BSP_GPIO_ACCL_INT: BSP_GPIO_USER_KEY
|
||||
BSP_GPIO_GYRO_CS: BSP_GPIO_ACCL_CS
|
||||
BSP_GPIO_GYRO_INT: BSP_GPIO_USER_KEY
|
||||
BSP_GPIO_ACCL_INT: BSP_GPIO_ACCL_INT
|
||||
BSP_GPIO_GYRO_CS: BSP_GPIO_GYRO_CS
|
||||
BSP_GPIO_GYRO_INT: BSP_GPIO_GYRO_INT
|
||||
BSP_SPI_BMI088: BSP_SPI_BMI088
|
||||
enabled: true
|
||||
dr16:
|
||||
|
||||
@ -23,7 +23,7 @@ Config_RobotParam_t robot_config = {
|
||||
/* 云台欧拉角与角速度自由选择 */
|
||||
.Direction={
|
||||
.Eulr={
|
||||
.pit=Rol,
|
||||
.pit=Pit,
|
||||
.yaw=Yaw,
|
||||
},
|
||||
.Gyro={
|
||||
@ -35,8 +35,8 @@ Config_RobotParam_t robot_config = {
|
||||
},
|
||||
/*欧拉角限位和电机角度限位*/
|
||||
.Limit_t= {
|
||||
.pit_max= 0.21,
|
||||
.pit_min=-0.53,
|
||||
.pit_max= 0.462614686,
|
||||
.pit_min=-0.518002629,
|
||||
/*零点参数*/
|
||||
.zero={
|
||||
.yaw_encoder=1.26,
|
||||
@ -66,32 +66,12 @@ Config_RobotParam_t robot_config = {
|
||||
/*是否开启限位*/
|
||||
.limit_yaw=false,
|
||||
.limit_pit=true,
|
||||
.pit_rm_motor={BSP_CAN_2,0x20A,MOTOR_GM6020,false,true},
|
||||
.yaw_rm_motor={BSP_CAN_2,0x209,MOTOR_GM6020,false,true},
|
||||
.pit_rm_motor={BSP_CAN_2,0x20A,MOTOR_GM6020,true,false},
|
||||
.yaw_rm_motor={BSP_CAN_2,0x209,MOTOR_GM6020,false,false},
|
||||
/*达妙电机参数自己配*/
|
||||
.major_yaw_dm_motor={
|
||||
.can=BSP_CAN_2,
|
||||
.can_id = 0x1,
|
||||
.master_id=0x11,
|
||||
.module = MOTOR_DM_J4310,
|
||||
.reverse=false
|
||||
},
|
||||
.pit_dm_motor={
|
||||
.can=BSP_CAN_2,
|
||||
.can_id = 0x2,
|
||||
.master_id=0x12,
|
||||
.module = MOTOR_DM_J4310,
|
||||
.reverse=true,
|
||||
},
|
||||
// .yaw_dm_motor={},
|
||||
|
||||
},
|
||||
.dm_Params_t={
|
||||
// .yaw_dm={.kd=0.1,},
|
||||
// .yaw_dm_Reduction_ratio=1.0f,//减速比
|
||||
.pit_dm={.kd=0.2,},
|
||||
.pit_dm_Reduction_ratio=1.0f,
|
||||
.major_yaw_dm={.kd=0.2,},
|
||||
.major_yaw_dm_Reduction_ratio=1.0f,//减速比
|
||||
},
|
||||
|
||||
.low_pass_cutoff_freq = {
|
||||
@ -99,73 +79,48 @@ Config_RobotParam_t robot_config = {
|
||||
.gyro = 1000.0f,
|
||||
},
|
||||
|
||||
.pid = {
|
||||
/* 大yaw参数 */
|
||||
.major_yaw_omega={
|
||||
.k = 0.0f,
|
||||
.p = 0.08f,
|
||||
.i = 0.1f,
|
||||
.d = 0.0f,
|
||||
.i_limit = 0.0f,
|
||||
.out_limit = 12.0f,
|
||||
.d_cutoff_freq = -1.0f,
|
||||
.range = -1.0f
|
||||
},
|
||||
.major_yaw_angle={
|
||||
.k = 1.0f,
|
||||
.p = 75.0f,//36.5
|
||||
.i = 20.0f,
|
||||
.d = 0.2f,
|
||||
.i_limit =5.0f,
|
||||
.out_limit = 12.0f,
|
||||
.d_cutoff_freq = 20.0f,
|
||||
.range = M_2PI
|
||||
},
|
||||
|
||||
.pid = {
|
||||
/*欧拉角控制参数*/
|
||||
|
||||
.yaw_omega = {
|
||||
.k = 0.24f,
|
||||
.p = 1.0f,
|
||||
.i = 0.5f,
|
||||
.d = 0.0f,
|
||||
.i_limit = 1.0f,
|
||||
.out_limit = 1.0f,
|
||||
.d_cutoff_freq = -1.0f,
|
||||
.range = -1.0f,
|
||||
.k = 0.45f,
|
||||
.p = 1.0f,
|
||||
.i = 6.0f,
|
||||
.d = 0.0008f,//0
|
||||
.i_limit = 1.0f,
|
||||
.out_limit = 1.0f,
|
||||
.d_cutoff_freq = -1.0f,
|
||||
.range = -1.0f,
|
||||
},
|
||||
.yaw_angle = {
|
||||
.k = 10.0f,
|
||||
.p = 1.0f,
|
||||
.i = 0.0f,
|
||||
.d = 0.05f,
|
||||
.i_limit = 0.0f,
|
||||
.out_limit = 10.0f,
|
||||
.d_cutoff_freq = -1.0f,
|
||||
.range = M_2PI,
|
||||
.k = 10.0f,
|
||||
.p = 2.0f ,
|
||||
.i = 0.0f,
|
||||
.d = 0.0f,
|
||||
.i_limit = 0.0f,
|
||||
.out_limit = 10.0f,
|
||||
.d_cutoff_freq = -1.0f,
|
||||
.range = M_2PI,
|
||||
},
|
||||
.pit_omega = {
|
||||
.k = 0.25f,
|
||||
.p = 1.0f,
|
||||
.i = 0.0f,
|
||||
.d = 0.0f,
|
||||
.i_limit = 1.0f,
|
||||
.out_limit = 1.0f,
|
||||
.d_cutoff_freq = -1.0f,
|
||||
.range = -1.0f,
|
||||
.k = 0.25f,
|
||||
.p = 1.0f,
|
||||
.i = 0.0f,
|
||||
.d = 0.001901f,
|
||||
.i_limit = 1.0f,
|
||||
.out_limit = 1.0f,
|
||||
.d_cutoff_freq = -1.0f,
|
||||
.range = -1.0f,
|
||||
},
|
||||
.pit_angle = {
|
||||
.k = 2.0f,
|
||||
.p = 5.0f,
|
||||
.i = 2.5f,
|
||||
.d = 0.0f,
|
||||
.i_limit = 0.0f,
|
||||
.out_limit = 10.0f,
|
||||
.d_cutoff_freq = -1.0f,
|
||||
.range = M_2PI,
|
||||
.k = 2.0f,
|
||||
.p = 5.0f,
|
||||
.i = 2.5f,
|
||||
.d = 0.0f,
|
||||
.i_limit = 0.0f,
|
||||
.out_limit = 10.0f,
|
||||
.d_cutoff_freq = -1.0f,
|
||||
.range = M_2PI,
|
||||
},
|
||||
|
||||
|
||||
}
|
||||
},
|
||||
|
||||
@ -189,7 +144,7 @@ Config_RobotParam_t robot_config = {
|
||||
{
|
||||
.param = {
|
||||
.can = BSP_CAN_2,
|
||||
.id = 0x201,
|
||||
.id = 0x205,
|
||||
.module = MOTOR_M2006,
|
||||
.reverse = false,
|
||||
.gear = false,
|
||||
@ -199,7 +154,7 @@ Config_RobotParam_t robot_config = {
|
||||
{
|
||||
.param = {
|
||||
.can = BSP_CAN_2,
|
||||
.id = 0x202,
|
||||
.id = 0x206,
|
||||
.module = MOTOR_M2006,
|
||||
.reverse = true,
|
||||
.gear = false,
|
||||
@ -210,7 +165,7 @@ Config_RobotParam_t robot_config = {
|
||||
},
|
||||
.trig = {
|
||||
.can = BSP_CAN_2,
|
||||
.id = 0x203,
|
||||
.id = 0x207,
|
||||
.module = MOTOR_M2006,
|
||||
.reverse = false,
|
||||
.gear=true,
|
||||
@ -218,13 +173,14 @@ Config_RobotParam_t robot_config = {
|
||||
},
|
||||
.pid={
|
||||
.fric_follow = {
|
||||
.k = 0.001f,
|
||||
.p = 1.0f,
|
||||
.i = 0.2f,
|
||||
.d = 0.01f,
|
||||
.i_limit = 0.5f,
|
||||
.out_limit = 0.5f,
|
||||
.d_cutoff_freq = -1.0f,
|
||||
.k=1.0f,
|
||||
.p=1.5f,
|
||||
.i=0.3f,
|
||||
.d=0.0f,
|
||||
.i_limit=0.2f,
|
||||
.out_limit=0.9f,
|
||||
.d_cutoff_freq=-1.0f,
|
||||
.range=-1.0f,
|
||||
},
|
||||
.fric_err = {
|
||||
.k=0.0f,
|
||||
@ -237,18 +193,18 @@ Config_RobotParam_t robot_config = {
|
||||
.range=-1.0f,
|
||||
},
|
||||
.trig_2006 = {
|
||||
.k = 12.0f,
|
||||
.p = 1.0f,
|
||||
.i = 0.0f,
|
||||
.d = 0.0450000018f,
|
||||
.i_limit = 1.0f,
|
||||
.out_limit = 1.0f,
|
||||
.d_cutoff_freq = -1.0f,
|
||||
.range = M_2PI,
|
||||
.k = 12.0f,
|
||||
.p = 1.0f,
|
||||
.i = 0.0f,
|
||||
.d = 0.0450000018f,
|
||||
.i_limit = 1.0f,
|
||||
.out_limit = 1.0f,
|
||||
.d_cutoff_freq = -1.0f,
|
||||
.range = M_2PI,
|
||||
},
|
||||
.trig_omg_2006 = {
|
||||
.k=2.0f,
|
||||
.p=1.5f,
|
||||
.k=0.f,
|
||||
.p=1.0f,
|
||||
.i=0.3f,
|
||||
.d=0.5f,
|
||||
.i_limit=0.2f,
|
||||
@ -256,26 +212,7 @@ Config_RobotParam_t robot_config = {
|
||||
.d_cutoff_freq=-1.0f,
|
||||
.range=-1.0f,
|
||||
},
|
||||
// .trig_3508 = {
|
||||
// .k=0.5f,
|
||||
// .p=1.8f,
|
||||
// .i=0.3f,
|
||||
// .d=0.1f,
|
||||
// .i_limit=0.15f,
|
||||
// .out_limit=1.0f,
|
||||
// .d_cutoff_freq=-1.0f,
|
||||
// .range=M_2PI,
|
||||
// },
|
||||
// .trig_omg_3508 = {
|
||||
// .k=1.0f,
|
||||
// .p=1.0f,
|
||||
// .i=0.0f,
|
||||
// .d=0.0f,
|
||||
// .i_limit=0.0f,
|
||||
// .out_limit=1.0f,
|
||||
// .d_cutoff_freq=-1.0f,
|
||||
// .range=-1.0f,
|
||||
// },
|
||||
|
||||
},
|
||||
.filter={
|
||||
.fric = {
|
||||
|
||||
@ -428,7 +428,7 @@ int8_t Gimbal_Control(Gimbal_t *g, Gimbal_CMD_t *g_cmd) {
|
||||
pit_omega_set_point = PID_Calc(&(g->pid.pit_angle), g->setpoint.eulr.pit,
|
||||
g->direction.Eulr.pit, 0.0f, g->dt);
|
||||
g->out.pit = PID_Calc(&(g->pid.pit_omega), pit_omega_set_point,
|
||||
g->feedback.imu.gyro.y, 0.f, g->dt);
|
||||
g->direction.Gyro.pit, 0.f, g->dt);
|
||||
|
||||
/*前馈添加*/
|
||||
if(g->param->feedforward.imu.yaw==true)
|
||||
|
||||
@ -12,8 +12,8 @@ int8_t Gimbal_Cmd( Gimbal_CMD_t *g_cmd, DR16_t *dr16)
|
||||
case DR16_SW_MID:
|
||||
g_cmd->ctrl_mode= GIMBAL_MODE_REMOTE; /* 遥控器模式 */
|
||||
g_cmd->mode= GIMBAL_MODE_ABSOLUTE;
|
||||
g_cmd->delta_yaw=0.8*(dr16->raw_data.ch_r_x-1024)/660; /* 云台Yaw速度设定 */
|
||||
g_cmd->delta_pit=0.6*(dr16->raw_data.ch_r_y-16)/640; /* 云台Pitch速度设定 */
|
||||
g_cmd->delta_yaw=1.5*dr16->data.ch_r_x; /* 云台Yaw速度设定 */
|
||||
g_cmd->delta_pit=0.4*dr16->data.ch_r_y; /* 云台Pitch速度设定 */
|
||||
break;
|
||||
case DR16_SW_UP:
|
||||
g_cmd->ctrl_mode= GIMBAL_MODE_AI; /* 遥控器模式 */
|
||||
|
||||
@ -376,12 +376,12 @@ int8_t Shoot_RunningFSM(Shoot_t *s, Shoot_CMD_t *cmd)
|
||||
s->var_trig.trig_agl,
|
||||
0,
|
||||
s->timer.dt);
|
||||
s->output.outomg_trig =PID_Calc(&s->pid.trig_omg,
|
||||
s->output.outagl_trig,
|
||||
s->var_trig.trig_rpm,
|
||||
0,
|
||||
s->timer.dt);
|
||||
s->output.outlpf_trig =LowPassFilter2p_Apply(&s->filter.trig.out, s->output.outomg_trig);
|
||||
// s->output.outomg_trig =PID_Calc(&s->pid.trig_omg,
|
||||
// s->output.outagl_trig,
|
||||
// s->var_trig.trig_rpm,
|
||||
// 0,
|
||||
// s->timer.dt);
|
||||
s->output.outlpf_trig =LowPassFilter2p_Apply(&s->filter.trig.out,s->output.outagl_trig);
|
||||
MOTOR_RM_SetOutput(&s->param->motor.trig, s->output.outlpf_trig);
|
||||
|
||||
/* 检查状态机 */
|
||||
|
||||
@ -41,7 +41,10 @@ void Task_shoot_ctrl(void *argument) {
|
||||
tick += delay_tick; /* 计算下一个唤醒时刻 */
|
||||
/* USER CODE BEGIN */
|
||||
osMessageQueueGet(task_runtime.msgq.shoot.cmd, &shoot_cmd, NULL, 0);
|
||||
shoot_cmd.mode=SHOOT_MODE_SINGLE;
|
||||
// shoot_cmd.ready =shoot_cmd.ready;
|
||||
// shoot_cmd.firecmd =shoot_cmd.firecmd;
|
||||
// shoot.target_variable.fric_rpm=4000;
|
||||
// shoot_cmd.mode=SHOOT_MODE_SINGLE;
|
||||
Shoot_UpdateFeedback(&shoot);
|
||||
Shoot_Control(&shoot,&shoot_cmd);
|
||||
/* USER CODE END */
|
||||
|
||||
Loading…
Reference in New Issue
Block a user