Skip to content

PyBullet simulation to test gait strategies for my hexapod robot

Notifications You must be signed in to change notification settings

ggldnl/Hexapod-Simulation

Repository files navigation

Hexapod Simulation

This repository includes the code to simulate the hexapod in a PyBullet environment.

For a complete overview of the project, refer to the main Hexapod repository.

🛠️ Build and deployment

  1. Clone the repository:

     git clone --recursive https://github.com/ggldnl/Hexapod-Simulation.git
  2. Create a conda environment:

    mamba env create -f environment.yml
    mamba activate hexapod-sim

🚀 Delpoy

  • showcase_animations.py will show the hexapod performing a set of predefined actions.

    python simulation/showcase_animations.py

    actions

  • showcase_gaits.py will show the hexapod move with different gait strategies.

    python simulation/showcase_gaits.py
  • showcase_sinusoidal_signal_gaits.py will show the hexapod move with open-loop gaits based on sinusoidal signals as described in the paper "Robots that can adapt like animals" by Cully et al., Nature, 2015. In this approach, each joint is controlled by a periodic signal defined by:

    • amplitude (range of motion);
    • phase (relative timing of the movement in a period);
    • duty cycle (proportion of time de movement lasts);

    Since no high-level controller is involved, I set the range of motion of each joint to [-90, 90] degs. The signals are centered at 0 and have values in range [-1, 1] and they get mapped to the joint range scaled by the amplitude. There is no way of changing the center of the signal. This is a problem if we need the output joint values to have a different range (e.g. legs not parallel -> coxas will need different ranges to produce coordinated motion). For this reason I introduced another parameter for the signal generation:

    • vertical shift (center of the signal);

    In my opinion, while there are undoubtedly advantages to using this approach (as described in the paper), this control strategy is difficult to use and adapt and I think other approaches might be worth exploring.

      python simulation/showcase_sinusoidal_signal_gaits.py

    actions

    Note: motion feels a little jerky but this is definitely my fault and can probably be solved by better tuning the gait parameters. I have no plan to continue working on this kind of gait strategy.

You can even run the hexapod.py file to plot the kinematic structure of the robot.

🤝 Contribution

Feel free to contribute by opening issues or submitting pull requests. For further information, check out the main Hexapod repository. Give a ⭐️ to this project if you liked the content.

About

PyBullet simulation to test gait strategies for my hexapod robot

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages