add forward projectors for all three kinematic models - #9
Open
zeerekahmad wants to merge 1 commit into
Open
Conversation
Introduces BicycleProjector, ArticulatedProjector and DifferentialDriveProjector: forward simulation that ramps the actuator command toward a target under a rate or acceleration limit, clamps it to the configured range, and integrates pose with Euler. Each exposes step() for one time step and project() for a full horizon, returning a timestamped state sequence whose element 0 is the initial state. Shared 2D geometry lands in pose2d.hpp: Pose2D, Point2D, Footprint (a CCW, unclosed polygon of any vertex count), normalizeAngle, transformFootprint, offsetAlongHeading and rectangleFootprint. Projectors optionally carry a body-frame polygon and emit it transformed into the world frame per sample, so the kinematic models stay dimension-free. AxleReference selects which axle the bicycle and articulated projectors measure poses and footprints from. Motion is still integrated where each model is naturally defined (the rear axle) and converted on input and output, so no integration accuracy is traded for the choice. ArticulatedModel gains an explicit articulation turning velocity (gamma-dot) on bodyVelocityToVehicleState and articulationToAxleVelocities, replacing the hardcoded zero constant. The two-argument forms remain as overloads assuming steady articulation, so existing callers are unaffected. Those overloads make the existing bindings ambiguous: kinematics_pybind.cpp passed bare member-function pointers, which no longer resolve once a second overload exists. Both bindings move to py::overload_cast on the three-argument form and expose gamma-dot as a keyword argument defaulting to 0.0, so Python callers keep the two-argument call and gain the rate. catch_discover_tests switches to DISCOVERY_MODE PRE_TEST. The default POST_BUILD runs each test binary during the build, where an older installed libpolymath_kinematics.so wins on LD_LIBRARY_PATH. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PR: add forward projectors for all three kinematic models
zeerekahmad/kinematics-projectorszeerekahmad/lint-precommit-cleanup958c561Description
Introduces forward projection for all three kinematic models: simulation that ramps the actuator command
toward a target under a rate or acceleration limit, clamps it to the configured range, and integrates pose
with Euler. Each projector exposes
step()for one time step andproject()for a full horizon, returning atimestamped state sequence whose element 0 is the initial state.
BicycleProjector,ArticulatedProjectorandDifferentialDriveProjector, with Catch2 coverage for each.pose2d.hpp:Pose2D,Point2D,Footprint(a CCW, unclosed polygon of any vertexcount),
normalizeAngle,transformFootprint,offsetAlongHeadingandrectangleFootprint. Projectorsoptionally carry a body-frame polygon and emit it transformed into the world frame per sample, so the
kinematic models stay dimension-free.
AxleReferenceselects which axle the bicycle and articulated projectors measure poses and footprints from.Motion is still integrated where each model is naturally defined (the rear axle) and converted on input and
output, so no integration accuracy is traded for the choice.
ArticulatedModelgains an explicit articulation turning velocity (gamma-dot) onbodyVelocityToVehicleStateandarticulationToAxleVelocities, replacing the hardcoded zero constant. Thetwo-argument forms remain as overloads assuming steady articulation, so existing callers are unaffected.
kinematics_pybind.cpppassed bare member-functionpointers, which no longer resolve once a second overload exists. Both bindings move to
py::overload_caston the three-argument form and expose gamma-dot as a keyword argument defaulting to 0.0, so Python callers
keep the two-argument call and gain the rate.
catch_discover_testsswitches toDISCOVERY_MODE PRE_TEST. The defaultPOST_BUILDruns each test binaryduring the build, where an older installed
libpolymath_kinematics.sowins onLD_LIBRARY_PATH.Migration Guide
None required — the additions are source and binary compatible. The two-argument C++ overloads and the
two-argument Python calls behave exactly as before (steady articulation, gamma-dot = 0).
Related issues
Completeness checklist
Stack created with GitHub Stacks CLI • Give Feedback 💬