Merge remote-tracking branch 'origin/dev-stool' into dev-stool

This commit is contained in:
TuxMonkey
2026-07-07 02:05:27 +08:00
5 changed files with 200 additions and 72 deletions

View File

@@ -15,6 +15,71 @@
"cppStandard": "gnu++14",
"intelliSenseMode": "windows-gcc-x86",
"configurationProvider": "ms-vscode.makefile-tools"
},
{
"name": "STM32",
"includePath": [
"Drivers/CMSIS/Device/ST/STM32F4xx/Include",
"Drivers/CMSIS/Include",
"Drivers/STM32F4xx_HAL_Driver/Inc",
"Drivers/STM32F4xx_HAL_Driver/Inc/Legacy",
"Inc",
"Middlewares/ST/ARM/DSP/Inc",
"Middlewares/ST/ARM/DSP/Include",
"Middlewares/ST/ARM/DSP/Include/dsp",
"Middlewares/ST/STM32_USB_Device_Library/Class/CDC/Inc",
"Middlewares/ST/STM32_USB_Device_Library/Core/Inc",
"Middlewares/Third_Party/FreeRTOS/Source/CMSIS_RTOS",
"Middlewares/Third_Party/FreeRTOS/Source/include",
"Middlewares/Third_Party/FreeRTOS/Source/portable/GCC/ARM_CM4F",
"Middlewares/Third_Party/SEGGER/Config",
"Middlewares/Third_Party/SEGGER/RTT",
"application",
"application/chassis",
"application/cmd",
"application/gimbal",
"application/shoot",
"bsp",
"bsp/can",
"bsp/dwt",
"bsp/flash",
"bsp/gpio",
"bsp/iic",
"bsp/log",
"bsp/pwm",
"bsp/spi",
"bsp/usart",
"bsp/usb",
"modules",
"modules/BMI088",
"modules/alarm",
"modules/algorithm",
"modules/bluetooth",
"modules/can_comm",
"modules/daemon",
"modules/imu",
"modules/ist8310",
"modules/master_machine",
"modules/message_center",
"modules/motor",
"modules/motor/DJImotor",
"modules/motor/DMmotor",
"modules/motor/HTmotor",
"modules/motor/LKmotor",
"modules/motor/servo_motor",
"modules/motor/step_motor",
"modules/oled",
"modules/referee",
"modules/remote",
"modules/super_cap"
],
"defines": [
"ARM_MATH_CM4",
"STM32F407xx",
"USE_HAL_DRIVER",
"__FPU_PRESENT=1U"
],
"compilerPath": "c:\\Users\\ASUS\\AppData\\Roaming\\Code - Insiders\\User\\globalStorage\\bmd.stm32-for-vscode\\@xpack-dev-tools\\arm-none-eabi-gcc\\13.2.1-1.1.1\\.content\\bin\\arm-none-eabi-gcc.EXE"
}
],
"version": 4

59
.vscode/launch.json vendored
View File

