Skip to content

Commit

Permalink
168 make revolve2s core library more generic to the general public (#266
Browse files Browse the repository at this point in the history
)

* Moved around lots of code and created ad removed packages.

* Remove pyyaml depedency of mujoco as it's now included in the python-mujoco-viewer package.
  • Loading branch information
surgura committed Sep 11, 2023
1 parent 05c2f47 commit 67fcf0d
Show file tree
Hide file tree
Showing 226 changed files with 637 additions and 564 deletions.
76 changes: 42 additions & 34 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,26 @@ jobs:
pip install virtualenv
virtualenv .venv
. .venv/bin/activate
# Do this in reverse order of the things depending on each other.
# Probably gives us the best failure insights.
- name: install serialization
run: pip install ./serialization
- name: install actor_controller
run: pip install ./actor_controller
- name: install simulation
run: pip install ./simulation
- name: install modular_robot
run: pip install ./modular_robot
- name: install rpi_controller
run: pip install ./rpi_controller
- name: install core
run: pip install ./core
- name: install standard_resources
run: pip install ./standard_resources
- name: install runner mujoco
run: pip install ./runners/mujoco
- name: install genotype CPPNWIN
run: |
sudo apt install libcereal-dev
pip install ./genotypes/cppnwin
- name: install rpi_controller_remote
run: pip install ./rpi_controller_remote
- name: install experimentation
run: pip install ./experimentation
- name: install simulators/mujoco
run: pip install ./simulators/mujoco
- name: install ci_group
run: pip install ./ci_group
- name: install examples requirements
run: |
pip install -r examples/robot_bodybrain_ea_database/requirements.txt
Expand Down Expand Up @@ -75,18 +79,20 @@ jobs:
run: pip install ./serialization[dev]
- name: install actor_controller
run: pip install ./actor_controller[dev]
- name: install simulation
run: pip install ./simulation[dev]
- name: install modular_robot
run: pip install ./modular_robot[dev]
- name: install rpi_controller
run: pip install ./rpi_controller[dev]
- name: install core
run: pip install ./core[dev]
- name: install standard_resources
run: pip install ./standard_resources[dev]
- name: install runner mujoco
run: pip install ./runners/mujoco[dev]
- name: install genotype CPPNWIN
run: |
sudo apt install libcereal-dev
pip install ./genotypes/cppnwin[dev]
- name: install rpi_controller_remote
run: pip install ./rpi_controller_remote[dev]
- name: install experimentation
run: pip install ./experimentation[dev]
- name: install simulators/mujoco
run: pip install ./simulators/mujoco[dev]
- name: install ci_group
run: pip install ./ci_group[dev]
- name: install examples requirements
run: |
pip install -r examples/robot_bodybrain_ea_database/requirements.txt
Expand All @@ -95,7 +101,7 @@ jobs:
- name: install requirements for mypy
run: pip install -r ./codetools/mypy/requirements.txt
- name: run mypy
run: ./codetools/mypy/check_opensource.sh
run: ./codetools/mypy/check.sh

