Skip to main content

Kinematic model of snake-locomotion, with and without friction modulation

Project description

Snake Locomotion Kinematics · CI license pyversion

A kinematic model of snake-locomotion, with and without lifting, following our publication. Can run single specified cases or many independent cases in parallel to generate a phase-space.

:rocket: Before installing the package, check out an interactive, online version at this link.

Installation

For a system wide install, use

python3 -m pip install kinematic-snake

For a local install, please clone this repository and execute the following in the repository directory.

python3 -m pip install --user .

You can then use one of the examples for running a single simulation or a parameter sweep of simulations. For more information see Usage and examples

Extras

If you want to take full advantage of the package (such as running a phase-space of cases in parallel), please execute

python3 -m pip install kinematic-snake[extras]

Usage and examples

The simplest example runs a single simulation and produces output plots. For convenience, the same code is also listed below.

from kinematic_snake import run_and_visualize, Snake

snake, sol_history, time_period = run_and_visualize(
    froude=1, # The froude number
    time_interval=[0.0, 10.0], # Time interval of simulation
    snake_type=Snake, # Type of snake, can be Snake
    mu_f=1.0, # Forward friction coefficient ratio, determined from `froude`
    mu_b=1.5, # Backward friction coefficient
    mu_lat=2.0, # Lateral friction coefficient
)

More examples including the one above are given in that example file. The code is designed to encourage the user to play around with the model of the snake using any activation function (for both the snake gait, specified by curvature, and the lifting). The documented examples provided in the examples folder should get you started.

Numerical algorithms

Details on the algorithms employed can be found in our following paper. If you are using this package, please cite the work below :)

Friction modulation in limbless, three-dimensional gaits and heterogeneous terrains, doi : 10.1038/s41467-021-26276-x

@Article{Zhang2021,
author={Zhang, Xiaotian
and Naughton, Noel
and Parthasarathy, Tejaswin
and Gazzola, Mattia},
title={Friction modulation in limbless, three-dimensional gaits and heterogeneous terrains},
journal={Nature Communications},
year={2021},
month={Oct},
day={19},
volume={12},
number={1},
pages={6076},
issn={2041-1723},
doi={10.1038/s41467-021-26276-x},
url={https://doi.org/10.1038/s41467-021-26276-x}
}

Running tests

Check Installation to see how to install the package. Once that is done, install the test requirements using

python3 -m pip install -r tests/requirements.txt

This package uses py.test for running unit and integration tests. To run the tests, execute

python3 -m pytest

from the repository directory.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

kinematic_snake-1.0.0.tar.gz (19.6 kB view details)

Uploaded Source

Built Distribution

kinematic_snake-1.0.0-py2.py3-none-any.whl (18.1 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file kinematic_snake-1.0.0.tar.gz.

File metadata

  • Download URL: kinematic_snake-1.0.0.tar.gz
  • Upload date:
  • Size: 19.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.6

File hashes

Hashes for kinematic_snake-1.0.0.tar.gz
Algorithm Hash digest
SHA256 2b86d372eff00d43f24bb891cb9c1a1d54528dfa756cfd9faba0f5cd911cdc23
MD5 8b754ade8f193480d5e34528ffc33239
BLAKE2b-256 84cf12b115b1cf728ba3c49b9969d3351a17a7f7828d6ed5709df1c415e99ff6

See more details on using hashes here.

File details

Details for the file kinematic_snake-1.0.0-py2.py3-none-any.whl.

File metadata

  • Download URL: kinematic_snake-1.0.0-py2.py3-none-any.whl
  • Upload date:
  • Size: 18.1 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.10.0 pkginfo/1.8.2 requests/2.25.0 requests-toolbelt/0.9.1 tqdm/4.54.0 CPython/3.9.6

File hashes

Hashes for kinematic_snake-1.0.0-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c0a61015e67d81079e4d7d1977425fec13d4a0c9482f12f60f3c933868c435d1
MD5 987e58a42109b3c65a3dd9b57ec3bae1
BLAKE2b-256 a1adda7320b78ff07ad004e348b6c4dc122d402d61c36524465b218292eb1dba

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page