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

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

82
.vscode/tasks.json vendored
View File

@@ -3,10 +3,10 @@
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{ {
"label": "build task", // 任务标签 "label": "build task",
"type": "shell", // 任务类型,因为要调用mingw32-make,是在终端(CMD)里运行的,所以是shell任务 "type": "shell",
"command": "mingw32-make -j24",// 任务命令,线程数可以根据自己的电脑修改,建议与cpu核数相同 "command": "mingw32-make -j24",
"problemMatcher": [], "problemMatcher": [],
"group": { "group": {
"kind": "build", "kind": "build",
"isDefault": true "isDefault": true
@@ -14,32 +14,76 @@
}, },
{ {
"label": "download dap", "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", "type": "shell",
"command":" download_jlink", // "mingw32-make -j24 ; mingw32-make download_jlink" "command": "mingw32-make -j24 ; mingw32-make download_dap",
"group": { "group": {
"kind": "build", "kind": "build",
"isDefault": false, "isDefault": false
}
},
{
"label": "download jlink",
"type": "shell",
"command": " download_jlink",
"group": {
"kind": "build",
"isDefault": false
} }
}, },
{ {
"label": "log", "label": "log",
"type": "shell", "type": "shell",
"command":"JlinkRTTClient", "command": "JlinkRTTClient",
"args": [], "args": [],
"problemMatcher": [], "problemMatcher": [],
"dependsOn":[ "dependsOn": [
"build task", // 可以添加多个. "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 void CalcLQR(LinkNPodParam *p, ChassisParam *chassis)
{ {
static float k[12][3] = {152.073959,-322.787113,4.602472, static float k[12][3] = {91.443258,-113.149301,-8.780431,
-18.091924,-50.039341,3.160226, 2.186397,-6.908826,-0.171192,
124.677598,-113.871572,-13.279757, 47.943203,-39.423913,-13.297140,
86.314525,-98.184173,-8.140564, 30.671413,-28.308799,-9.363969,
162.907111,-185.705008,74.114015, 231.778706,-224.742110,68.974495,
14.280240,-18.420891,8.593112, 18.910995,-20.079072,7.490403,
-148.548074,99.259778,48.506697, 50.114072,-58.670210,23.856863,
-37.972970,41.871624,3.715364, 3.273746,-3.321150,1.267603,
192.255883,-224.641960,95.484838, 140.969395,-137.481822,42.507159,
93.227296,-117.550338,60.336158, 93.859327,-90.754295,27.811839,
-343.472953,311.036102,57.349362, -283.581279,232.017305,87.865897,
-41.609057,38.668058,-0.809331,}; -28.193619,23.802666,3.963794,};
float T[2] = {0}; // 0 T_wheel 1 T_hip float T[2] = {0}; // 0 T_wheel 1 T_hip
float l = p->leg_len; float l = p->leg_len;
float lsqr = l * l; float lsqr = l * l;