规范模块目录和第三方依赖结构
This commit is contained in:
@@ -24,7 +24,13 @@ set(SOURCES
|
||||
)
|
||||
|
||||
# 头文件目录
|
||||
include_directories(src)
|
||||
include_directories(
|
||||
include
|
||||
third_party
|
||||
third_party/kdl_parser/include
|
||||
third_party/orocos_kdl/install_wasm/include
|
||||
third_party/eigen3
|
||||
)
|
||||
|
||||
# 创建可执行文件
|
||||
add_executable(smart_wasm ${SOURCES})
|
||||
@@ -47,4 +53,4 @@ set_target_properties(smart_wasm PROPERTIES
|
||||
SUFFIX ".js"
|
||||
OUTPUT_NAME "smart_math"
|
||||
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/public/wasm"
|
||||
)
|
||||
)
|
||||
|
||||
11
README.md
11
README.md
@@ -17,7 +17,7 @@
|
||||
```text
|
||||
.
|
||||
|-- src/ C++ 业务实现
|
||||
|-- inc/ 公共头文件
|
||||
|-- include/ 公共头文件和业务接口定义
|
||||
|-- scripts/ 构建、调试、回归测试脚本
|
||||
|-- tests/
|
||||
| |-- testdata/ 正式回归测试数据
|
||||
@@ -25,9 +25,12 @@
|
||||
|-- docs/
|
||||
| |-- notes/ 功能说明和算法笔记
|
||||
| `-- build-logs/ 历史编译记录和调试日志
|
||||
|-- third_party/
|
||||
| |-- eigen3/ 第三方 Eigen 依赖
|
||||
| |-- kdl_parser/ vendored URDF/KDL parser 源码
|
||||
| |-- nlohmann/ JSON 头文件库
|
||||
| `-- orocos_kdl/ 第三方 KDL 依赖及安装产物
|
||||
|-- public/wasm/ WASM 构建输出
|
||||
|-- Eigen3/ 第三方 Eigen 依赖
|
||||
|-- KDL/ 第三方 KDL 依赖及安装产物
|
||||
|-- package.json npm 入口
|
||||
|-- CMakeLists.txt CMake 入口
|
||||
`-- Makefile Make 入口
|
||||
@@ -44,6 +47,8 @@ npm run build-serve
|
||||
## 📁 目录约定
|
||||
|
||||
- 根目录只保留项目入口文件和核心目录,避免测试样例、日志、草稿散落在顶层。
|
||||
- `include/` 只放本项目对外和模块间共享的头文件。
|
||||
- `third_party/` 统一收纳所有外部依赖和 vendored 源码,避免和业务代码混放。
|
||||
- `tests/testdata/` 放可重复执行的标准化测试数据。
|
||||
- `tests/fixtures/legacy/` 放历史调试输入输出,便于追溯,但默认不作为正式回归入口。
|
||||
- `docs/notes/` 放业务说明和算法记录。
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef CRANK_ROCKING_BLOCK_MECHANISM_FORWARD_H
|
||||
#define CRANK_ROCKING_BLOCK_MECHANISM_FORWARD_H
|
||||
|
||||
#include "CrankSliderMechanism.h"
|
||||
#include "FourBarMechanism/CrankSliderMechanism.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <map>
|
||||
@@ -90,4 +90,4 @@ private:
|
||||
std::string formatDouble(double value, int precision = 3) const;
|
||||
};
|
||||
|
||||
#endif // CRANK_ROCKING_BLOCK_MECHANISM_FORWARD_H
|
||||
#endif // CRANK_ROCKING_BLOCK_MECHANISM_FORWARD_H
|
||||
@@ -1,7 +1,7 @@
|
||||
#ifndef CRANK_ROCKING_BLOCK_MECHANISM_INVERSE_H
|
||||
#define CRANK_ROCKING_BLOCK_MECHANISM_INVERSE_H
|
||||
|
||||
#include "CrankSliderMechanism.h"
|
||||
#include "FourBarMechanism/CrankSliderMechanism.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <map>
|
||||
@@ -51,4 +51,4 @@ private:
|
||||
std::pair<double, double> getACRange() const;
|
||||
};
|
||||
|
||||
#endif // CRANK_ROCKING_BLOCK_MECHANISM_INVERSE_H
|
||||
#endif // CRANK_ROCKING_BLOCK_MECHANISM_INVERSE_H
|
||||
@@ -8,7 +8,7 @@
|
||||
#include <cmath>
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
#include "SharedGeometry.h" // 包含共享的几何类
|
||||
#include "SharedGeometry/SharedGeometry.h" // 包含共享的几何类
|
||||
// 定义常数
|
||||
#ifndef M_PI
|
||||
#define M_PI 3.14159265358979323846
|
||||
@@ -198,4 +198,4 @@ void deleteCrankSliderMechanism(CrankSliderMechanism *mechanism);
|
||||
using CrankSliderMechanismPtr = std::shared_ptr<CrankSliderMechanism>;
|
||||
CrankSliderMechanismPtr createCrankSliderMechanismSmart();
|
||||
|
||||
#endif // MECHANISM_SIMULATION_H
|
||||
#endif // MECHANISM_SIMULATION_H
|
||||
@@ -1,14 +1,14 @@
|
||||
// FourBarMechanism.h
|
||||
#ifndef FOUR_BAR_MECHANISM_H
|
||||
#define FOUR_BAR_MECHANISM_H
|
||||
#include "CrankSliderMechanism.h"
|
||||
#include "FourBarMechanism/CrankSliderMechanism.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <cmath>
|
||||
#include <chrono>
|
||||
#include <memory>
|
||||
#include "SharedGeometry.h"
|
||||
#include "SharedGeometry/SharedGeometry.h"
|
||||
|
||||
// 前向声明
|
||||
struct MechanismParameters;
|
||||
@@ -91,4 +91,4 @@ void deleteFourBarMechanism(FourBarMechanism *mechanism);
|
||||
using FourBarMechanismPtr = std::shared_ptr<FourBarMechanism>;
|
||||
FourBarMechanismPtr createFourBarMechanismSmart();
|
||||
|
||||
#endif // FOUR_BAR_MECHANISM_H
|
||||
#endif // FOUR_BAR_MECHANISM_H
|
||||
@@ -1,12 +1,12 @@
|
||||
// SliderCrankMechanism.h
|
||||
#ifndef SLIDER_CRANK_MECHANISM_H
|
||||
#define SLIDER_CRANK_MECHANISM_H
|
||||
#include "CrankSliderMechanism.h"
|
||||
#include "FourBarMechanism/CrankSliderMechanism.h"
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <cmath>
|
||||
#include "SharedGeometry.h"
|
||||
#include "SharedGeometry/SharedGeometry.h"
|
||||
// 解模式枚举
|
||||
enum class SolutionMode
|
||||
{
|
||||
@@ -98,4 +98,4 @@ void deleteSliderCrankMechanism(SliderCrankMechanism *mechanism);
|
||||
using SliderCrankMechanismPtr = std::shared_ptr<SliderCrankMechanism>;
|
||||
SliderCrankMechanismPtr createSliderCrankMechanismSmart();
|
||||
|
||||
#endif // SLIDER_CRANK_MECHANISM_H
|
||||
#endif // SLIDER_CRANK_MECHANISM_H
|
||||
@@ -16,10 +16,10 @@
|
||||
#include <functional>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include "../inc/nlohmann/json.hpp"
|
||||
#include "OPERATION.h"
|
||||
#include "SharedGeometry.h" // 包含共享的几何类
|
||||
#include "RobotConfig.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
#include "QuadrupedRobotSimulation/OPERATION.h"
|
||||
#include "SharedGeometry/SharedGeometry.h"
|
||||
#include "QuadrupedRobotSimulation/RobotConfig.hpp"
|
||||
|
||||
using json = nlohmann::json;
|
||||
|
||||
@@ -703,4 +703,4 @@ private:
|
||||
// 实用函数
|
||||
Point2D ArrayToPoint(const std::vector<double> &array);
|
||||
|
||||
#endif // BASE_CLASS_H
|
||||
#endif // BASE_CLASS_H
|
||||
@@ -2,8 +2,8 @@
|
||||
#ifndef COMPLETE_JSON_EXPORTER_H
|
||||
#define COMPLETE_JSON_EXPORTER_H
|
||||
|
||||
#include "BaseClass.h"
|
||||
#include "KinematicsSimulation.h"
|
||||
#include "QuadrupedRobotSimulation/BaseClass.h"
|
||||
#include "QuadrupedRobotSimulation/KinematicsSimulation.h"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <vector>
|
||||
@@ -48,4 +48,4 @@ private:
|
||||
static std::string DoubleToString(double value, int precision = 6);
|
||||
};
|
||||
|
||||
#endif // COMPLETE_JSON_EXPORTER_H
|
||||
#endif // COMPLETE_JSON_EXPORTER_H
|
||||
@@ -2,10 +2,10 @@
|
||||
#ifndef KINEMATICS_HELPER_H
|
||||
#define KINEMATICS_HELPER_H
|
||||
|
||||
#include "BaseClass.h"
|
||||
#include "KinematicsSimulation.h"
|
||||
#include "KinematicsReverse.h"
|
||||
#include "CompleteJsonExporter.h"
|
||||
#include "QuadrupedRobotSimulation/BaseClass.h"
|
||||
#include "QuadrupedRobotSimulation/KinematicsSimulation.h"
|
||||
#include "QuadrupedRobotSimulation/KinematicsReverse.h"
|
||||
#include "QuadrupedRobotSimulation/CompleteJsonExporter.h"
|
||||
#include <string>
|
||||
#include <memory>
|
||||
#include <chrono>
|
||||
@@ -141,4 +141,4 @@ private:
|
||||
static RobotGaitRequest LoadAndValidateJson(const std::string &jsonInput);
|
||||
};
|
||||
|
||||
#endif // KINEMATICS_HELPER_H
|
||||
#endif // KINEMATICS_HELPER_H
|
||||
@@ -12,9 +12,9 @@
|
||||
#include <optional>
|
||||
|
||||
#include "utils.h"
|
||||
#include "BaseClass.h"
|
||||
#include "OPERATION.h"
|
||||
#include "SharedGeometry.h"
|
||||
#include "QuadrupedRobotSimulation/BaseClass.h"
|
||||
#include "QuadrupedRobotSimulation/OPERATION.h"
|
||||
#include "SharedGeometry/SharedGeometry.h"
|
||||
|
||||
class ReverseKinematicsCalculator
|
||||
{
|
||||
@@ -216,4 +216,4 @@ private:
|
||||
std::vector<double> RotateVector(double angle, const std::vector<double> &vector);
|
||||
};
|
||||
|
||||
#endif // KINEMATICS_REVERSE_H
|
||||
#endif // KINEMATICS_REVERSE_H
|
||||
@@ -2,7 +2,7 @@
|
||||
#ifndef KINEMATICS_SIMULATION_H
|
||||
#define KINEMATICS_SIMULATION_H
|
||||
|
||||
#include "BaseClass.h"
|
||||
#include "QuadrupedRobotSimulation/BaseClass.h"
|
||||
#include <vector>
|
||||
#include <string>
|
||||
#include <cmath>
|
||||
@@ -198,4 +198,4 @@ private:
|
||||
std::vector<double> ShiftArray(const std::vector<double> &array, int shiftFrames);
|
||||
};
|
||||
|
||||
#endif // KINEMATICS_SIMULATION_H
|
||||
#endif // KINEMATICS_SIMULATION_H
|
||||
@@ -5,7 +5,7 @@
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <cmath>
|
||||
#include "../inc/nlohmann/json.hpp"
|
||||
#include <nlohmann/json.hpp>
|
||||
using json = nlohmann::json;
|
||||
|
||||
// 毫米转米函数
|
||||
@@ -344,4 +344,4 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
#endif // OPERATION_H
|
||||
#endif // OPERATION_H
|
||||
@@ -7,7 +7,7 @@
|
||||
#include <cmath>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
#include "OPERATION.h"
|
||||
#include "QuadrupedRobotSimulation/OPERATION.h"
|
||||
// 2D向量类
|
||||
class Vector2D
|
||||
{
|
||||
@@ -94,4 +94,4 @@ public:
|
||||
double x2, double y2);
|
||||
};
|
||||
|
||||
#endif // SHARED_GEOMETRY_H
|
||||
#endif // SHARED_GEOMETRY_H
|
||||
@@ -94,27 +94,24 @@ $compileResult = emcc `
|
||||
src/utils.cpp `
|
||||
src/math_utils.cpp `
|
||||
src/smart_json_wrapper.cpp `
|
||||
src/kdl_parser/src/kdl_parser.cpp `
|
||||
src/kdl_parser/src/joint.cpp `
|
||||
src/kdl_parser/src/link.cpp `
|
||||
src/kdl_parser/src/model.cpp `
|
||||
src/kdl_parser/src/pose.cpp `
|
||||
src/kdl_parser/src/tinystr.cpp `
|
||||
src/kdl_parser/src/tinyxml.cpp `
|
||||
src/kdl_parser/src/tinyxml2.cpp `
|
||||
src/kdl_parser/src/tinyxmlerror.cpp `
|
||||
src/kdl_parser/src/tinyxmlparser.cpp `
|
||||
src/kdl_parser/src/twist.cpp `
|
||||
src/kdl_parser/src/world.cpp `
|
||||
-I./inc `
|
||||
-I./inc/QuadrupedRobotSimulation `
|
||||
-I./inc/FourBarMechanism `
|
||||
-I./inc/SharedGeometry `
|
||||
-I./src/kdl_parser/include `
|
||||
-I./KDL/install_wasm/include `
|
||||
-I./Eigen3 `
|
||||
-I./Eigen3/eigen3 `
|
||||
-L./KDL/install_wasm/lib `
|
||||
third_party/kdl_parser/src/kdl_parser.cpp `
|
||||
third_party/kdl_parser/src/joint.cpp `
|
||||
third_party/kdl_parser/src/link.cpp `
|
||||
third_party/kdl_parser/src/model.cpp `
|
||||
third_party/kdl_parser/src/pose.cpp `
|
||||
third_party/kdl_parser/src/tinystr.cpp `
|
||||
third_party/kdl_parser/src/tinyxml.cpp `
|
||||
third_party/kdl_parser/src/tinyxml2.cpp `
|
||||
third_party/kdl_parser/src/tinyxmlerror.cpp `
|
||||
third_party/kdl_parser/src/tinyxmlparser.cpp `
|
||||
third_party/kdl_parser/src/twist.cpp `
|
||||
third_party/kdl_parser/src/world.cpp `
|
||||
-I./include `
|
||||
-I./third_party `
|
||||
-I./third_party/kdl_parser/include `
|
||||
-I./third_party/orocos_kdl/install_wasm/include `
|
||||
-I./third_party/eigen3 `
|
||||
-L./third_party/orocos_kdl/install_wasm/lib `
|
||||
-lorocos-kdl `
|
||||
-std=c++17 `
|
||||
-s WASM=1 `
|
||||
|
||||
@@ -3,8 +3,42 @@
|
||||
Write-Host "=== 重新构建 WASM 模块 ===" -ForegroundColor Cyan
|
||||
|
||||
# 设置环境
|
||||
$EmsdkPath = "E:\emsdk"
|
||||
if (-not (Test-Path $EmsdkPath)) {
|
||||
$emsdkCandidates = @()
|
||||
|
||||
if ($env:EMSDK) {
|
||||
$emsdkCandidates += $env:EMSDK
|
||||
}
|
||||
|
||||
$emsdkCandidates += "E:\emsdk"
|
||||
$emsdkCandidates += (Join-Path (Split-Path $PSScriptRoot -Parent) "..\emsdk")
|
||||
$emsdkCandidates += (Join-Path (Split-Path $PSScriptRoot -Parent) "emsdk")
|
||||
|
||||
$emccCommand = Get-Command emcc -ErrorAction SilentlyContinue
|
||||
if ($emccCommand -and $emccCommand.Source) {
|
||||
$emccSourceDir = Split-Path $emccCommand.Source -Parent
|
||||
if (Test-Path (Join-Path $emccSourceDir "emcc.ps1")) {
|
||||
$emsdkCandidates += (Split-Path (Split-Path $emccSourceDir -Parent) -Parent)
|
||||
}
|
||||
}
|
||||
|
||||
$EmsdkPath = $null
|
||||
foreach ($candidate in $emsdkCandidates | Select-Object -Unique) {
|
||||
if (-not [string]::IsNullOrWhiteSpace($candidate)) {
|
||||
try {
|
||||
if (Test-Path $candidate) {
|
||||
$resolvedCandidate = [System.IO.Path]::GetFullPath($candidate)
|
||||
if (Test-Path (Join-Path $resolvedCandidate "upstream\emscripten\emcc.ps1")) {
|
||||
$EmsdkPath = $resolvedCandidate
|
||||
break
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $EmsdkPath) {
|
||||
Write-Host "[错误] 未找到 Emscripten" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
@@ -18,7 +52,7 @@ Write-Host "[ ] 编译 WASM 模块(包含完整的运行时方法)..." -Fore
|
||||
|
||||
# 完整的编译命令
|
||||
$compileCmd = @'
|
||||
emcc src/math_utils.cpp src/smart_json_wrapper.cpp src/main.cpp -I./src -std=c++17 -s WASM=1 -s EXPORTED_FUNCTIONS='["_smart_process_json","_smart_get_function_list","_smart_get_function_info","_smart_test_match","_smart_get_version","_smart_free_string","_main"]' -s EXPORTED_RUNTIME_METHODS='["ccall","cwrap","UTF8ToString","stringToUTF8","lengthBytesUTF8","allocateUTF8","allocate","ALLOC_NORMAL","getValue","setValue"]' -s MODULARIZE=1 -s EXPORT_NAME="createSmartMathModule" -s ALLOW_MEMORY_GROWTH=1 -s ASSERTIONS=1 -O3 -o public/wasm/smart_math.js
|
||||
emcc src/math_utils.cpp src/smart_json_wrapper.cpp src/main.cpp -I./include -I./third_party -I./third_party/kdl_parser/include -I./third_party/orocos_kdl/install_wasm/include -I./third_party/eigen3 -std=c++17 -s WASM=1 -s EXPORTED_FUNCTIONS='["_smart_process_json","_smart_get_function_list","_smart_get_function_info","_smart_test_match","_smart_get_version","_smart_free_string","_main"]' -s EXPORTED_RUNTIME_METHODS='["ccall","cwrap","UTF8ToString","stringToUTF8","lengthBytesUTF8","allocateUTF8","allocate","ALLOC_NORMAL","getValue","setValue"]' -s MODULARIZE=1 -s EXPORT_NAME="createSmartMathModule" -s ALLOW_MEMORY_GROWTH=1 -s ASSERTIONS=1 -O3 -o public/wasm/smart_math.js
|
||||
'@
|
||||
|
||||
Write-Host "执行命令: $compileCmd" -ForegroundColor Gray
|
||||
|
||||
@@ -3,17 +3,60 @@
|
||||
Write-Host "=== 测试编译 ===" -ForegroundColor Cyan
|
||||
|
||||
# 设置环境
|
||||
$EmsdkPath = "E:\emsdk"
|
||||
if (-not (Test-Path $EmsdkPath)) {
|
||||
$emsdkCandidates = @()
|
||||
|
||||
if ($env:EMSDK) {
|
||||
$emsdkCandidates += $env:EMSDK
|
||||
}
|
||||
|
||||
$emsdkCandidates += "E:\emsdk"
|
||||
$emsdkCandidates += (Join-Path (Split-Path $PSScriptRoot -Parent) "..\emsdk")
|
||||
$emsdkCandidates += (Join-Path (Split-Path $PSScriptRoot -Parent) "emsdk")
|
||||
|
||||
$emccCommand = Get-Command emcc -ErrorAction SilentlyContinue
|
||||
if ($emccCommand -and $emccCommand.Source) {
|
||||
$emccSourceDir = Split-Path $emccCommand.Source -Parent
|
||||
if (Test-Path (Join-Path $emccSourceDir "emcc.ps1")) {
|
||||
$emsdkCandidates += (Split-Path (Split-Path $emccSourceDir -Parent) -Parent)
|
||||
}
|
||||
}
|
||||
|
||||
$EmsdkPath = $null
|
||||
foreach ($candidate in $emsdkCandidates | Select-Object -Unique) {
|
||||
if (-not [string]::IsNullOrWhiteSpace($candidate)) {
|
||||
try {
|
||||
if (Test-Path $candidate) {
|
||||
$resolvedCandidate = [System.IO.Path]::GetFullPath($candidate)
|
||||
if (Test-Path (Join-Path $resolvedCandidate "upstream\emscripten\emcc.ps1")) {
|
||||
$EmsdkPath = $resolvedCandidate
|
||||
break
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
continue
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $EmsdkPath) {
|
||||
Write-Host "[错误] 未找到 Emscripten" -ForegroundColor Red
|
||||
exit 1
|
||||
}
|
||||
|
||||
$env:PATH = "$EmsdkPath\upstream\emscripten;$env:PATH"
|
||||
|
||||
# 公共包含目录
|
||||
$includeArgs = @(
|
||||
'-I./include',
|
||||
'-I./third_party',
|
||||
'-I./third_party/kdl_parser/include',
|
||||
'-I./third_party/orocos_kdl/install_wasm/include',
|
||||
'-I./third_party/eigen3'
|
||||
)
|
||||
|
||||
# 测试 1: 编译 math_utils.cpp
|
||||
Write-Host "[ ] 测试编译 math_utils.cpp..." -ForegroundColor Cyan
|
||||
emcc src/math_utils.cpp -I./src -s WASM=1 -c -o test_math.o 2>&1
|
||||
emcc src/math_utils.cpp @includeArgs -s WASM=1 -c -o test_math.o 2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "[✓] math_utils.cpp 编译成功" -ForegroundColor Green
|
||||
} else {
|
||||
@@ -22,7 +65,7 @@ if ($LASTEXITCODE -eq 0) {
|
||||
|
||||
# 测试 2: 编译 smart_json_wrapper.cpp
|
||||
Write-Host "[ ] 测试编译 smart_json_wrapper.cpp..." -ForegroundColor Cyan
|
||||
emcc src/smart_json_wrapper.cpp -I./src -s WASM=1 -c -o test_wrapper.o 2>&1
|
||||
emcc src/smart_json_wrapper.cpp @includeArgs -s WASM=1 -c -o test_wrapper.o 2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "[✓] smart_json_wrapper.cpp 编译成功" -ForegroundColor Green
|
||||
} else {
|
||||
@@ -31,7 +74,7 @@ if ($LASTEXITCODE -eq 0) {
|
||||
|
||||
# 测试 3: 编译 main.cpp
|
||||
Write-Host "[ ] 测试编译 main.cpp..." -ForegroundColor Cyan
|
||||
emcc src/main.cpp -I./src -s WASM=1 -c -o test_main.o 2>&1
|
||||
emcc src/main.cpp @includeArgs -s WASM=1 -c -o test_main.o 2>&1
|
||||
if ($LASTEXITCODE -eq 0) {
|
||||
Write-Host "[✓] main.cpp 编译成功" -ForegroundColor Green
|
||||
} else {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "CrankRockingBlockMechanism_Forward.h"
|
||||
#include "FourBarMechanism/CrankRockingBlockMechanism_Forward.h"
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
@@ -477,4 +477,4 @@ string CrankRockingBlockMechanism_Forward::formatDouble(double value, int precis
|
||||
char buffer[32];
|
||||
snprintf(buffer, sizeof(buffer), "%.*f", precision, value);
|
||||
return string(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "CrankRockingBlockMechanism_Inverse.h"
|
||||
#include "FourBarMechanism/CrankRockingBlockMechanism_Inverse.h"
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
#include <stdexcept>
|
||||
@@ -258,4 +258,4 @@ string CrankRockingBlockMechanism_Inverse::getStatusText()
|
||||
trajectoryPoints.size());
|
||||
|
||||
return string(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// mechanism_simulation.cpp
|
||||
#include "CrankSliderMechanism.h"
|
||||
#include "FourBarMechanism/CrankSliderMechanism.h"
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
@@ -471,4 +471,4 @@ void deleteCrankSliderMechanism(CrankSliderMechanism *mechanism)
|
||||
CrankSliderMechanismPtr createCrankSliderMechanismSmart()
|
||||
{
|
||||
return std::make_shared<CrankSliderMechanism>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// FourBarMechanism.cpp
|
||||
#include "FourBarMechanism.h"
|
||||
#include "FourBarMechanism/FourBarMechanism.h"
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
@@ -326,4 +326,4 @@ void deleteFourBarMechanism(FourBarMechanism *mechanism)
|
||||
FourBarMechanismPtr createFourBarMechanismSmart()
|
||||
{
|
||||
return std::make_shared<FourBarMechanism>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// SliderCrankMechanism.cpp
|
||||
#include "SliderCrankMechanism.h"
|
||||
#include "FourBarMechanism/SliderCrankMechanism.h"
|
||||
#include <stdexcept>
|
||||
#include <algorithm>
|
||||
#include <cstdio>
|
||||
@@ -371,4 +371,4 @@ void deleteSliderCrankMechanism(SliderCrankMechanism *mechanism)
|
||||
SliderCrankMechanismPtr createSliderCrankMechanismSmart()
|
||||
{
|
||||
return std::make_shared<SliderCrankMechanism>();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
|
||||
#include "KinematicsHelper.h"
|
||||
#include "QuadrupedRobotSimulation/KinematicsHelper.h"
|
||||
#include "KinematicsWebAPI.h"
|
||||
#include "CrankSliderMechanism.h"
|
||||
#include "FourBarMechanism/CrankSliderMechanism.h"
|
||||
#include "URDFStrings.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// BaseClass.cpp - 修复type_error::create错误
|
||||
#include "BaseClass.h"
|
||||
#include "QuadrupedRobotSimulation/BaseClass.h"
|
||||
|
||||
// 为nlohmann/json添加std::optional支持
|
||||
namespace nlohmann
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// CompleteJsonExporter.cpp
|
||||
#include "CompleteJsonExporter.h"
|
||||
#include "BaseClass.h"
|
||||
#include "KinematicsSimulation.h"
|
||||
#include "QuadrupedRobotSimulation/CompleteJsonExporter.h"
|
||||
#include "QuadrupedRobotSimulation/BaseClass.h"
|
||||
#include "QuadrupedRobotSimulation/KinematicsSimulation.h"
|
||||
#include <algorithm>
|
||||
#include <cmath>
|
||||
#include <functional>
|
||||
@@ -711,4 +711,4 @@ std::string CompleteJsonExporter::DoubleToString(double value, int precision)
|
||||
std::ostringstream oss;
|
||||
oss << std::fixed << std::setprecision(precision) << value;
|
||||
return oss.str();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// KinematicsHelper.cpp
|
||||
#include "KinematicsHelper.h"
|
||||
#include "RobotConfig.hpp"
|
||||
#include "QuadrupedRobotSimulation/KinematicsHelper.h"
|
||||
#include "QuadrupedRobotSimulation/RobotConfig.hpp"
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
#include <iomanip>
|
||||
@@ -317,4 +317,4 @@ RobotGaitRequest KinematicsHelper::LoadAndValidateJson(const std::string &jsonIn
|
||||
std::cerr << "Error parsing JSON: " << e.what() << std::endl;
|
||||
return CreateDefaultRequest();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// KinematicsReverse.cpp
|
||||
#include "KinematicsReverse.h"
|
||||
#include "graph_utils.hpp"
|
||||
#include "RobotConfig.hpp"
|
||||
#include "QuadrupedRobotSimulation/KinematicsReverse.h"
|
||||
#include "QuadrupedRobotSimulation/graph_utils.hpp"
|
||||
#include "QuadrupedRobotSimulation/RobotConfig.hpp"
|
||||
|
||||
#include <iostream>
|
||||
#include <sstream>
|
||||
@@ -1285,4 +1285,4 @@ void ReverseKinematicsCalculator::debugPrintFinalJson(const std::vector<C_ObjSta
|
||||
std::cout << " 四元数: [" << obj.qx << ", " << obj.qy << ", "
|
||||
<< obj.qz << ", " << obj.qw << "]\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// KinematicsSimulation.cpp
|
||||
#include "CompleteJsonExporter.h"
|
||||
#include "KinematicsSimulation.h"
|
||||
#include "QuadrupedRobotSimulation/CompleteJsonExporter.h"
|
||||
#include "QuadrupedRobotSimulation/KinematicsSimulation.h"
|
||||
#include <functional>
|
||||
#include <numeric>
|
||||
#include <iomanip>
|
||||
@@ -1356,4 +1356,4 @@ std::vector<double> QuadrupedRobotSimulation::ShiftArray(const std::vector<doubl
|
||||
result[(i + shiftFrames) % array.size()] = array[i];
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "RobotConfig.hpp"
|
||||
#include "QuadrupedRobotSimulation/RobotConfig.hpp"
|
||||
// 统一的更新函数:手动从JSON更新现有对象
|
||||
RequestParameters &RequestParameters::updateFromJson(const nlohmann::json &j, RequestParameters &req_param)
|
||||
{
|
||||
@@ -843,4 +843,4 @@ bool RequestParameters::saveToFile(const std::string &filename) const
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// SharedGeometry.cpp
|
||||
#include "SharedGeometry.h"
|
||||
#include "SharedGeometry/SharedGeometry.h"
|
||||
#include <stdexcept>
|
||||
#include <cmath>
|
||||
#include <algorithm>
|
||||
@@ -208,4 +208,4 @@ C_ObjStates PoseCalculator::CalculatePoseAndQuaternion_C_ObjStates(const std::st
|
||||
c_ObjStates.qw = ToString(qw);
|
||||
|
||||
return c_ObjStates;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
#include "../src/smart_json_wrapper.h"
|
||||
#include "../include/smart_json_wrapper.h"
|
||||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
@@ -185,4 +185,4 @@ int main()
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user