新增了教程和注释以及文档,增加了一键编译并打开ozone调试的脚本

This commit is contained in:
NeoZng
2023-02-14 11:13:32 +08:00
parent 8fa03012cf
commit 7c76852041
41 changed files with 201 additions and 45 deletions

View File

@@ -379,6 +379,7 @@ void BMI088CalibrateIMU(BMI088Instance *_bmi088)
fabsf(_bmi088->gyro_offset[2]) > 0.01f); // 满足条件说明标定环境不好
}
// 离线标定
if (_bmi088->cali_mode == BMI088_LOAD_PRE_CALI_MODE) // 如果标定失败也会进来,直接使用离线数据
{
// 读取标定数据
@@ -408,6 +409,7 @@ BMI088Instance *BMI088Register(BMI088_Init_Config_s *config)
config->spi_gyro_config.id =
config->heat_pwm_config.id = bmi088_instance;
// @todo:
// 目前只实现了!!!阻塞读取模式!!!.如果需要使用IT模式,则需要修改这里的代码,为spi和gpio注册callback(默认为NULL)
// 还需要设置SPI的传输模式为DMA模式或IT模式(默认为blocking)
// 可以通过conditional compilation或者runtime参数判断

View File

@@ -29,8 +29,8 @@ typedef struct
float acc[3]; // 加速度计数据,xyz
float temperature; // 温度
// uint32_t timestamp; // 时间戳
// uint32_t count;
// float timestamp; // 时间戳,单位为ms,用于计算两次采样的时间间隔,同时给视觉提供timeline
// uint32_t count; // 第count次采样,用于对齐时间戳
} BMI088_Data_t;
#pragma pack() // 恢复默认对齐,需要传输的结构体务必开启1字节对齐
@@ -107,7 +107,8 @@ BMI088Instance *BMI088Register(BMI088_Init_Config_s *config);
BMI088_Data_t BMI088Acquire(BMI088Instance *bmi088);
/**
* @brief 标定传感器
* @brief 标定传感器.BMI088在初始化的时候会调用此函数. 提供接口方便标定离线数据
* @attention @todo 注意,当操作系统开始运行后,此函数会和INS_Task冲突.目前不允许在运行时调用此函数,后续加入标志位判断以提供运行时重新的标定功能
*
* @param _bmi088 待标定的实例
*/

View File

@@ -47,6 +47,7 @@ write写入:
温度数据不需要和accel和gyro同步,它不参与姿态解算,可以不用管.
当加速度数据和陀螺仪数据都准备完成之后,唤醒姿态解算任务INs_taSk,进行一次解算.唤醒可以通过软件开启EXTI中断,在中断中调用实时系统的vTaskNotifyFromISR()完成,也可以将任务ready标志位置位,当运行到对应位置时检查标志位判断是否要进行任务.时间间隔不是大问题,inS_TAsK中有dwt用于计算两次任务执行的间隔,它将会自动处理好bias的大小
`__HAL_GPIO_EXTI_GENERATE_SWIT()` `HAL_EXTI_GENERATE_SWI()`
`__HAL_GPIO_EXTI_GENERATE_SWIT()` `HAL_EXTI_GENERATE_SWI()` 可以触发软件中断
of course,两者的数据更新实际上可以异步进行,这里为了方便起见当两者数据都准备好以后再行融合

View File

@@ -1,7 +1,7 @@
#ifndef BMI088REG_H
#define BMI088REG_H
/*------- BMI088寄存器地址内容-------*/
/*------- BMI088寄存器地址及其存放的内容-------*/
#define BMI088_ACC_CHIP_ID 0x00 // the register is " Who am I "
#define BMI088_ACC_CHIP_ID_VALUE 0x1E
@@ -125,7 +125,7 @@
#define BMI088_GYRO_125 (0x4 << BMI088_GYRO_RANGE_SHFITS)
#define BMI088_GYRO_BANDWIDTH 0x10
// the first num means Output data rate, the second num means bandwidth
// the first num means Output data rate, the second num means bandwidth
#define BMI088_GYRO_BANDWIDTH_MUST_Set 0x80
#define BMI088_GYRO_2000_532_HZ 0x00
#define BMI088_GYRO_2000_230_HZ 0x01

View File

@@ -0,0 +1 @@
#include "LQR.h"

View File

@@ -0,0 +1,12 @@
/**
* @file LQR.h
* @author your name (you@domain.com)
* @brief 利用arm math库实现矩阵运算功能
* @version 0.1
* @date 2023-02-14
*
* @copyright Copyright (c) 2023
*
*/
#pragma once

View File

