Skip to content

Comments

Fix kinodynamic planning for A1#423

Merged
dellaert merged 7 commits intomasterfrom
fix/walking3
Feb 18, 2026
Merged

Fix kinodynamic planning for A1#423
dellaert merged 7 commits intomasterfrom
fix/walking3

Conversation

@dellaert
Copy link
Member

@dellaert dellaert commented Feb 17, 2026

Changes from #421 that were accidentally deleted by Copilot.

Behavior change

  • contact height is now specified in world frame
  • made tests exercise this with hieight=4.2

Smaller things

  • made a Spline class for easier reading of example
  • switched to 24 frames per second
  • renamed Poe3Factor to Poe3Expression
  • generate python stubs
  • added to README

New motion planning notebook

  • added notebook examples/example_a1_walking/chain_dynamics_motion_planning.ipynb
  • exposed much in wrapper to make it possible

Nice swing phases obtained entirely by kino-dynamic MP:
image

and trunk xyz:
image

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR restores changes from #421 that were accidentally deleted, fixing kinodynamic planning functionality for the A1 quadruped robot. The primary fix involves properly handling ground plane height throughout the dynamics and kinematics stack.

Changes:

  • Added explicit ground_plane_height parameter to dynamics and kinematics methods to properly handle contact constraints
  • Updated test cases to use non-zero ground heights to verify the fix
  • Added Python bindings for chain dynamics classes and improved the SWIG interface

Reviewed changes

Copilot reviewed 28 out of 29 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
gtdynamics/utils/WalkCycle.cpp Fixed ground height calculation to preserve nominal x/y coordinates while setting z to requested world height
gtdynamics/dynamics/DynamicsGraph.h/cpp Added ground_plane_height parameter to dynamics factor graph methods
gtdynamics/dynamics/ChainDynamicsGraph.h/cpp Propagated ground plane height through chain dynamics, renamed Poe3Factor to Poe3Expression, cleaned up variable naming
gtdynamics/kinematics/Kinematics.h Added ground_plane_height parameter to kinematics methods
gtdynamics/kinematics/ContactHeightFactor.h Updated documentation to clarify ground-plane height enforcement
tests/test*.cpp Updated tests to use non-zero ground height constant for validation
gtdynamics.i Added Python bindings for chain dynamics classes and constraint specs
python/gtdynamics/preamble/gtdynamics.h Added pybind11 opaque type declarations
examples/example_a1_walking/chain_dynamics_motion_planning.ipynb New Python notebook demonstrating chain dynamics motion planning
examples/example_quadruped_mp/main.cpp Refactored spline computation into Spline struct for better encapsulation

torques[:,2] = np.array(all_torques_upper)
torques[:,3] = np.array(all_torques_lower)
np.savetxt('/home/dan/Desktop/Projects/GTDynamics/build/examples/example_a1_walking/torques_pyb.txt', torques)
np.savetxt('torques_pyb.txt', torques)
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hardcoded file path was replaced with a relative path, but there's no guarantee this file will be writable in the current working directory. Consider using a dedicated output directory or making the path configurable.

Copilot uses AI. Check for mistakes.
InsertPose(&values, link->id(), link->bMcom());
for (auto &&joint : robot.joints())
InsertJointAngle(&values, joint->id(), 0.0);
InsertJointAngle(&values, joint->id(), 1.0);
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The initial joint angle was changed from 0.0 to 1.0 without explanation. This magic number should be documented or made a named constant to clarify why this specific value is used for initialization.

Copilot uses AI. Check for mistakes.
// Set parameters for optimizer
gtsam::LevenbergMarquardtParams params;
params.setMaxIterations(50);
// params.setMaxIterations(50);
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commented-out code should either be removed or explained with a comment indicating why it's disabled and under what conditions it should be re-enabled.

Suggested change
// params.setMaxIterations(50);

Copilot uses AI. Check for mistakes.
writer.writerow(tposes, results, k);
curr_t = curr_t + dt;
k = k + 1;
// break;
Copy link

Copilot AI Feb 17, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This commented-out break statement appears to be debug code and should be removed before merging to production.

Suggested change
// break;

Copilot uses AI. Check for mistakes.
@dellaert dellaert merged commit 346db16 into master Feb 18, 2026
12 checks passed
@dellaert dellaert deleted the fix/walking3 branch February 18, 2026 00:06
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.

1 participant