修改了freertos的支持include,增加了daemon的上线等待时间,增加pid参数整定指南
This commit is contained in:
parent
4a45331d31
commit
b4d4228ccc
|
@ -69,6 +69,7 @@
|
|||
#define configUSE_16_BIT_TICKS 0
|
||||
#define configUSE_MUTEXES 1
|
||||
#define configQUEUE_REGISTRY_SIZE 8
|
||||
#define configUSE_COUNTING_SEMAPHORES 1
|
||||
#define configUSE_PORT_OPTIMISED_TASK_SELECTION 1
|
||||
/* USER CODE BEGIN MESSAGE_BUFFER_LENGTH_TYPE */
|
||||
/* Defaults to size_t for backward compatibility, but can be changed
|
||||
|
|
3
Makefile
3
Makefile
|
@ -119,7 +119,7 @@ bsp/can/bsp_can.c \
|
|||
bsp/usart/bsp_usart.c \
|
||||
bsp/usb/bsp_usb.c \
|
||||
bsp/log/bsp_log.c \
|
||||
bsp/log/bsp_flash.c \
|
||||
bsp/flash/bsp_flash.c \
|
||||
bsp/bsp_init.c \
|
||||
modules/algorithm/controller.c \
|
||||
modules/algorithm/kalman_filter.c \
|
||||
|
@ -244,6 +244,7 @@ C_INCLUDES = \
|
|||
-Ibsp/spi \
|
||||
-Ibsp/iic \
|
||||
-Ibsp/log \
|
||||
-Ibsp/flash \
|
||||
-Ibsp/pwm \
|
||||
-Ibsp/bsp_legacy_support \
|
||||
-Ibsp \
|
||||
|
|
|
@ -132,16 +132,8 @@ static void RemoteControlSet()
|
|||
{ // 按照摇杆的输出大小进行角度增量,增益系数需调整
|
||||
gimbal_cmd_send.yaw += 0.005f * (float)rc_data[TEMP].rc.rocker_l_;
|
||||
gimbal_cmd_send.pitch += 0.001f * (float)rc_data[TEMP].rc.rocker_l1;
|
||||
// 摇杆控制的软件限位
|
||||
// if (gimbal_cmd_send.pitch <= PITCH_MIN_ECD)
|
||||
// {
|
||||
// gimbal_cmd_send.pitch = PITCH_MIN_ECD;
|
||||
// }
|
||||
// else if (gimbal_cmd_send.pitch >= PITCH_MAX_ECD)
|
||||
// {
|
||||
// gimbal_cmd_send.pitch = PITCH_MAX_ECD;
|
||||
// }
|
||||
}
|
||||
// 云台软件限位
|
||||
|
||||
// 底盘参数,目前没有加入小陀螺(调试似乎暂时没有必要),系数需要调整
|
||||
chassis_cmd_send.vx = 10.0f * (float)rc_data[TEMP].rc.rocker_r_; // _水平方向
|
||||
|
|
|
@ -174,11 +174,12 @@ Dma.USART6_TX.1.PeriphInc=DMA_PINC_DISABLE
|
|||
Dma.USART6_TX.1.Priority=DMA_PRIORITY_HIGH
|
||||
Dma.USART6_TX.1.RequestParameters=Instance,Direction,PeriphInc,MemInc,PeriphDataAlignment,MemDataAlignment,Mode,Priority,FIFOMode,FIFOThreshold,MemBurst,PeriphBurst
|
||||
FREERTOS.INCLUDE_vTaskDelayUntil=1
|
||||
FREERTOS.IPParameters=Tasks01,configENABLE_FPU,configMAX_TASK_NAME_LEN,configUSE_TIMERS,configUSE_POSIX_ERRNO,INCLUDE_vTaskDelayUntil,configTOTAL_HEAP_SIZE
|
||||
FREERTOS.IPParameters=Tasks01,configENABLE_FPU,configMAX_TASK_NAME_LEN,configUSE_TIMERS,configUSE_POSIX_ERRNO,INCLUDE_vTaskDelayUntil,configTOTAL_HEAP_SIZE,configUSE_COUNTING_SEMAPHORES
|
||||
FREERTOS.Tasks01=defaultTask,0,128,StartDefaultTask,Default,NULL,Dynamic,NULL,NULL
|
||||
FREERTOS.configENABLE_FPU=1
|
||||
FREERTOS.configMAX_TASK_NAME_LEN=32
|
||||
FREERTOS.configTOTAL_HEAP_SIZE=20000
|
||||
FREERTOS.configUSE_COUNTING_SEMAPHORES=1
|
||||
FREERTOS.configUSE_POSIX_ERRNO=0
|
||||
FREERTOS.configUSE_TIMERS=0
|
||||
File.Version=6
|
||||
|
|
|
@ -382,7 +382,7 @@ void BMI088CalibrateIMU(BMI088Instance *_bmi088)
|
|||
BMI088Instance *BMI088Register(BMI088_Init_Config_s *config)
|
||||
{
|
||||
// 申请内存
|
||||
BMI088Instance *bmi088_instance = (BMI088Instance *)zero_malloc(sizeof(BMI088Instance));
|
||||
BMI088Instance *bmi088_instance = (BMI088Instance *)zmalloc(sizeof(BMI088Instance));
|
||||
// 从右向左赋值,让bsp instance保存指向bmi088_instance的指针(父指针),便于在底层中断中访问bmi088_instance
|
||||
config->acc_int_config.id =
|
||||
config->gyro_int_config.id =
|
||||
|
|
|
@ -23,9 +23,7 @@
|
|||
#define user_malloc malloc
|
||||
#endif
|
||||
|
||||
uint8_t GlobalDebugMode = 7;
|
||||
|
||||
void *zero_malloc(size_t size)
|
||||
void *zmalloc(size_t size)
|
||||
{
|
||||
void *ptr = malloc(size);
|
||||
memset(ptr, 0, size);
|
||||
|
@ -207,3 +205,4 @@ float AverageFilter(float new_data, float *buf, uint8_t len)
|
|||
sum += new_data;
|
||||
return sum / len;
|
||||
}
|
||||
|
||||
|
|
|
@ -23,8 +23,6 @@
|
|||
#define mcos(x) (arm_cos_f32(x))
|
||||
|
||||
|
||||
extern uint8_t GlobalDebugMode;
|
||||
|
||||
#ifndef user_malloc
|
||||
#ifdef _CMSIS_OS_H
|
||||
#define user_malloc pvPortMalloc
|
||||
|
@ -89,7 +87,7 @@ extern uint8_t GlobalDebugMode;
|
|||
* @param size 分配大小
|
||||
* @return void*
|
||||
*/
|
||||
void *zero_malloc(size_t size);
|
||||
void *zmalloc(size_t size);
|
||||
|
||||
// <20><><EFBFBD>ٿ<EFBFBD><D9BF><EFBFBD>
|
||||
float Sqrt(float x);
|
||||
|
|
|
@ -13,8 +13,9 @@ DaemonInstance *DaemonRegister(Daemon_Init_Config_s *config)
|
|||
memset(instance, 0, sizeof(DaemonInstance));
|
||||
|
||||
instance->owner_id = config->owner_id;
|
||||
instance->reload_count = config->reload_count == 0 ? 100 : config->reload_count;
|
||||
instance->reload_count = config->reload_count == 0 ? 100 : config->reload_count; // 默认值为100
|
||||
instance->callback = config->callback;
|
||||
instance->temp_count = config->init_count == 0 ? 100 : config->init_count; // 默认值为100,初始计数
|
||||
|
||||
daemon_instances[idx++] = instance;
|
||||
return instance;
|
||||
|
|
|
@ -22,6 +22,7 @@ typedef struct daemon_ins
|
|||
typedef struct
|
||||
{
|
||||
uint16_t reload_count; // 实际上这是app唯一需要设置的值?
|
||||
uint16_t init_count; // 上线等待时间,有些模块需要收到主控的指令才会反馈报文,或pc等需要开机时间
|
||||
offline_callback callback; // 异常处理函数,当模块发生异常时会被调用
|
||||
void *owner_id; // id取拥有daemon的实例的地址,如DJIMotorInstance*,cast成void*类型
|
||||
} Daemon_Init_Config_s;
|
||||
|
|
|
@ -8,7 +8,7 @@ static LEDInstance *bsp_led_ins[LED_MAX_NUM] = {NULL};
|
|||
|
||||
LEDInstance *LEDRegister(LED_Init_Config_s *led_config)
|
||||
{
|
||||
LEDInstance *led_ins = (LEDInstance *)zero_malloc(sizeof(LEDInstance));
|
||||
LEDInstance *led_ins = (LEDInstance *)zmalloc(sizeof(LEDInstance));
|
||||
// 剩下的值暂时都被置零
|
||||
led_ins->led_pwm = PWMRegister(&led_config->pwm_config);
|
||||
led_ins->led_switch = led_config->init_swtich;
|
||||
|
|
|
@ -0,0 +1,3 @@
|
|||
# 利用Ozone进行model-based PID tunning
|
||||
|
||||
Ozone的实时变量可视化监测(示波器)功能可以很好地帮助我们观察控制器在时域的表现,典型的有上升时间、超调量和稳态时间等。
|
Loading…
Reference in New Issue