Skip to content

Commit

Permalink
Merge pull request #111 Fix build error, update css paths, bump versi…
Browse files Browse the repository at this point in the history
…ons, update readme
  • Loading branch information
mithi authored Jan 5, 2021
2 parents d4a9f7b + 4d0bdb0 commit e997b19
Show file tree
Hide file tree
Showing 6 changed files with 36 additions and 76 deletions.
46 changes: 9 additions & 37 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[![](https://img.shields.io/badge/Buy%20me%20-coffee!-orange.svg?logo=buy-me-a-coffee&color=795548)](https://ko-fi.com/minimithi)
[![Build Status](https://travis-ci.com/mithi/hexapod-robot-simulator.svg?branch=master)](https://travis-ci.com/github/mithi/hexapod-robot-simulator)
[![Build Status](https://travis-ci.com/mithi/hexapod-robot-simulator.svg?branch=master)](https://travis-ci.com/github/mithi/hexapod-robot-simulator)
[![codecov](https://codecov.io/gh/mithi/hexapod-robot-simulator/branch/master/graph/badge.svg)](https://codecov.io/gh/mithi/hexapod-robot-simulator)
[![Code Climate](https://codeclimate.com/github/mithi/hexapod-robot-simulator/badges/gpa.svg)](https://codeclimate.com/github/mithi/hexapod-robot-simulator)
[![](https://img.shields.io/codeclimate/tech-debt/mithi/hexapod-robot-simulator)](https://codeclimate.com/github/mithi/hexapod-robot-simulator/trends/technical_debt)
[![HitCount](https://hits.dwyl.com/mithi/hexapod-robot-simulator.svg)](https://hits.dwyl.com/mithi/hexapod-robot-simulator)
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](./LICENSE)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![PRs welcome!](https://img.shields.io/badge/contributions-welcome-orange.svg?style=flat)](https://github.com/mithi/hexapod-robot-simulator/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![PRs welcome!](https://img.shields.io/badge/contributions-welcome-orange.svg?style=flat)](https://github.com/mithi/hexapod-robot-simulator/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
[![first-timers-only](https://img.shields.io/badge/first--timers--only-friendly-blueviolet.svg?style=flat)](https://www.firsttimersonly.com/)

# Mithi's Hexapod Robot Simulator
Expand All @@ -20,7 +20,7 @@

# Announcement

You might be interested in checking out my [rewrite in Javascript](http://github.com/mithi/hexapod), live at: https://hexapod.netlify.app/ , which is like 10000000x faster. If you'd like tobuild you're own user interface with Node, you can download the algorithm alone as a package in the npm registry: [Hexapod Kinematics Library](https://github.com/mithi/hexapod-kinematics-library). There is also [a "fork" modified where you can use the app to control a physical hexapod robot](https://github.com/mithi/hexapod-irl) as you can see in the gif below.
You might be interested in checking out my [rewrite in Javascript](http://github.com/mithi/hexapod), live at: https://hexapod.netlify.app/ , which is like 10000000x faster. If you'd like to build you're own user interface with Node, you can download the algorithm alone as a package in the npm registry: [Hexapod Kinematics Library](https://github.com/mithi/hexapod-kinematics-library). There is also [a "fork" modified where you can use the app to control a physical hexapod robot](https://github.com/mithi/hexapod-irl) as you can see in the gif below.

<p align="center">
<img src="https://user-images.githubusercontent.com/1670421/103467765-451a2180-4d8d-11eb-8f94-1a23201595b9.gif" alt="drawing" />
Expand Down Expand Up @@ -50,9 +50,9 @@ You might be interested in checking out my [rewrite in Javascript](http://github
## Requirements

- [x] Python 3.8.1
- [x] Plotly Dash 1.10.0
- [x] Plotly Dash Daq 0.4.0
- [x] Numpy 1.18.1
- [x] Plotly Dash 1.18.1
- [x] Plotly Dash Daq 0.5.0
- [x] Numpy 1.19.5
- [x] See also [./requirements.txt](./requirements.txt)

## Run
Expand All @@ -65,42 +65,14 @@ Running on http://127.0.0.1:8050/
- Modify default settings with [./settings.py](./settings.py)
- Dark Mode is the default - modify page styles with [./style_settings.py](./style_settings.py)

## ⚠️ Known Issues

- [ ][Good First Issue](https://github.com/mithi/hexapod-robot-simulator/issues?q=is%3Aissue+is%3Aopen+label%3A%22good+first+issue%22)
- [ ][Help Wanted](https://github.com/mithi/hexapod-robot-simulator/issues?q=is%3Aissue+is%3Aopen+label%3A%22help+wanted%22)
- [ ][Bugs](https://github.com/mithi/hexapod-robot-simulator/issues?q=is%3Aissue+is%3Aopen+label%3Abug)
- [ ][All](https://github.com/mithi/hexapod-robot-simulator/issues)

## Screenshots

| ![Kinematics](https://mithi.github.io/robotics-blog/v2-kinematics-screenshot.png)|
|---|
| ![IK](https://mithi.github.io/robotics-blog/v2-ik-screenshot.png)|

## Conventions and Algorithms

- Definitions
- [`Linkage`](./hexapod/linkage.py)
- [`VirtualHexapod`](./hexapod/models.py)
- The [Inverse Kinematics Algorithm](./hexapod/ik_solver/README.md) used for this project
- How to find the orientation of the hexapod with respect to the ground given we know all the orientations of the six legs with respect to the robot's body.
- [Algorithm 1](./hexapod/ground_contact_solver/ground_contact_solver.py) when we know which of the three points of each leg could contact the ground
- [Algorithm 2](./hexapod/ground_contact_solver/ground_contact_solver2.py) when we **don't** know which of points of which legs could be in contact with the ground
- [How to make the hexapod step on the correct target ground contacts](./hexapod/ik_solver/recompute_hexapod.py)
- How to determine if the hexapod should twist and by how much
- [`find_if_might_twist`](./hexapod/models.py#L248)
- [`find_twist_frame`](./hexapod/models.py#L273)

## Notes

- Now live on https://hexapod-robot-simulator.herokuapp.com ! **BUT** (and a big one) I highly suggest that you run it locally. When run locally, it's pretty speedy! On the other hand, the link above is barely usable.

- This implementation uses matrices, **NOT** quaternions. I'm aware that quaternions is far superior in every single way. In the (un)forseeable future, maybe?

- Honestly, [my Inverse Kinematics algorithm](./hexapod/ik_solver/README.md) and [orientation algorithm](./hexapod/ground_contact_solver) is just something I came up with based on what I remember back in college plus browsing through the [Mathematics Stack Exchange](https://math.stackexchange.com/). It's just the most intuitive that I can think of. If you want something closer to the state-of-the-art, maybe checkout [Unity's Fast IK](https://assetstore.unity.com/packages/tools/animation/fast-ik-139972) or [ROS IKFast](http://wiki.ros.org/Industrial/Tutorials/Create_a_Fast_IK_Solution).

- Don't be mean! [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v2.0%20adopted-ff69b4.svg)](https://www.contributor-covenant.org/)
## More Information
Check the [Wiki](https://github.com/mithi/hexapod-robot-simulator/wiki/Notes) for more additional information

## 🤗 Contributors

Expand Down
2 changes: 1 addition & 1 deletion hexapod/ik_solver/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@


def cant_reach_alert_msg(leg_name, problem):
msg = f"Cannot reach target ground point.\n"
msg = "Cannot reach target ground point.\n"
if problem == "femur":
msg += f"Femur length of {leg_name} leg is too long."
if problem == "tibia":
Expand Down
1 change: 1 addition & 0 deletions index.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@
ROOT_PATH: page_landing.layout,
}


# ....................
# Callback to display page given URL
# ....................
Expand Down
4 changes: 2 additions & 2 deletions pages/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
)

NEW_POSES = deepcopy(BASE_POSE)
POSES_MSG_HEADER = f"""
POSES_MSG_HEADER = """
+----------------+------------+------------+------------+
| leg name | coxia | femur | tibia |
+----------------+------------+------------+------------+"""
Expand Down Expand Up @@ -53,7 +53,7 @@ def load_params(params_json, params_type):

raise Exception(
f'params_type must be "dims", "pose" or "ik", not {params_type}'
)
) from e

return params

Expand Down
55 changes: 21 additions & 34 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,43 +1,30 @@
appdirs==1.4.3
astroid==2.3.3
attrs==19.3.0
black==19.10b0
click==7.1.1
dash==1.10.0
dash-core-components==1.9.0
dash-daq==0.4.0
dash-html-components==1.0.3
dash-renderer==1.3.0
entrypoints==0.3
flake8==3.7.9
astroid==2.4.2
Brotli==1.0.9
click==7.1.2
dash==1.18.1
dash-core-components==1.14.1
dash-daq==0.5.0
dash-html-components==1.1.1
dash-renderer==1.8.3
dash-table==4.11.1
flake8==3.8.4
Flask==1.1.2
Flask-Compress==1.4.0
Flask-Compress==1.8.0
future==0.18.2
gunicorn==20.0.4
isort==4.3.21
isort==5.7.0
itsdangerous==1.1.0
Jinja2==2.11.1
Jinja2==2.11.2
lazy-object-proxy==1.4.3
MarkupSafe==1.1.1
mccabe==0.6.1
more-itertools==8.2.0
numpy==1.18.2
packaging==20.3
pathspec==0.8.0
pip-check-reqs-pip-gte-20==2.0.3.1
plotly==4.6.0
pluggy==0.13.1
py==1.8.1
pycodestyle==2.5.0
pyflakes==2.1.1
pylint==2.4.4
pyparsing==2.4.7
pytest==5.4.1
regex==2020.4.4
numpy==1.19.5
plotly==4.14.1
pycodestyle==2.6.0
pyflakes==2.2.0
pylint==2.6.0
retrying==1.3.3
six==1.14.0
toml==0.10.0
typed-ast==1.4.1
wcwidth==0.1.9
six==1.15.0
toml==0.10.2
Werkzeug==1.0.1
wrapt==1.11.2
wrapt==1.12.1
4 changes: 2 additions & 2 deletions style_settings.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
DARKMODE = True

DARK_CSS_PATH = "https://codepen.io/mithi-the-encoder/pen/BaoBOKa.css"
LIGHT_CSS_PATH = "https://codepen.io/mithi-the-encoder/pen/eYpObwK.css"
DARK_CSS_PATH = "https://mithi.github.io/hexapod-robot-simulator/dark.css"
LIGHT_CSS_PATH = "https://mithi.github.io/hexapod-robot-simulator/light.css"

EXTERNAL_STYLESHEETS = [DARK_CSS_PATH]
if not DARKMODE:
Expand Down

0 comments on commit e997b19

Please sign in to comment.