Skip to content

Fix velocity validation logic and chrono API misuse#10

Merged
dfeen87 merged 6 commits intomainfrom
copilot/fix-code-bugs
Feb 13, 2026
Merged

Fix velocity validation logic and chrono API misuse#10
dfeen87 merged 6 commits intomainfrom
copilot/fix-code-bugs

Conversation

Copy link
Contributor

Copilot AI commented Feb 13, 2026

Two critical bugs identified during code review:

Velocity Validation Logic Error

Impact: Safety monitor rejects all valid positive velocities and most negative velocities

The plausibility check compared velocity components directly against MIN_VELOCITY_M_S (-20000), rejecting any value above it:

// Before: rejects all positive velocities
if (state.velocity_m_s[0] < MIN_VELOCITY_M_S ||
    state.velocity_m_s[1] < MIN_VELOCITY_M_S ||
    state.velocity_m_s[2] < MIN_VELOCITY_M_S)
    return false;

// After: validates magnitude regardless of direction
if (std::abs(state.velocity_m_s[0]) > MAX_VELOCITY_M_S ||
    std::abs(state.velocity_m_s[1]) > MAX_VELOCITY_M_S ||
    std::abs(state.velocity_m_s[2]) > MAX_VELOCITY_M_S)
    return false;

Added MAX_VELOCITY_M_S = 20000.0f constant to PropulsionPhysicsEngine class scope for consistency.

Chrono API Misuse

Impact: Compilation failure in HIL rig server

Used steady_clock::now().time_since_epoch() which doesn't exist. Changed to system_clock which provides epoch-based timestamps.

// Before: compilation error
std::chrono::steady_clock::now().time_since_epoch()

// After: valid API
std::chrono::system_clock::now().time_since_epoch()

Additional Changes

  • Added .gitignore for build artifacts and IDE files

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 5 commits February 13, 2026 16:29
Co-authored-by: dfeen87 <158860247+dfeen87@users.noreply.github.com>
Co-authored-by: dfeen87 <158860247+dfeen87@users.noreply.github.com>
Co-authored-by: dfeen87 <158860247+dfeen87@users.noreply.github.com>
Co-authored-by: dfeen87 <158860247+dfeen87@users.noreply.github.com>
Co-authored-by: dfeen87 <158860247+dfeen87@users.noreply.github.com>
Copilot AI changed the title [WIP] Review and fix bugs found in code Fix velocity validation logic and chrono API misuse Feb 13, 2026
@dfeen87 dfeen87 marked this pull request as ready for review February 13, 2026 16:33
@dfeen87 dfeen87 merged commit 0e0435f into main Feb 13, 2026
2 checks passed
@dfeen87 dfeen87 deleted the copilot/fix-code-bugs branch February 13, 2026 16:33
Copilot AI requested a review from dfeen87 February 13, 2026 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

Comments