Skip to content

Commit

Permalink
Merge branch 'feat/linfization'
Browse files Browse the repository at this point in the history
  • Loading branch information
EdoardoRomiti committed May 6, 2024
2 parents 6fd6759 + 9c743e6 commit d6fc129
Show file tree
Hide file tree
Showing 184 changed files with 10,347 additions and 2,318 deletions.
92 changes: 92 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Git
# .git
# .gitignore
.gitattributes


# CI
.codeclimate.yml
.travis.yml
.taskcluster.yml

# Docker
docker-compose.yml
Dockerfile
.docker
.dockerignore

# Byte-compiled / optimized / DLL files
**/__pycache__/
**/*.py[cod]

# C extensions
*.so

# Distribution / packaging
.Python
env/
build/
develop-eggs/
dist/
downloads/
eggs/
lib/
lib64/
parts/
sdist/
var/
*.egg-info/
.installed.cfg
*.egg

# PyInstaller
# Usually these files are written by a python script from a template
# before PyInstaller builds the exe, so as to inject date/other infos into it.
*.manifest
*.spec

# Installer logs
pip-log.txt
pip-delete-this-directory.txt

# Unit test / coverage reports
htmlcov/
.tox/
.coverage
.cache
nosetests.xml
coverage.xml

# Translations
*.mo
*.pot

# Django stuff:
*.log

# Sphinx documentation
docs/_build/

# PyBuilder
target/

# Virtual environment
.env
.venv/
venv/

# PyCharm
.idea

# Python mode for VIM
.ropeproject
**/.ropeproject

# Vim swap files
**/*.swp

# VS Code
.vscode/

# Server config file
**/web_config.ini
28 changes: 15 additions & 13 deletions .github/workflows/automerge.yml
Original file line number Diff line number Diff line change
@@ -1,29 +1,31 @@
name: Automerge master into alberobotics

on:
on:
push:
branches:
- "master"

jobs:
merge-master-into-alberobotics:
runs-on: ubuntu-20.04
env:
CI_COMMIT_MESSAGE: Continuous Integration Build Artifacts
CI_COMMIT_AUTHOR: Continuous Integration

steps:
- uses: actions/checkout@v3
- name: Checkout
uses: actions/checkout@v3

- name: Set Git config
- name: Set up git
run: |
git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}"
git config --global user.email "[email protected]"
git config --global user.name $USER_NAME
git config --global user.email $USER_EMAIL
env:
# see https://github.com/orgs/community/discussions/26560#discussioncomment-3531273
USER_NAME: 'github-actions[bot]'
USER_EMAIL: '41898282+github-actions[bot]@users.noreply.github.com'

- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v35

- name: Merge master into alberobotics
run: |
Expand All @@ -39,14 +41,14 @@ jobs:
"src/modular/modular_data/cartesio/ModularBot_cartesio_multichain_config.yaml"
)
git fetch --unshallow
git fetch --unshallow
git checkout alberobotics
git merge --no-ff --no-commit master
for file in "${to_keep[@]}"; do
git reset HEAD $file
git checkout -- $file
git checkout -- $file
done
git commit -m "merged master"
git commit -m "merged master"
git push
65 changes: 65 additions & 0 deletions .github/workflows/create_pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
name: Open PR for new modular_frontend version
# see https://github.com/orgs/community/discussions/26286#discussioncomment-3251208
# on:
# create:
# branches:
# - 'ci/deps/modular_frontend-v[0-9]+.[0-9]+.[0-9]+*'
on: create

jobs:
create-pr:
runs-on: ubuntu-latest
name: Create PR to update modular_frontend
# see https://github.com/orgs/community/discussions/26771#discussioncomment-3253330
if: startsWith(github.ref_name, 'ci/deps/modular_frontend-')
env:
TARGET_BRANCH: feat/linfization
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Set up git
run: |
git config --global user.name $USER_NAME
git config --global user.email $USER_EMAIL
env:
# see https://github.com/orgs/community/discussions/26560#discussioncomment-3531273
USER_NAME: 'github-actions[bot]'
USER_EMAIL: '41898282+github-actions[bot]@users.noreply.github.com'

# - name: Updated static docs
# run: |
# RELEASE_VERSION=$(echo $GITHUB_REF_NAME | sed -e s/.*modular_frontend-//)
# sed -i '/version/c\ \"version\" : \"'RELEASE_VERSION'\",' package.json
# npm ci
# npm run build:swagger
# git add docs
# git commit -m "📝 docs(Swagger): update static swagger docs"

# - name: Commit version bump
# run: |
# RELEASE_VERSION=$(echo $GITHUB_REF_NAME | sed -e s/.*modular_frontend-//)
# sed -i '/version/c\ \"version\" : \"'RELEASE_VERSION'\",' package.json
# git add package.json
# git commit -m "📦 chore: bump version to RELEASE_VERSION"

# - name: Push changes
# run: |
# git push -u origin HEAD

