Skip to main content

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.

Metadata

Release files for kinematic-snake 1.0.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for kinematic-snake 1.0.0
File Size Uploaded
kinematic_snake-1.0.0.tar.gz 19.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for kinematic-snake 1.0.0
File Interpreter ABI Platform
kinematic_snake-1.0.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 37.7 kB

Release files / kinematic_snake-1.0.0.tar.gz

Download URL kinematic_snake-1.0.0.tar.gz
Size 19.6 kB
Tags Source
SHA-256 checksum
How to use checksums
2b86d372eff00d43f24bb891cb9c1a1d54528dfa756cfd9faba0f5cd911cdc23
BLAKE2b-256 checksum
How to use checksums
84cf12b115b1cf728ba3c49b9969d3351a17a7f7828d6ed5709df1c415e99ff6
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / kinematic_snake-1.0.0-py2.py3-none-any.whl

Download URL kinematic_snake-1.0.0-py2.py3-none-any.whl
Size 18.1 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
c0a61015e67d81079e4d7d1977425fec13d4a0c9482f12f60f3c933868c435d1
BLAKE2b-256 checksum
How to use checksums
a1adda7320b78ff07ad004e348b6c4dc122d402d61c36524465b218292eb1dba
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

1.0.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page