diff --git a/Core/Inc/FreeRTOSConfig.h b/Core/Inc/FreeRTOSConfig.h index 7f54aab..fee994f 100644 --- a/Core/Inc/FreeRTOSConfig.h +++ b/Core/Inc/FreeRTOSConfig.h @@ -73,7 +73,7 @@ #define configTICK_RATE_HZ ((TickType_t)1000) #define configMAX_PRIORITIES ( 56 ) #define configMINIMAL_STACK_SIZE ((uint16_t)128) -#define configTOTAL_HEAP_SIZE ((size_t)0x6000) +#define configTOTAL_HEAP_SIZE ((size_t)0x10000) #define configMAX_TASK_NAME_LEN ( 16 ) #define configGENERATE_RUN_TIME_STATS 1 #define configUSE_TRACE_FACILITY 1 @@ -187,6 +187,7 @@ standard names. */ /* USER CODE BEGIN Defines */ /* Section where parameter definitions can be added (for instance, to override default ones in FreeRTOS.h) */ +// #define configAPPLICATION_ALLOCATED_HEAP 1 /* USER CODE END Defines */ #endif /* FREERTOS_CONFIG_H */ diff --git a/Core/Src/freertos.c b/Core/Src/freertos.c index 0163ecb..0774647 100644 --- a/Core/Src/freertos.c +++ b/Core/Src/freertos.c @@ -47,7 +47,7 @@ /* Private variables ---------------------------------------------------------*/ /* USER CODE BEGIN Variables */ - +uint8_t ucHeap[configTOTAL_HEAP_SIZE] __attribute__((section(".ccmram"))); /* USER CODE END Variables */ /* Definitions for defaultTask */ osThreadId_t defaultTaskHandle; diff --git a/DevC.ioc b/DevC.ioc index 993e674..9f4f496 100644 --- a/DevC.ioc +++ b/DevC.ioc @@ -141,14 +141,15 @@ FREERTOS.INCLUDE_xSemaphoreGetMutexHolder=1 FREERTOS.INCLUDE_xTaskAbortDelay=1 FREERTOS.INCLUDE_xTaskGetCurrentTaskHandle=1 FREERTOS.INCLUDE_xTaskGetHandle=1 -FREERTOS.IPParameters=Tasks01,FootprintOK,configENABLE_FPU,configENABLE_BACKWARD_COMPATIBILITY,configRECORD_STACK_HIGH_ADDRESS,configCHECK_FOR_STACK_OVERFLOW,configGENERATE_RUN_TIME_STATS,configUSE_STATS_FORMATTING_FUNCTIONS,configTOTAL_HEAP_SIZE,INCLUDE_xTaskGetCurrentTaskHandle,INCLUDE_xTaskGetHandle,INCLUDE_uxTaskGetStackHighWaterMark2,INCLUDE_xEventGroupSetBitFromISR,INCLUDE_xTaskAbortDelay,INCLUDE_pcTaskGetTaskName,INCLUDE_xSemaphoreGetMutexHolder,INCLUDE_vTaskCleanUpResources +FREERTOS.IPParameters=Tasks01,FootprintOK,configENABLE_FPU,configENABLE_BACKWARD_COMPATIBILITY,configRECORD_STACK_HIGH_ADDRESS,configCHECK_FOR_STACK_OVERFLOW,configGENERATE_RUN_TIME_STATS,configUSE_STATS_FORMATTING_FUNCTIONS,configTOTAL_HEAP_SIZE,INCLUDE_xTaskGetCurrentTaskHandle,INCLUDE_xTaskGetHandle,INCLUDE_uxTaskGetStackHighWaterMark2,INCLUDE_xEventGroupSetBitFromISR,INCLUDE_xTaskAbortDelay,INCLUDE_pcTaskGetTaskName,INCLUDE_xSemaphoreGetMutexHolder,INCLUDE_vTaskCleanUpResources,configUSE_APPLICATION_TASK_TAG FREERTOS.Tasks01=defaultTask,24,128,StartDefaultTask,Default,NULL,Dynamic,NULL,NULL FREERTOS.configCHECK_FOR_STACK_OVERFLOW=2 FREERTOS.configENABLE_BACKWARD_COMPATIBILITY=0 FREERTOS.configENABLE_FPU=1 FREERTOS.configGENERATE_RUN_TIME_STATS=1 FREERTOS.configRECORD_STACK_HIGH_ADDRESS=1 -FREERTOS.configTOTAL_HEAP_SIZE=0x6000 +FREERTOS.configTOTAL_HEAP_SIZE=0x10000 +FREERTOS.configUSE_APPLICATION_TASK_TAG=0 FREERTOS.configUSE_STATS_FORMATTING_FUNCTIONS=1 File.Version=6 GPIO.groupedBy=Group By Peripherals diff --git a/User/bsp/can.c b/User/bsp/can.c index f29cb3d..193dd2d 100644 --- a/User/bsp/can.c +++ b/User/bsp/can.c @@ -680,7 +680,6 @@ int8_t BSP_CAN_WaitTxMailboxEmpty(BSP_CAN_t can, uint32_t timeout) { } } - // 短暂延时,避免占用过多CPU osDelay(1); } } diff --git a/User/module/config.c b/User/module/config.c index ca2b67f..c58511a 100644 --- a/User/module/config.c +++ b/User/module/config.c @@ -22,51 +22,7 @@ Config_RobotParam_t robot_config = { .device_id = 0x42, .master_id = 0x43, }, - .joint_motors[0] = { // 左膝关节 - .can = BSP_CAN_1, - .motor_id = 124, - .host_id = 0XFF, - .module = MOTOR_LZ_RSO3, - .reverse = false, - .mode = MOTOR_LZ_MODE_MOTION, - }, - .joint_motors[1] = { // 左髋关节 - .can = BSP_CAN_1, - .motor_id = 125, - .host_id = 0XFF, - .module = MOTOR_LZ_RSO3, - .reverse = false, - .mode = MOTOR_LZ_MODE_MOTION, - }, - .joint_motors[2] = { // 右髋关节 - .can = BSP_CAN_1, - .motor_id = 126, - .host_id = 0XFF, - .module = MOTOR_LZ_RSO3, - .reverse = false, - .mode = MOTOR_LZ_MODE_MOTION, - }, - .joint_motors[3] = { // 右膝关节 - .can = BSP_CAN_1, - .motor_id = 127, - .host_id = 0XFF, - .module = MOTOR_LZ_RSO3, - .reverse = false, - .mode = MOTOR_LZ_MODE_MOTION, - }, - .wheel_motors[0] = { // 左轮电机 - .can = BSP_CAN_1, - .id = 1, // 电机ID为1,对应命令ID=0x141,反馈ID=0x181 - .module = MOTOR_LK_MF9025, - .reverse = false, - }, - .wheel_motors[1] = { // 右轮电机 - .can = BSP_CAN_1, - .id = 2, // 电机ID为2,对应命令ID=0x142,反馈ID=0x182 - .module = MOTOR_LK_MF9025, - .reverse = true, - }, - + .chassis_param = { .yaw={ .k=1.0f, diff --git a/User/task/ctrl_chassis.c b/User/task/ctrl_chassis.c index fcb2aed..458a799 100644 --- a/User/task/ctrl_chassis.c +++ b/User/task/ctrl_chassis.c @@ -30,9 +30,7 @@ Chassis_CMD_t chassis_cmd = { .height = 0.0f, }; Chassis_IMU_t chassis_imu; - -MOTOR_Feedback_t left_wheel_fb; -MOTOR_Feedback_t right_wheel_fb; +Chassis_t chassis1; /* USER STRUCT END */ /* Private function --------------------------------------------------------- */ diff --git a/infantry.jdebug b/infantry.jdebug index 646467b..b86fb13 100644 --- a/infantry.jdebug +++ b/infantry.jdebug @@ -22,12 +22,12 @@ void OnProjectLoad (void) { // // Dialog-generated settings // - Project.AddPathSubstitute ("/Users/lvzucheng/Documents/R/balance_infantry", "$(ProjectDir)"); - Project.AddPathSubstitute ("/users/lvzucheng/documents/r/balance_infantry", "$(ProjectDir)"); Project.SetDevice ("STM32F407IG"); Project.SetHostIF ("USB", "207400620"); Project.SetTargetIF ("SWD"); Project.SetTIFSpeed ("4 MHz"); + Project.AddPathSubstitute ("/Users/lvzucheng/Documents/R/balance_infantry", "$(ProjectDir)"); + Project.AddPathSubstitute ("/users/lvzucheng/documents/r/balance_infantry", "$(ProjectDir)"); Project.AddSvdFile ("$(InstallDir)/Config/CPU/Cortex-M4F.svd"); // // User settings