Simulation - sim/: the unchanged robot firmware compiled into hexapod_sim.dll against PC stand-ins (Arduino, Servo, Wire + register-level MPU6050, RF24 with matching-config radio), a kinematic body model (support plane + planted-foot odometry) that also drives the simulated IMU, and a headless smoke test (sim_smoke). build.ps1 builds and tests. - Hexapod_Simulation_Unity/ folded in (history kept in a bundle outside the repo). Assets/HexapodSim loads the DLL, drives the existing leg rig, and offers joystick / keyboard / robot-serial input plus a test panel. Robot (all found or confirmed in the simulation) - Config.h geometry taken from the Unity model. - IK femur elevation sign, gait stance direction, body pose rotation direction, yaw lever arm. - Stance feet integrated from the current command; gait restarts at mid-stance; heading integrates the applied turn rate, only while walking. - Leg clearance and reach checks (Limits::feetFeasible); walk command and body pose scaled as a whole, pose scale rate-limited, planted feet guarded so the body never snaps or legs collide. - Robot-gyro self-leveling as an integrator. - Heading mode: steering relative to the body; S walks backward. - Standing height from the remote (STANCE_HEIGHT_RANGE_MM). Protocol v3 (reflash both boards) - CmdPacket gains body_height (22 bytes). Remote - Height slider (Nextion hHeight/nHeight, serial [ ]). - Fixed unspecified I2C read order in RemoteIMU. LEGACY/: owner's old Nextion HMI and remote hardware assets. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
43 lines
1.4 KiB
PowerShell
43 lines
1.4 KiB
PowerShell
# Builds the firmware simulation DLL and runs the headless smoke test.
|
|
# Windows PowerShell 5.1 compatible. From the repo root:
|
|
#
|
|
# .\sim\build.ps1 configure (first time) + build + smoke test
|
|
# .\sim\build.ps1 -NoTest build only
|
|
# .\sim\build.ps1 -Clean wipe sim\build first
|
|
#
|
|
# Output: sim\build\hexapod_sim.dll (loaded by the Unity project) and
|
|
# sim\build\sim_smoke.exe. Exit code = build failure (1) or failed checks.
|
|
param(
|
|
[switch]$NoTest,
|
|
[switch]$Clean
|
|
)
|
|
$ErrorActionPreference = 'Stop'
|
|
|
|
$simDir = $PSScriptRoot
|
|
$buildDir = Join-Path $simDir 'build'
|
|
|
|
# g++/cmake/ninja: use what's on PATH, else Strawberry Perl's bundled toolchain.
|
|
if (-not (Get-Command cmake -ErrorAction SilentlyContinue) -or -not (Get-Command g++ -ErrorAction SilentlyContinue)) {
|
|
$strawberry = 'C:\Strawberry\c\bin'
|
|
if (Test-Path $strawberry) {
|
|
$env:PATH = "$strawberry;$env:PATH"
|
|
} else {
|
|
Write-Error 'cmake and g++ not found. Install Strawberry Perl (bundles g++, cmake, ninja) or add a MinGW-w64 toolchain to PATH.'
|
|
}
|
|
}
|
|
|
|
if ($Clean -and (Test-Path $buildDir)) { Remove-Item $buildDir -Recurse -Force }
|
|
|
|
if (-not (Test-Path (Join-Path $buildDir 'build.ninja'))) {
|
|
cmake -S $simDir -B $buildDir -G Ninja -DCMAKE_BUILD_TYPE=Release
|
|
if ($LASTEXITCODE -ne 0) { exit 1 }
|
|
}
|
|
|
|
cmake --build $buildDir
|
|
if ($LASTEXITCODE -ne 0) { exit 1 }
|
|
|
|
if (-not $NoTest) {
|
|
& (Join-Path $buildDir 'sim_smoke.exe')
|
|
exit $LASTEXITCODE
|
|
}
|