Skip to content

[WIP] Convert LIPM walking controller to SLIP model#1

Draft
Copilot wants to merge 1 commit into
masterfrom
copilot/convert-lipm-to-slip-model
Draft

[WIP] Convert LIPM walking controller to SLIP model#1
Copilot wants to merge 1 commit into
masterfrom
copilot/convert-lipm-to-slip-model

Conversation

Copy link
Copy Markdown

Copilot AI commented Nov 17, 2025

Thanks for asking me to work on this. I will get started on it and keep this PR's description up to date as I form a plan and make progress.

Original prompt

Problem Statement

Convert the current Linear Inverted Pendulum Model (LIPM) based walking controller to a Spring-Loaded Inverted Pendulum (SLIP) model in the file sources/omnidirectional-walking.py.

Background

The current implementation uses a LIPM with ZMP preview control, which assumes a constant center of mass height. The SLIP model adds spring dynamics, allowing for more natural and energy-efficient walking with variable CoM height during stance phase.

Required Changes

1. Add SLIP Model Parameters

Replace or augment the current LIPM parameters with SLIP-specific parameters:

  • Spring stiffness (k): Spring constant for the virtual leg spring
  • Rest length (l0): Natural length of the spring/leg
  • Damping coefficient (b): Damping for energy dissipation
  • Mass (m): Robot mass (if not already defined)
  • Apex height: Target height at apex of trajectory

2. Modify Dynamics Model

Replace the LIPM dynamics (constant height assumption) with SLIP dynamics:

LIPM equations (current):

ẍ = (g/zc) * (x - px)

SLIP equations (target):

During stance phase:
- Radial: m*r̈ = -k*(r - l0) - b*ṙ + m*g*cos(θ)
- Tangential: m*r*θ̈ = -m*g*sin(θ) - b*r*θ̇

During flight phase:
- Standard ballistic motion: ẍ = 0, ÿ = 0, z̈ = -g

3. Update State Variables

Modify the state representation:

  • Current: x_x and x_y (3x1 vectors for position, velocity, acceleration in x and y)
  • New: Add vertical dynamics state including CoM height z, vertical velocity ż, leg length r, and leg angle θ

4. Replace Preview Control with SLIP Controller

The ZMP preview control assumes constant height. For SLIP:

  • Stance phase controller:

    • Control leg angle touchdown angle to regulate forward velocity
    • Control spring compression for desired apex height
    • Maintain desired CoM trajectory in horizontal plane
  • Flight phase controller:

    • Calculate ballistic trajectory
    • Determine optimal touchdown conditions (leg angle, timing)

5. Update get_preview_control() Method

Replace with SLIP control method:

def get_slip_control(self):
    # Determine phase (stance vs flight)
    # If stance:
    #   - Calculate leg length r and angle θ
    #   - Compute spring force: F_spring = k*(r - l0)
    #   - Apply damping: F_damping = b*ṙ
    #   - Update CoM position using SLIP dynamics
    # If flight:
    #   - Apply ballistic motion equations
    #   - Check for touchdown condition

6. Modify get_gait_parameter() Method

Update to load/initialize SLIP parameters instead of or in addition to LIPM parameters:

def get_gait_parameter(self, filename):
    # Load existing parameters if needed
    # Add SLIP-specific parameters:
    self.spring_k = <value>  # Spring stiffness (N/m)
    self.leg_rest_length = <value>  # Rest length (m)
    self.damping_b = <value>  # Damping coefficient
    self.robot_mass = <value>  # Robot mass (kg)
    self.apex_height = <value>  # Target apex height (m)
    self.g = 9.81  # Gravity

7. Update get_walking_pattern() Method

Modify to use SLIP dynamics:

  • Calculate stance/flight phases based on leg contact
  • Update CoM height dynamically (not constant anymore)
  • Ensure foot trajectory generation accounts for variable CoM height

8. Update Visualization

Modify the plotting section to show:

  • Variable CoM height trajectory
  • Leg spring compression/extension
  • Stance vs flight phases (different colors/markers)

Implementation Notes

  • The SLIP model has distinct stance and flight phases; implement phase detection

  • Consider using numerical integration (e.g., Runge-Kutta) for SLIP dynamics instead of discrete-time equations

  • Initial SLIP parameters suggestion:

    • k = 10000 N/m (adjust based on robot mass)
    • l0 = leg length at nominal stance
    • b = 100 Ns/m (light damping)
    • apex_height = slightly above current zc value
  • Backward compatibility: Consider keeping LIPM as an option or creating a new class inheriting from GaitController

Testing

After implementation:

  1. Verify that CoM height varies during walking cycle
  2. Check that energy is conserved approximately (with some dissipation from damping)
  3. Ensure foot trajectories remain valid with variable CoM height
  4. Compare walking patterns between LIPM and SLIP models

References

  • Geyer, H., Seyfarth, A., & Blickhan, R. (2006). "Compliant leg behaviour explains basic dynamics of walking and running"
  • Spring-Loaded Inverted Pendulum model fundamentals