- name: Open new PR
run: |
RELEASE_VERSION=$(echo $GITHUB_REF_NAME | sed -e s/.*modular_frontend-//)
gh pr create \
--title "⬆️ chore(gui): Bump modular_frontend to $RELEASE_VERSION" \
--body-file ./src/modular/web/modular_frontend/frontend_release_notes/CHANGELOG.$RELEASE_VERSION.md \
--base ${{ env.TARGET_BRANCH }} \
--label refactor \
--assignee "m-tartari" \
--reviewer "EdoardoRomiti"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Cleanup ssh configs
run: |
rm -rf ~/.ssh
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -160,3 +160,6 @@ venv.bak/

# VS Code folder
.vscode/*

# Custom setting for API
src/modular/web/web_config.ini
41 changes: 41 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
ARG BASE_IMAGE
FROM ${BASE_IMAGE}

ARG RECIPES_BRANCH=master
ARG RECIPES_PROVIDER=https://github.com/ADVRHumanoids/multidof_recipes.git

ARG FOREST_WS=$HOME/modular_ws
ARG USER_PWD=user
ARG MODE=&NoNe&
ARG JOBS=1

# run apt update as root
USER root
SHELL ["/bin/bash", "-ic"]
RUN sudo apt-get update

USER user

# Add github.com to known hosts
RUN mkdir -p -m 0700 $HOME/.ssh && ssh-keyscan github.com >> $HOME/.ssh/known_hosts

# Initialize forest workspace
WORKDIR ${FOREST_WS}
RUN forest init
RUN echo "source $FOREST_WS/setup.bash" >> ~/.bashrc

# Add recipes to forest workspace
RUN forest add-recipes https://github.com/ADVRHumanoids/multidof_recipes.git --tag $RECIPES_BRANCH

# Install dependencies using forest
RUN --mount=type=ssh,uid=${USER_ID} forest grow concert_description -m ${MODE} -j${JOBS} --pwd ${USER_PWD} --clone-depth 1 \
&& forest grow iit-dagana-ros-pkg -m ${MODE} -j${JOBS} --pwd ${USER_PWD} --clone-depth 1 \
&& rm -fr $FOREST_WS/build

# Build local version of modular
WORKDIR ${FOREST_WS}/src/modular
COPY --chown=user:user . ${FOREST_WS}/src/modular
RUN pip install -e .

# Set entrypoint
CMD ./scripts/entrypoint.sh
27 changes: 25 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
## About The Project

This project focuses on the development of an app for rapid model generation of modular robots, starting from a set of basic robotic modules.
This app will genereate URDF, SRDF and a complete ROS package, which can be used to simulate and control the robot.
This app will genereate URDF, SRDF and a complete ROS package, which can be used to simulate and control the robot.

![reconfigurable_pino](https://alberobotics.it/templates/yootheme/cache/reconfigurable_pino-2e1209e8.png)

Expand Down Expand Up @@ -108,6 +108,29 @@ Get the `RobotBuilder` app from the latest release and make it executable (`chmo

## Usage

### Configs

Several configurations can be modified for each deployment by creating a config file `src/modular/web/web_config.ini`. The most important ones are:

```ini
[MODULAR_API] # Mandatory section

# version of the API
version = 1

# When deploying the robot, return a zip file with the generated ROS package
download_on_deploy = true

# Use flash sessions to have multiple users on a single server
enable_sessions = true

# secret_key is used to sign the session cookie, it should be a random string
secret_key = FOO_BAR_BAZ

# base_route adds a prefix to all API routes, it is best to leave it commented
# base_route = /linfa/api/v${MODULAR_API:version}/modular
```

### Run the GUI
To use modular you need to start the python server.

Expand All @@ -133,7 +156,7 @@ Then open <http://0.0.0.0:5000/> from a browser to acces the graphical interface
### Use the python API
Examples of how to use the python API are provided in the [scripts](https://github.com/ADVRHumanoids/modular_hhcm/tree/master/scripts) folder.
- `create_modularbot.ipynb` shows an example of how to build a 6-DOF robot using Alberobotics modules and deploy URDF, SRDF, etc. into a ROS package
- `generate_concert_robot.ipynb` shows how to build and deploy the CONCERT modular robot
- `generate_concert_robot.ipynb` shows how to build and deploy the CONCERT modular robot

## Documentation

Expand Down
26 changes: 26 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
version: "3.8"
services:

modular:
image: "${TARGET_IMAGE}"
container_name: modular
restart: 'unless-stopped'
build:
context: ./
dockerfile: Dockerfile
ssh:
# mount the default ssh agent
- default
args:
- BASE_IMAGE
- RECIPES_BRANCH
- RECIPES_PROVIDER
- FOREST_WS
- USER_PWD
- MODE
- JOBS
ports:
- "5003:5003"
volumes:
# We might want to change the local path of the web_config.ini file
- ./src/modular/web/web_config.ini:${FOREST_WS}/src/modular/src/modular/web/web_config.ini
13 changes: 13 additions & 0 deletions scripts/entrypoint.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/bash

# Start detached roscore
nohup roscore &

# Start Modular Server
gunicorn --workers 1 --threads 4 --bind '0.0.0.0:5003' wsgi:app

# Wait for any process to exit
wait -n

# Exit with status of process that exited first
exit $?
4 changes: 2 additions & 2 deletions scripts/generate_concert_robot.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"outputs": [],
"source": [
"#add mobile base\n",
"urdf_writer.add_mobile_platform()\n"
"urdf_writer.add_module('concert/mobile_platform_concert.json', 0, False)\n"
]
},
{
Expand Down Expand Up @@ -119,7 +119,7 @@
},
"outputs": [],
"source": [
"urdf_writer.remove_connectors()\n",
"urdf_writer.remove_all_connectors()\n",
"\n",
"# get srdf and joint_map\n",
"urdf_writer.write_urdf()\n",
Expand Down
4 changes: 2 additions & 2 deletions scripts/generate_concert_robot_JSON.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
"outputs": [],
"source": [
"#add mobile base\n",
"urdf_writer.add_mobile_platform()\n"
"urdf_writer.add_module('concert/mobile_platform_concert.json', 0, False)\n"
]
},
{
Expand Down Expand Up @@ -119,7 +119,7 @@
},
"outputs": [],
"source": [
"urdf_writer.remove_connectors()\n",
"urdf_writer.remove_all_connectors()\n",
"\n",
"# get srdf and joint_map\n",
"urdf_writer.write_urdf()\n",
Expand Down
Loading

0 comments on commit d6fc129

Please sign in to comment.