@@ -2,34 +2,26 @@
// 启动调试的快捷键是F5
"version": "0.2.0",
"configurations": [
// 使用dap-link(如无线调试器时的参考配置)
{
"name": "DAPlink",
"cwd": "${workspaceRoot}",
"executable": "${workspaceRoot}\\build\\basic_framework.elf", // 要下载到调试器的文件,花括号中的是vscode两个预定义的参数
"executable": "${workspaceRoot}\\build\\basic_framework.elf",
"request": "launch",
"type": "cortex-debug",
//使用J-link GDB Server时必须;其他GBD Server时可选有可能帮助自动选择SVD文件
//支持的设备见 https://www.segger.com/downloads/supported-devices.php
"device": "STM32F407IG",
//svd文件有这个文件才能查看寄存器的值每个单片机都不同。可以在以下地址找到 https://github.com/posborne/cmsis-svd
//该项目的根目录已经提供了C型开发板使用的外设svd文件
"svdFile": "STM32F407.svd",
"servertype": "openocd", //使用的GDB Server
"servertype": "openocd",
"configFiles": [
"openocd_dap.cfg", // 配置文件已经在根目录提供,若要修改以此类推,openocd的路径下的share/scripts中有各种写好的配置文件
"openocd_dap.cfg"
],
"runToEntryPoint": "main", // 调试时在main函数入口停下
"runToEntryPoint": "main",
"rtos": "FreeRTOS",
"preLaunchTask": "build task",//先运行Build任务编译项目,取消注释即可使用
"preLaunchTask": "build task",
"liveWatch": {
"enabled": true,
"samplesPerSecond": 4
}
// dap若要使用log,请使用Jlink调试任务启动,之后再打开log任务
// 若想要在调试前编译并且打开log,可只使用log的prelaunch task并为log任务添加depends on依赖
},
// 使用j-link进行调试时的参考配置
{
"name": "Jlink",
"cwd": "${workspaceFolder}",
@@ -43,26 +35,23 @@
"interface": "swd",
"svdFile": "STM32F407.svd",
"rtos": "FreeRTOS",
//"preLaunchTask": "build task",//先运行Build任务,取消注释即可使用
"liveWatch": {
"enabled": true,
"samplesPerSecond": 4
},
// "preLaunchTask": "log", // 调试时同时开启RTT viewer窗口,若daplink使用jlinkGDBserver启动,需要先开始调试再打开log
// 若想要在调试前编译并且打开log,可只使用log的prelaunch task并为log任务添加depends on依赖
}
},
{
"name": "DAP-attach",
"cwd": "${workspaceRoot}",
"executable": "${workspaceRoot}\\build\\basic_framework.elf", // 要下载到调试器的文件,花括号中的是vscode两个预定义的参数
"executable": "${workspaceRoot}\\build\\basic_framework.elf",
"request": "attach",
"type": "cortex-debug",
"device": "STM32F407IG",
"svdFile": "STM32F407.svd",
"servertype": "openocd",
"configFiles": [
"openocd_dap.cfg",
],
"openocd_dap.cfg"
]
},
{
"name": "Jlink-attach",
@@ -75,7 +64,35 @@
"servertype": "jlink",
"interface": "swd",
"svdFile": "STM32F407.svd",
"rtos": "FreeRTOS",
"rtos": "FreeRTOS"
},
{
"showDevDebugOutput": "parsed",
"cwd": "${workspaceRoot}",
"executable": "./build/debug/basic_framework.elf",
"name": "Debug STM32",
"request": "launch",
"type": "cortex-debug",
"servertype": "openocd",
"preLaunchTask": "Build STM",
"device": "stm32f407",
"configFiles": [
"openocd.cfg"
]
},
{
"showDevDebugOutput": "parsed",
"cwd": "${workspaceRoot}",
"executable": "./build/debug/basic_framework.elf",
"name": "Attach STM32",
"request": "attach",
"type": "cortex-debug",
"servertype": "openocd",
"preLaunchTask": "Build STM",
"device": "stm32f407",
"configFiles": [
"openocd.cfg"
]
}
],
}

View File

@@ -14,5 +14,7 @@
"bsp_usart.h": "c",
"memory.h": "c"
},
"C_Cpp.errorSquiggles": "disabled"
"C_Cpp.errorSquiggles": "disabled",
"cortex-debug.armToolchainPath": "c:\\Users\\ASUS\\AppData\\Roaming\\Code - Insiders\\User\\globalStorage\\bmd.stm32-for-vscode\\@xpack-dev-tools\\arm-none-eabi-gcc\\13.2.1-1.1.1\\.content\\bin",
"cortex-debug.openocdPath": "C:\\USERS\\ASUS\\APPDATA\\ROAMING\\CODE - INSIDERS\\USER\\GLOBALSTORAGE\\BMD.STM32-FOR-VSCODE\\@XPACK-DEV-TOOLS\\OPENOCD\\0.12.0-3.1\\.CONTENT\\BIN\\OPENOCD.EXE"
}