File to Modify

File: sources/omnidirectional-walking.py
Commit: 015ca5f

This pull request was created as a result of the following prompt from Copilot chat.

Problem Statement

Convert the current Linear Inverted Pendulum Model (LIPM) based walking controller to a Spring-Loaded Inverted Pendulum (SLIP) model in the file sources/omnidirectional-walking.py.

Background

The current implementation uses a LIPM with ZMP preview control, which assumes a constant center of mass height. The SLIP model adds spring dynamics, allowing for more natural and energy-efficient walking with variable CoM height during stance phase.

Required Changes

1. Add SLIP Model Parameters

Replace or augment the current LIPM parameters with SLIP-specific parameters:

  • Spring stiffness (k): Spring constant for the virtual leg spring
  • Rest length (l0): Natural length of the spring/leg
  • Damping coefficient (b): Damping for energy dissipation
  • Mass (m): Robot mass (if not already defined)
  • Apex height: Target height at apex of trajectory

2. Modify Dynamics Model

Replace the LIPM dynamics (constant height assumption) with SLIP dynamics:

LIPM equations (current):

ẍ = (g/zc) * (x - px)

SLIP equations (target):

During stance phase:
- Radial: m*r̈ = -k*(r - l0) - b*ṙ + m*g*cos(θ)
- Tangential: m*r*θ̈ = -m*g*sin(θ) - b*r*θ̇

During flight phase:
- Standard ballistic motion: ẍ = 0, ÿ = 0, z̈ = -g

3. Update State Variables

Modify the state representation:

  • Current: x_x and x_y (3x1 vectors for position, velocity, acceleration in x and y)
  • New: Add vertical dynamics state including CoM height z, vertical velocity ż, leg length r, and leg angle θ

4. Replace Preview Control with SLIP Controller

The ZMP preview control assumes constant height. For SLIP:

  • Stance phase controller:

    • Control leg angle touchdown angle to regulate forward velocity
    • Control spring compression for desired apex height
    • Maintain desired CoM trajectory in horizontal plane
  • Flight phase controller:

    • Calculate ballistic trajectory
    • Determine optimal touchdown conditions (leg angle, timing)

5. Update get_preview_control() Method

Replace with SLIP control method:

def get_slip_control(self):
    # Determine phase (stance vs flight)
    # If stance:
    #   - Calculate leg length r and angle θ
    #   - Compute spring force: F_spring = k*(r - l0)
    #   - Apply damping: F_damping = b*ṙ
    #   - Update CoM position using SLIP dynamics
    # If flight:
    #   - Apply ballistic motion equations
    #   - Check for touchdown condition

6. Modify get_gait_parameter() Method

Update to load/initialize SLIP parameters instead of or in addition to LIPM parameters:

def get_gait_parameter(self, filename):
    # Load existing parameters if needed
    # Add SLIP-specific parameters:
    self.spring_k = <value>  # Spring stiffness (N/m)
    self.leg_rest_length = <value>  # Rest length (m)
    self.damping_b = <value>  # Damping coefficient
    self.robot_mass = <value>  # Robot mass (kg)
    self.apex_height = <value>  # Target apex height (m)
    self.g = 9.81  # Gravity

7. Update get_walking_pattern() Method

Modify to use SLIP dynamics:

  • Calculate stance/flight phases based on leg contact
  • Update CoM height dynamically (not constant anymore)
  • Ensure foot trajectory generation accounts for variable CoM height

8. Update Visualization

Modify the plotting section to show:

  • Variable CoM height trajectory
  • Leg spring compression/extension
  • Stance vs flight phases (different colors/markers)

Implementation Notes

  • The SLIP model has distinct stance and flight phases; implement phase detection

  • Consider using numerical integration (e.g., Runge-Kutta) for SLIP dynamics instead of discrete-time equations

  • Initial SLIP parameters suggestion:

    • k = 10000 N/m (adjust based on robot mass)
    • l0 = leg length at nominal stance
    • b = 100 Ns/m (light damping)
    • apex_height = slightly above current zc value
  • Backward compatibility: Consider keeping LIPM as an option or creating a new class inheriting from GaitController

Testing

After implementation:

  1. Verify that CoM height varies during walking cycle
  2. Check that energy is conserved approximately (with some dissipation from damping)
  3. Ensure foot trajectories remain valid with variable CoM height
  4. Compare walking patterns between LIPM and SLIP models

References

  • Geyer, H., Seyfarth, A., & Blickhan, R. (2006). "Compliant leg behaviour explains basic dynamics of walking and running"
  • Spring-Loaded Inverted Pendulum model fundamentals

File to Modify

File: sources/omnidirectional-walking.py
Commit: 015ca5f


💬 We'd love your input! Share your thoughts on Copilot coding agent in our 2 minute survey.

Copilot AI self-assigned this Nov 17, 2025
Copilot stopped work on behalf of Lexciese due to an error November 17, 2025 08:15
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