Skip to content

Commit

Permalink
Documentation integration.
Browse files Browse the repository at this point in the history
This version does not bring changes in code, but improved
documentation a lot. This alpha version 0.1.3 mainly focuses on
the integration of GitHub pages, and we also switched the classic
Read the docs theme.
  • Loading branch information
HugoFara committed Jul 10, 2021
1 parent 6ca4107 commit ede7a1d
Show file tree
Hide file tree
Showing 63 changed files with 5,018 additions and 1,150 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,12 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]

## [0.1.3-alpha] - 2021-07-10
This package was lacking real documentation, it is fixed in this version.
### Added
- Sphinx documentation!
- Web site hosted on GitHub pages, check [hugofara.github.io/leggedsnake](https://hugofara.github.io/leggedsnake/)!

### Changed
- Tests moved from ``leggedsnake/tests`` to ``tests/``.
Expand Down
1 change: 1 addition & 0 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
include README.md
include LICENSE
include CODE_OF_CONDUCT.md
include docs/*
29 changes: 19 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
[![PyPI version fury.io](https://badge.fury.io/py/leggedsnake.svg)](https://pypi.python.org/pypi/leggedsnake/)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg )](https://raw.githubusercontent.com/HugoFara/leggedsnake/main/LICENSE.rst)
# leggedsnake
LeggedSnake is a project intended to make the simulation of walking linkages fast and easy. We believe that building walking linkages is fun and could be useful. Our philosophy is to provide a quick way of building, optimizing and testing walking linkages.

LeggedSnake is a Python library providing reliable computationnal techniques to build, simulate and optimize planar [leg mechanisms](https://en.wikipedia.org/wiki/Leg_mechanism). It is divided in three main parts:
* Linkage conception in simple Python and kinematic optimization relying on [pylinkage](https://github.com/HugoFara/pylinkage).
* Leg mechanism definition, with ``Walker`` heriting from the ``Linkage`` class.
* Dynamic simulation and its optimization thanks to genetic algorithms.
We handle planar [leg mechanisms](https://en.wikipedia.org/wiki/Leg_mechanism) in three main parts:
* Linkage conception in simple Python relying on [pylinkage](https://github.com/HugoFara/pylinkage).
* Kinematic optimization with ``Walker`` class, inheriting from pylinkage's ``Linkage`` class.
* Dynamic simulation and its optimization using genetic algorithms.

## Quick links
* For the documentation, check the docs at [hugofara.github.io/leggedsnake](https://hugofara.github.io/leggedsnake/)!
* Source code is hosted on GitHub as [HugoFara/leggedsnake](https://github.com/HugoFara/leggedsnake)
* We also provide a Python package on PyPi, test [leggedsnake](https://pypi.org/project/leggedsnake/).
* If you just want to chill out looking at walking linkages striving to survive, join the [discussions](https://github.com/HugoFara/leggedsnake/discussions).

Contributors are welcome!

## Installation
### Using pip
Expand All @@ -27,7 +36,7 @@ Dynamic optimization relies on multiple packages. First of all it uses [Pymunk](

## Usage

The demo script is [strider.py](https://github.com/HugoFara/leggedsnake/blob/main/leggedsnake/examples/strider.py), which demonstrates all the techniques about the [Strider linkage](https://www.diywalkers.com/strider-linkage-plans.html).
The demo script is [strider.py](https://github.com/HugoFara/leggedsnake/blob/main/docs/examples/strider.py), which demonstrates all the techniques about the [Strider linkage](https://www.diywalkers.com/strider-linkage-plans.html).

### Defining a ``Walker``
First, you need to define joints for your ``Walker`` as described in [pylinkage](https://github.com/HugoFara/pylinkage) documentation. Once your joints (let's say they are in a joint object), you should have something like that:
Expand Down Expand Up @@ -98,12 +107,12 @@ def dynamic_linkage_fitness(walker):
And now, relax while your computer recreates a civilisation of walking machines!

### Visualization
For this part we will focus on the [Strider linkage](https://www.diywalkers.com/strider-linkage-plans.html), an exemple file is provided at ``docs/source/examples/strider.py``. The linkage looks like this:
![A Kinematic representation of Strider linkage](https://github.com/HugoFara/leggedsnake/raw/master/docs/source/examples/images/Kinematic%20unoptimized%20Strider.gif)
For this part we will focus on the [Strider linkage](https://www.diywalkers.com/strider-linkage-plans.html), an exemple file is provided at ``docs/examples/strider.py``. The linkage looks like this:
![A Kinematic representation of Strider linkage](https://github.com/HugoFara/leggedsnake/raw/master/docs/examples/images/Kinematic%20unoptimized%20Strider.gif)

Looks cool? Let's simulate it dynamically!

![Dynamic one-leg-pair Strider being tested](https://github.com/HugoFara/leggedsnake/raw/master/docs/source/examples/images/Dynamic%20unoptimized%20one-legged%20Strider.gif)
![Dynamic one-leg-pair Strider being tested](https://github.com/HugoFara/leggedsnake/raw/master/docs/examples/images/Dynamic%20unoptimized%20one-legged%20Strider.gif)

Oops! Here is what you get when you forget to add more legs! There is **real danger here**, because your walker crawls well, you will be able to optimize efficiently the "crawler", *which may be not your goal*.

Expand All @@ -115,12 +124,12 @@ my_linkage.add_legs(3) # Replace "my_linkage" with your Walker object
```
Let's have a look at the artist:

![Dynamic four-leg-pair unoptimized Strider](https://github.com/HugoFara/leggedsnake/raw/master/docs/source/examples/images/Dynamic%20unoptimized%20strider.gif)
![Dynamic four-leg-pair unoptimized Strider](https://github.com/HugoFara/leggedsnake/raw/master/docs/examples/images/Dynamic%20unoptimized%20strider.gif)

## Advice
Use the vizualisation tools provided! The optimization tools should always give you a score with a better fitness, but it might not be what you expected. Tailor your optimization and *then* go for a long run will make you save a lot of time.

**Do not** use optimized linkages from the start! The risk is to fall to quickly into a suboptimal solution. They are several mechanisms to prevent that (starting from random position), however it can always have an impact on the rest of the optimization.

Try to minimize the number of elements in the optimizations! You can often use some linkage's properties to reduce the number of simulation parameters. For instance, the Strider linkage has an axial symmetry. While it is irrelevant to use this property in dynamic simulation, you can use "half" your Strider in a kinematic optimization, which is much faster:
![A Kinematic half Strider](https://github.com/HugoFara/leggedsnake/raw/master/docs/source/examples/images/Kinematic%20half-Strider.gif)
![A Kinematic half Strider](https://github.com/HugoFara/leggedsnake/raw/master/docs/examples/images/Kinematic%20half-Strider.gif)
2 changes: 1 addition & 1 deletion docs/.buildinfo
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Sphinx build info version 1
# This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done.
config: 0b01ba4c14c3a169a4bef6ad4f2084c8
config: 86302c9050715ad45e2b24fdc1cc0046
tags: 645f666f9bcd5a90fca523b33c5a78b7
1 change: 0 additions & 1 deletion docs/_sources/index.rst.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Welcome to LeggedSnake's documentation!
api/dynamiclinkage
api/physicsengine
api/geneticoptimizer
licenselink

.. mdinclude::
../../README.md
Expand Down
1 change: 1 addition & 0 deletions docs/_static/css/badge_only.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions docs/_static/css/theme.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/_static/documentation_options.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
var DOCUMENTATION_OPTIONS = {
URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'),
VERSION: '0.1.2-alpha',
VERSION: '0.1.3-alpha',
LANGUAGE: 'None',
COLLAPSE_INDEX: false,
BUILDER: 'html',
Expand Down
Binary file added docs/_static/fonts/Inconsolata-Bold.ttf
Binary file not shown.
Binary file added docs/_static/fonts/Inconsolata-Regular.ttf
Binary file not shown.
Binary file added docs/_static/fonts/Inconsolata.ttf
Binary file not shown.
Binary file added docs/_static/fonts/Lato-Bold.ttf
Binary file not shown.
Binary file added docs/_static/fonts/Lato-Regular.ttf
Binary file not shown.
Binary file added docs/_static/fonts/Lato/lato-bold.eot
Binary file not shown.
Binary file added docs/_static/fonts/Lato/lato-bold.ttf
Binary file not shown.
Binary file added docs/_static/fonts/Lato/lato-bold.woff
Binary file not shown.
Binary file added docs/_static/fonts/Lato/lato-bold.woff2
Binary file not shown.
Binary file added docs/_static/fonts/Lato/lato-bolditalic.eot
Binary file not shown.
Binary file added docs/_static/fonts/Lato/lato-bolditalic.ttf
Binary file not shown.
Binary file added docs/_static/fonts/Lato/lato-bolditalic.woff
Binary file not shown.
Binary file added docs/_static/fonts/Lato/lato-bolditalic.woff2
Binary file not shown.
Binary file added docs/_static/fonts/Lato/lato-italic.eot
Binary file not shown.
Binary file added docs/_static/fonts/Lato/lato-italic.ttf
Binary file not shown.
Binary file added docs/_static/fonts/Lato/lato-italic.woff
Binary file not shown.
Binary file added docs/_static/fonts/Lato/lato-italic.woff2
Binary file not shown.
Binary file added docs/_static/fonts/Lato/lato-regular.eot
Binary file not shown.
Binary file added docs/_static/fonts/Lato/lato-regular.ttf
Binary file not shown.
Binary file added docs/_static/fonts/Lato/lato-regular.woff
Binary file not shown.
Binary file added docs/_static/fonts/Lato/lato-regular.woff2
Binary file not shown.
Binary file added docs/_static/fonts/RobotoSlab-Bold.ttf
Binary file not shown.
Binary file added docs/_static/fonts/RobotoSlab-Regular.ttf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file added docs/_static/fonts/fontawesome-webfont.eot
Binary file not shown.
Loading

0 comments on commit ede7a1d

Please sign in to comment.