80
.vscode/tasks.json vendored
View File

@@ -3,9 +3,9 @@
"version": "2.0.0",
"tasks": [
{
"label": "build task", // 任务标签
"type": "shell", // 任务类型,因为要调用mingw32-make,是在终端(CMD)里运行的,所以是shell任务
"command": "mingw32-make -j24",// 任务命令,线程数可以根据自己的电脑修改,建议与cpu核数相同
"label": "build task",
"type": "shell",
"command": "mingw32-make -j24",
"problemMatcher": [],
"group": {
"kind": "build",
@@ -14,32 +14,76 @@
},
{
"label": "download dap",
"type": "shell", // 如果希望在下载前编译,可以把command换成下面的命令
"command":"mingw32-make -j24 ; mingw32-make download_dap", // "mingw32-make -j24 ; mingw32-make download_dap",
"group": { // 如果没有修改代码,编译任务不会消耗时间,因此推荐使用上面的替换.
"kind": "build",
"isDefault": false,
},
},
{
"label": "download jlink", // 要使用此任务,需添加jlink的环境变量
"type": "shell",
"command":" download_jlink", // "mingw32-make -j24 ; mingw32-make download_jlink"
"command": "mingw32-make -j24 ; mingw32-make download_dap",
"group": {
"kind": "build",
"isDefault": false,
"isDefault": false
}
},
{
"label": "download jlink",
"type": "shell",
"command": " download_jlink",
"group": {
"kind": "build",
"isDefault": false
}
},
{
"label": "log",
"type": "shell",
"command":"JlinkRTTClient",
"command": "JlinkRTTClient",
"args": [],
"problemMatcher": [],
"dependsOn":[
"build task", // 可以添加多个.
"dependsOn": [
"build task"
]
},
{
"label": "Build STM",
"type": "process",
"command": "${command:stm32-for-vscode.build}",
"options": {
"cwd": "${workspaceRoot}"
},
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "Build Clean STM",
"type": "process",
"command": "${command:stm32-for-vscode.cleanBuild}",
"options": {
"cwd": "${workspaceRoot}"
},
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
},
{
"label": "Flash STM",
"type": "process",
"command": "${command:stm32-for-vscode.flash}",
"options": {
"cwd": "${workspaceRoot}"
},
"group": {
"kind": "build",
"isDefault": true
},
"problemMatcher": [
"$gcc"
]
// 若使用daplink,则将log任务设置为依赖于jlink launch任务,保证jlink launch任务先于log任务执行
}
]
}

View File

@@ -9,18 +9,18 @@
*/
static void CalcLQR(LinkNPodParam *p, ChassisParam *chassis)
{
static float k[12][3] = {152.073959,-322.787113,4.602472,
-18.091924,-50.039341,3.160226,
124.677598,-113.871572,-13.279757,
86.314525,-98.184173,-8.140564,
162.907111,-185.705008,74.114015,
14.280240,-18.420891,8.593112,
-148.548074,99.259778,48.506697,
-37.972970,41.871624,3.715364,
192.255883,-224.641960,95.484838,
93.227296,-117.550338,60.336158,
-343.472953,311.036102,57.349362,
-41.609057,38.668058,-0.809331,};
static float k[12][3] = {91.443258,-113.149301,-8.780431,
2.186397,-6.908826,-0.171192,
47.943203,-39.423913,-13.297140,
30.671413,-28.308799,-9.363969,
231.778706,-224.742110,68.974495,
18.910995,-20.079072,7.490403,
50.114072,-58.670210,23.856863,
3.273746,-3.321150,1.267603,
140.969395,-137.481822,42.507159,
93.859327,-90.754295,27.811839,
-283.581279,232.017305,87.865897,
-28.193619,23.802666,3.963794,};
float T[2] = {0}; // 0 T_wheel 1 T_hip
float l = p->leg_len;
float lsqr = l * l;