docs:
runs-on: ubuntu-20.04
Expand All @@ -110,21 +116,23 @@ jobs:
virtualenv .venv
. .venv/bin/activate
- name: install serialization
run: pip install ./serialization[dev]
run: pip install ./serialization
- name: install actor_controller
run: pip install ./actor_controller[dev]
run: pip install ./actor_controller
- name: install simulation
run: pip install ./simulation
- name: install modular_robot
run: pip install ./modular_robot
- name: install rpi_controller
run: pip install ./rpi_controller[dev]
- name: install core
run: pip install ./core[dev]
- name: install standard_resources
run: pip install ./standard_resources[dev]
- name: install runner mujoco
run: pip install ./runners/mujoco[dev]
- name: install genotype CPPNWIN
run: |
sudo apt install libcereal-dev
pip install ./genotypes/cppnwin[dev]
run: pip install ./rpi_controller
- name: install rpi_controller_remote
run: pip install ./rpi_controller_remote
- name: install experimentation
run: pip install ./experimentation
- name: install simulators/mujoco
run: pip install ./simulators/mujoco
- name: install ci_group
run: pip install ./ci_group
- name: install requirements for sphinx
run: pip install -r ./docs/requirements.txt
- name: sphinx
Expand Down
2 changes: 1 addition & 1 deletion actor_controller/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build-backend = "poetry.core.masonry.api"
[tool.poetry]
name = "revolve2-actor-controller"
version = "0.3.9b1"
description = "Individual Actor controller for revolve2."
description = "Revolve2 actor controller interface and implementations."
authors = ["Aart Stuurman <[email protected]>"]
repository = "https://github.com/ci-group/revolve2"
classifiers = [
Expand Down
1 change: 1 addition & 0 deletions actor_controller/revolve2/actor_controllers/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Actor controller implementations."""
File renamed without changes.
28 changes: 28 additions & 0 deletions ci_group/pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
[build-system]
requires = ["poetry-core>=1.6.0"]
build-backend = "poetry.core.masonry.api"

[tool.poetry]
name = "revolve2-ci-group"
version = "0.3.9b1"
description = "Revolve2 Computational Intelligence Group experimentation tools and standards."
authors = ["Aart Stuurman <[email protected]>"]
repository = "https://github.com/ci-group/revolve2"
classifiers = [
"Development Status :: 4 - Beta",
"Typing :: Typed",
"Topic :: Scientific/Engineering",
"Programming Language :: Python :: 3",
]
packages = [{ include = "revolve2" }]

[tool.poetry.dependencies]
python = "^3.10"
revolve2-simulation = { path = "../simulation", develop = true }
revolve2-modular-robot = { path = "../modular_robot", develop = true }
noise = "^1.2.2"
numpy = "^1.21.2"
pyrr = "^0.10.3"

[tool.poetry.extras]
dev = []
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import math

from revolve2.core.modular_robot import BodyState
from revolve2.modular_robot import BodyState


def xy_displacement(begin_state: BodyState, end_state: BodyState) -> float:
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Standard modular robots."""
import numpy as np
from revolve2.core.modular_robot import ActiveHinge, Body, Brick
from revolve2.modular_robot import ActiveHinge, Body, Brick


def all() -> list[Body]:
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
"""Standard simulation functions and parameters."""
from revolve2.core.modular_robot import (
from revolve2.modular_robot import (
ModularRobot,
create_batch_multiple_isolated_robots,
create_batch_single_robot,
)
from revolve2.core.physics import Terrain
from revolve2.core.physics.running import Batch
from revolve2.simulation import Terrain
from revolve2.simulation.running import Batch

STANDARD_SIMULATION_TIME = 30
STANDARD_SAMPLING_FREQUENCY = 0.0001
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import numpy.typing as npt
from noise import pnoise2
from pyrr import Quaternion, Vector3
from revolve2.core.physics import Terrain
from revolve2.core.physics.running import geometry
from revolve2.simulation import Terrain
from revolve2.simulation.running import geometry


def flat(size: Vector3 = Vector3([20.0, 20.0, 0.0])) -> Terrain:
Expand Down
2 changes: 1 addition & 1 deletion core/run_mypy.sh → ci_group/run_mypy.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh

cd "$(dirname "$0")"
echo "core:"
echo "ci_group:"
mypy -p revolve2
2 changes: 1 addition & 1 deletion codetools/black/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

cd "$(dirname "$0")"

black --diff --check ../../actor_controller/revolve2 ../../core/revolve2 ../../examples ../../genotypes/cppnwin/revolve2 ../../rpi_controller/revolve2 ../../runners/mujoco/revolve2 ../../serialization/revolve2 ../../standard_resources/revolve2
black --diff --check ../../actor_controller/revolve2 ../../ci_group/revolve2 ../../examples ../../experimentation/revolve2 ../../modular_robot/revolve2 ../../rpi_controller/revolve2 ../../rpi_controller_remote/revolve2 ../../serialization/revolve2 ../../simulation/revolve2 ../../simulators/mujoco/revolve2
2 changes: 1 addition & 1 deletion codetools/black/fix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

cd "$(dirname "$0")"

black ../../actor_controller/revolve2 ../../core/revolve2 ../../examples ../../genotypes/cppnwin/revolve2 ../../rpi_controller/revolve2 ../../runners/mujoco/revolve2 ../../serialization/revolve2 ../../standard_resources/revolve2
black ../../actor_controller/revolve2 ../../ci_group/revolve2 ../../examples ../../experimentation/revolve2 ../../modular_robot/revolve2 ../../rpi_controller/revolve2 ../../rpi_controller_remote/revolve2 ../../serialization/revolve2 ../../simulation/revolve2 ../../simulators/mujoco/revolve2
2 changes: 1 addition & 1 deletion codetools/darglint/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

cd "$(dirname "$0")"

darglint -s sphinx ../../actor_controller/revolve2 ../../core/revolve2 ../../examples ../../genotypes/cppnwin/revolve2 ../../rpi_controller/revolve2 ../../runners/mujoco/revolve2 ../../serialization/revolve2 ../../standard_resources/revolve2
darglint -s sphinx ../../actor_controller/revolve2 ../../ci_group/revolve2 ../../examples ../../experimentation/revolve2 ../../modular_robot/revolve2 ../../rpi_controller/revolve2 ../../rpi_controller_remote/revolve2 ../../serialization/revolve2 ../../simulation/revolve2 ../../simulators/mujoco/revolve2
2 changes: 1 addition & 1 deletion codetools/fix_all.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ cd "$(dirname "$0")"
echo "--------------"
echo "mypy"
echo "--------------"
./mypy/check_all.sh
./mypy/check.sh

echo "--------------"
echo "pyflakes"
Expand Down
2 changes: 1 addition & 1 deletion codetools/isort/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

cd "$(dirname "$0")"

isort --check-only --diff --profile black ../../actor_controller/revolve2 ../../core/revolve2 ../../examples ../../genotypes/cppnwin/revolve2 ../../rpi_controller/revolve2 ../../runners/mujoco/revolve2 ../../serialization/revolve2 ../../standard_resources/revolve2
isort --check-only --diff --profile black ../../actor_controller/revolve2 ../../ci_group/revolve2 ../../examples ../../experimentation/revolve2 ../../modular_robot/revolve2 ../../rpi_controller/revolve2 ../../rpi_controller_remote/revolve2 ../../serialization/revolve2 ../../simulation/revolve2 ../../simulators/mujoco/revolve2
2 changes: 1 addition & 1 deletion codetools/isort/fix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

cd "$(dirname "$0")"

isort --profile black ../../actor_controller/revolve2 ../../core/revolve2 ../../examples ../../genotypes/cppnwin/revolve2 ../../rpi_controller/revolve2 ../../runners/mujoco/revolve2 ../../serialization/revolve2 ../../standard_resources/revolve2
isort --profile black ../../actor_controller/revolve2 ../../ci_group/revolve2 ../../examples ../../experimentation/revolve2 ../../modular_robot/revolve2 ../../rpi_controller/revolve2 ../../rpi_controller_remote/revolve2 ../../serialization/revolve2 ../../simulation/revolve2 ../../simulators/mujoco/revolve2
16 changes: 16 additions & 0 deletions codetools/mypy/check.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#!/bin/sh

set -e

cd "$(dirname "$0")"

../../actor_controller/run_mypy.sh
../../ci_group/run_mypy.sh
../../examples/run_mypy.sh
../../experimentation/run_mypy.sh
../../modular_robot/run_mypy.sh
../../rpi_controller/run_mypy.sh
../../rpi_controller_remote/run_mypy.sh
../../serialization/run_mypy.sh
../../simulation/run_mypy.sh
../../simulators/mujoco/run_mypy.sh
14 changes: 0 additions & 14 deletions codetools/mypy/check_all.sh

This file was deleted.

14 changes: 0 additions & 14 deletions codetools/mypy/check_opensource.sh

This file was deleted.

2 changes: 1 addition & 1 deletion codetools/pydocstyle/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

cd "$(dirname "$0")"

pydocstyle ../../actor_controller/revolve2 ../../core/revolve2 ../../examples ../../genotypes/cppnwin/revolve2 ../../rpi_controller/revolve2 ../../runners/mujoco/revolve2 ../../serialization/revolve2 ../../standard_resources/revolve2
pydocstyle ../../actor_controller/revolve2 ../../ci_group/revolve2 ../../examples ../../experimentation/revolve2 ../../modular_robot/revolve2 ../../rpi_controller/revolve2 ../../rpi_controller_remote/revolve2 ../../serialization/revolve2 ../../simulation/revolve2 ../../simulators/mujoco/revolve2
2 changes: 1 addition & 1 deletion codetools/pyflakes/check.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

cd "$(dirname "$0")"

pyflakes ../../actor_controller/revolve2 ../../core/revolve2 ../../examples ../../genotypes/cppnwin/revolve2 ../../rpi_controller/revolve2 ../../runners/mujoco/revolve2 ../../serialization/revolve2 ../../standard_resources/revolve2
pyflakes ../../actor_controller/revolve2 ../../ci_group/revolve2 ../../examples ../../experimentation/revolve2 ../../modular_robot/revolve2 ../../rpi_controller/revolve2 ../../rpi_controller_remote/revolve2 ../../serialization/revolve2 ../../simulation/revolve2 ../../simulators/mujoco/revolve2
2 changes: 1 addition & 1 deletion codetools/sort_all/fix.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/sh

cd "$(dirname "$0")"
dirs="../../actor_controller/revolve2 ../../core/revolve2 ../../examples ../../genotypes/cppnwin/revolve2 ../../rpi_controller/revolve2 ../../runners/mujoco/revolve2 ../../serialization/revolve2 ../../standard_resources/revolve2"
dirs="../../actor_controller/revolve2 ../../ci_group/revolve2 ../../examples ../../experimentation/revolve2 ../../modular_robot/revolve2 ../../rpi_controller/revolve2 ../../rpi_controller_remote/revolve2 ../../serialization/revolve2 ../../simulation/revolve2 ../../simulators/mujoco/revolve2"
find $dirs -type f -name '__init__.py' -print0 | xargs -0 sort-all
5 changes: 0 additions & 5 deletions core/revolve2/core/__init__.py

This file was deleted.

10 changes: 6 additions & 4 deletions dev_requirements.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,13 @@

cd "$(dirname "$0")"

pip install -e ./runners/mujoco[dev] && \
pip install -e ./genotypes/cppnwin[dev] && \
pip install -e ./standard_resources[dev] && \
pip install -e ./core[dev] && \
pip install -e ./ci_group[dev] && \
pip install -e ./simulators/mujoco[dev] && \
pip install -e ./experimentation[dev] && \
pip install -e ./rpi_controller_remote[dev] && \
pip install -e ./rpi_controller[dev] && \
pip install -e ./modular_robot[dev] && \
pip install -e ./simulation[dev] && \
pip install -e ./actor_controller[dev] && \
pip install -e ./serialization[dev] && \
pip install -r ./codetools/requirements.txt
Expand Down
12 changes: 7 additions & 5 deletions docs/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,15 @@ help:
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

apidoc:
@$(SPHINXAPIDOC) ../core/revolve2 $(APIDOCARGS)
@$(SPHINXAPIDOC) ../genotypes/cppnwin/revolve2 $(APIDOCARGS)
@$(SPHINXAPIDOC) ../runners/mujoco/revolve2 $(APIDOCARGS)
@$(SPHINXAPIDOC) ../serialization/revolve2 $(APIDOCARGS)
@$(SPHINXAPIDOC) ../actor_controller/revolve2 $(APIDOCARGS)
@$(SPHINXAPIDOC) ../ci_group/revolve2 $(APIDOCARGS)
@$(SPHINXAPIDOC) ../experimentation/revolve2 $(APIDOCARGS)
@$(SPHINXAPIDOC) ../modular_robot/revolve2 $(APIDOCARGS)
@$(SPHINXAPIDOC) ../rpi_controller/revolve2 $(APIDOCARGS)
@$(SPHINXAPIDOC) ../standard_resources/revolve2 $(APIDOCARGS)
@$(SPHINXAPIDOC) ../rpi_controller_remote/revolve2 $(APIDOCARGS)
@$(SPHINXAPIDOC) ../serialization/revolve2 $(APIDOCARGS)
@$(SPHINXAPIDOC) ../simulation/revolve2 $(APIDOCARGS)
@$(SPHINXAPIDOC) ../simulators/mujoco/revolve2 $(APIDOCARGS)

apidoc_overwrite:
APIDOCARGS="$(APIDOCARGS) -f" $(MAKE) apidoc
Expand Down
9 changes: 6 additions & 3 deletions docs/source/api_reference/revolve2.actor_controllers.rst
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
revolve2.actor\_controllers namespace
=====================================
revolve2.actor\_controllers package
===================================

.. py:module:: revolve2.actor_controllers
.. automodule:: revolve2.actor_controllers
:members:
:undoc-members:
:show-inheritance:

Subpackages
-----------
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
revolve2.standard\_resources.terrains module
revolve2.ci\_group.fitness\_functions module
============================================

.. automodule:: revolve2.standard_resources.terrains
.. automodule:: revolve2.ci_group.fitness_functions
:members:
:undoc-members:
:show-inheritance:
7 changes: 7 additions & 0 deletions docs/source/api_reference/revolve2.ci_group.logging.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
revolve2.ci\_group.logging module
=================================

.. automodule:: revolve2.ci_group.logging
:members:
:undoc-members:
:show-inheritance:
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
revolve2.ci\_group.modular\_robots module
=========================================

.. automodule:: revolve2.ci_group.modular_robots
:members:
:undoc-members:
:show-inheritance:
Loading

0 comments on commit 67fcf0d

Please sign in to comment.