Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove 3D mesh and occ. grid generation #20

Merged
merged 5 commits into from
Jan 30, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 0 additions & 8 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,12 @@ jobs:
with:
python-version: '3.11'
cache: 'pip'
- name: Install blender
run: |
sudo apt-get update
sudo apt-get install blender python3-pip python3-venv -y
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install .
- name: Test textx generation
run: |
./test.sh
- name: Generate 3D mesh and occupancy grid
working-directory: ./src
run: |
blender --background --python-use-system-env --python exsce_floorplan/exsce_floorplan.py -- ../models/examples/brsu_building_c_with_doorways.floorplan
lint:
uses: ./.github/workflows/black.yaml
2 changes: 1 addition & 1 deletion .github/workflows/docker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ name: Create and publish a Docker image
# Configures this workflow to run every time a change is pushed to the branch called `release`.
on:
push:
branches: ['main', 'docker']
branches: ['main', 'docker', 'devel']
tags:
- v*

Expand Down
10 changes: 4 additions & 6 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,20 @@
FROM ubuntu:24.04
WORKDIR /usr/src/app

ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND=noninteractive
ENV VIRTUAL_ENV=/opt/venv

ARG PYTHON_VER_MAJ=3.7
ARG PYTHON_VER=3.7.17
ARG BLENDER_VERSION=3.0
#ARG BLENDER_VERSION=3.0

RUN apt-get update
RUN apt-get install blender python3-pip python3-venv -y
RUN python3 -m venv $VIRTUAL_ENV
RUN apt-get update && apt-get install python3-pip python3-venv -y && python3 -m venv $VIRTUAL_ENV
ENV PATH="$VIRTUAL_ENV/bin:$PATH"

COPY . .

# Set python path for project src
ENV PYTHONPATH /usr/src/app/src
ENV PYTHONPATH=/usr/src/app/src

# Install languages
RUN pip3 install .
Expand Down
12 changes: 0 additions & 12 deletions config.yaml

This file was deleted.

17 changes: 0 additions & 17 deletions config/setup.cfg

This file was deleted.

48 changes: 1 addition & 47 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Important *required* options of the command:
Install all the requirements:

```shell
sudo apt-get install blender python3-pip python3-venv -y
sudo apt-get install python3-pip python3-venv -y
```

First, create a virtual environment and activate it:
Expand All @@ -49,11 +49,6 @@ First, create a virtual environment and activate it:
python -m venv .venv
source .venv/bin/activate
```
For Blender to regonize the virtual environment, add it to your `PYTHONPATH`:

```shell
export PYTHONPATH=<Path to .venv directory>/lib/python3.11/site-packages
```

From the root directory of the repo, install the python packages by running:

Expand All @@ -79,47 +74,6 @@ floorplan-variation -> floorplan-v2floorplan-dsl[1.1.0] Generate variat

## Getting started

### Generating 3D meshes and occupancy grid maps

> [!WARNING]
> The generation of 3D meshes and occupancy grid maps is currently being moved to the [scenery_builder](https://github.com/secorolab/scenery_builder) repository. The instructions below may not work and/or may be outdated.

This tool is currently in active development. To use the tool you can execute the following command:

```
blender --background --python src/exsce_floorplan/exsce_floorplan.py --python-use-system-env -- <model_path>
```

Optionally, you can remove the `--background` flag to see directly the result opened in Blender.

***Note**: The `--` before `<model_path>` is intentional and important.*

#### Example

![3D asset generated from the environment description](images/hospital_no_brackground.png)

An example model for a building is available [here](../models/examples/hospital.floorplan). To generate the 3D mesh and occupancy grid:


```
blender --background --python src/exsce_floorplan/exsce_floorplan.py --python-use-system-env -- models/examples/hospital.floorplan
```

That should generate the following files:

```
.
├── map
│   ├── hospital.pgm
│   └── hospital.yaml
└── mesh
└── hospital.stl
```

The output path for the generated models in configurable (see [confg/setup.cfg](../config/setup.cfg) and note they are relative paths from where you're calling the command).

The `.stl` mesh can now be used to specify the Gazebo models and included in a Gazebo world. See, for example, [this tutorial](https://classic.gazebosim.org/tutorials?tut=import_mesh&cat=build_robot).

### Generating the composable model representation

To generate the JSON-LD representation of the FloorPlan model, simply use textX's language generators:
Expand Down
12 changes: 0 additions & 12 deletions docs/Tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -237,15 +237,3 @@ Two entryways and one window are modelled, each with a unique name. In the case
```

At the very end of the model the default values for all the spaces must be specified.

## How to generate 3D files and occupancy grid maps

Once all requirements are installed, as specified [here](https://github.com/sesame-project/FloorPlan-DSL), you can get artefacts generated.
To interpret the model and get artefacts, you only need to run one command:

```sh
blender --python src/floorplan_dsl/generators/floorplan.py --background
--python-use-system-env -- <path to model>
```

The `--` after the variable paths are important to distinguish the blender parameters and the parameters for the tooling. You will obtain an occupancy grid map and a `.stl` file with the 3D mesh of the environment.
Binary file removed docs/images/hospital_no_brackground.png
Binary file not shown.
14 changes: 5 additions & 9 deletions models/examples/hospital.fpm2
Original file line number Diff line number Diff line change
Expand Up @@ -121,24 +121,26 @@ Floor plan: hospital
shape: Rectangle width=2.5 m, height=2.0 m
location:
in: reception.walls[3]
translation: x: 0.0 m, z: 1.0 m

Entryway reception_hallway:
shape: Rectangle width=4.0 m, height=2.0 m
location:
in: hallway.walls[2] and reception.walls[0]
translation: x: 0.0 m, z: 1.0 m

Entryway hallway_roomA:
shape: Rectangle width=1.2 m, height=2.0 m
location:
in: room_A.walls[1] and hallway.walls[3]
translation: x: -1.0 m
translation: x: 1.0 m, z: 1.0 m

Entryway hallway_roomB:
shape: Rectangle width=1.0 m, height=1.8 m
location:
in: room_B.walls[0] and hallway.walls[3]
translation: x: 1.0 m
translation: x: -1.0 m, z: 0.9 m

Window hallway_window_1:
shape: Rectangle width=3.0 m, height=1.5 m
location:
Expand All @@ -150,9 +152,3 @@ Floor plan: hospital
location:
in: hallway.walls[1]
translation: x: -1.0 m, z: 0.8 m

Window hallway_window_3:
shape: Rectangle width=1.0 m, height=1.5 m
location:
in: hallway.walls[1]
translation: x: 1.0 m, z: 0.8 m
Empty file.
64 changes: 0 additions & 64 deletions src/floorplan_dsl/blender/blender.py

This file was deleted.

Loading
Loading