@@ -71,7 +71,7 @@ void CANCommSend(CANCommInstance *instance, uint8_t *data);
* @return void* 返回的数据指针
* @attention 注意如果希望直接通过转换指针访问数据,如果数据是union或struct,要检查是否使用了pack(n)
* CANComm接收到的数据可以看作是pack(1)之后的,是连续存放的.
* 如果使用了pack(n)可能会导致数据错乱,并且无法使用强制类型转换直接访问,而需要手动解包.
* 如果使用了pack(n)可能会导致数据错乱,并且无法使用强制类型转换通过memcpy直接访问,而需要手动解包.
* 强烈建议通过CANComm传输的数据使用pack(1)
*/
void *CANCommGet(CANCommInstance *instance);

View File

@@ -1,6 +1,9 @@
#ifndef GENERAL_DEF_H
#define GENERAL_DEF_H
// 一些module的通用数值型定义,注意条件macro兼容,一些宏可能在math.h中已经定义过了
#ifndef PI
#define PI 3.1415926535f
#endif // !PI

View File

@@ -11,4 +11,5 @@
## 模块移植
由于历史遗留问题,IMU模块耦合程度高.后续实现BSP_SPI,将bmi088 middleware删除.仅保留BMI088读取的协议和寄存器定义等,单独实现IMU模块.
由于历史遗留问题,IMU模块耦合程度高.后续实现BSP_SPI,将bmi088 middleware删除.仅保留BMI088读取的协议和寄存器定义等,单独实现IMU模块.
> 移植已经完成,请转而使用module/BMI088的模块. 当前文件夹将在beta1.2停止支持, 1.5之后删除. INS_Task届时会被放到algorithm中,以提供对不同IMU的兼容.

View File

@@ -21,6 +21,7 @@ IST8310_Init_Config_s ist8310_conf = {
.work_mode = IIC_BLOCK_MODE,
},
};
IST8310Instance *asdf = IST8310Init(&ist8310_conf);
// 随后数据会被放到asdf.mag[i]中

View File

@@ -1,3 +1,15 @@
/**
* @file oled.h
* @author your name (you@domain.com)
* @brief 待重构实现
* @version 0.1
* @date 2023-02-14
* @todo 请重构show string/init/clean/update buffer等的实现
*
* @copyright Copyright (c) 2023
*
*/
#ifndef OLED_H
#define OLED_H
#include <stdint.h>

View File

@@ -0,0 +1,5 @@
# oled
当前oled支持不完整,api较为混乱. 需要使用bsp_iic进行实现的重构,并提供统一方便的接口
请使用字库软件制作自己的图标和不同大小的ascii码.

View File

@@ -10,6 +10,7 @@
#ifndef __OLED__FONT__H
#define __OLED__FONT__H
//the common ascii character
const unsigned char asc2_1206[95][12]={
{0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00},/*" ",0*/
@@ -109,6 +110,7 @@ const unsigned char asc2_1206[95][12]={
{0x40,0x00,0x80,0x00,0x40,0x00,0x20,0x00,0x20,0x00,0x40,0x00},/*"~",94*/
};
// 你可以使用图标字库软件生成自己的pattern,软件会输出一个数组,将数组复制到这里即可.
//the logo of robomaster
const unsigned char LOGO_BMP[128][8] = {

View File

@@ -0,0 +1,3 @@
# ps_handle
提供ps手柄的支持,其通信协议和spi类似,可以使用bsp_spi来兼容.待编写.

View File

@@ -1,6 +1,6 @@
#include "crc_ref.h"
#include <stdio.h>
//裁判系统官方CRC校验
const uint8_t CRC8_INIT = 0xff;
const uint8_t CRC8_TAB[256] =

View File

@@ -1,6 +1,8 @@
#ifndef __CRC_H_
#define __CRC_H_
//裁判系统官方CRC校验,LUT和module/algorithms中的不同,后续需要统一实现crc,提供8/16/32的支持
#include <stdint.h>
#define TRUE 1

View File

@@ -70,8 +70,9 @@ remote_control
```
目前的映射:
拨轮向下打到底进入紧急停止模式(后续改为关闭遥控器停止,利用daemon);拨轮向上打开启摩擦轮,超过一半开始发射(速度环,连发)
拨轮向下打到底进入紧急停止模式(后续改为关闭遥控器停止,利用daemon; daemon已经模块完成);拨轮向上打开启摩擦轮,超过一半开始发射(速度环,连发)
左侧开关:
- 上:键鼠控制

View File

@@ -9,7 +9,7 @@
#include "memory.h"
#include "stdlib.h"
static SuperCapInstance *super_cap_instance = NULL;
static SuperCapInstance *super_cap_instance = NULL; // 可以由app保存此指针
static void SuperCapRxCallback(CANInstance *_instance)
{