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

Add ESmini simulator #223

Merged
merged 20 commits into from
Mar 27, 2024
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
2 changes: 1 addition & 1 deletion .github/workflows/build-cloe.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- "cloe-normal"
package_target:
# 1. Build each test configuration in Conan cache and run all tests
- "export smoketest-deps smoketest"
- "export export-vendor smoketest-deps smoketest"
env:
CONAN_NON_INTERACTIVE: "yes"
DEBIAN_FRONTEND: noninteractive
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ setup.sh
# Standard out-of-source build
build/

# Vendored Conan recipes sometimes extract fetched sources
vendor/**/src/
**/vendor/**/src/

# Documentation
docs/_build/
docs/_extra/
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ WORKDIR /cloe
SHELL ["/bin/bash", "-c"]

ARG PROJECT_VERSION=unknown
ARG PACKAGE_TARGET="export smoketest-deps"
ARG PACKAGE_TARGET="export-vendor export smoketest-deps"
ARG KEEP_SOURCES=0

COPY . /cloe
Expand Down
28 changes: 17 additions & 11 deletions Makefile.all
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ SUBMAKEFLAGS :=

META_PKG := cloe
PLUGIN_PKGS := $(wildcard plugins/*)
ALL_PKGS := fable runtime models oak engine ${PLUGIN_PKGS} ${META_PKG}
ALL_PKGS := fable runtime models oak osi engine ${PLUGIN_PKGS} ${META_PKG}
WITHOUT_PKGS :=
UNSELECT_PKGS := ${WITHOUT_PKGS}
WITH_PKGS :=
Expand All @@ -48,7 +48,7 @@ SELECT_PKGS := $(call uniq, $(filter-out ${UNSELECT_PKGS}, ${ALL_PKGS}) ${WITH_P
##
## Functions analogously to normal package selection.
##
ALL_VENDOR :=
ALL_VENDOR := $(wildcard vendor/*)
WITHOUT_VENDOR :=
UNSELECT_VENDOR := ${WITHOUT_VENDOR}
WITH_VENDOR :=
Expand All @@ -61,7 +61,13 @@ runtime: fable
models: runtime
oak: runtime
engine: models oak
osi: runtime models vendor/open-simulation-interface
${PLUGIN_PKGS}: runtime models
plugins/esmini: vendor/open-simulation-interface vendor/esmini

vendor/esmini: vendor/open-simulation-interface
vendor/esmini-data:
vendor/open-simulation-interface:

## BUILD_POLICY
## Usage: make BUILD_POLICY="missing"
Expand Down Expand Up @@ -119,9 +125,9 @@ ${META_PKG}:
done

# Usage: $(call make_vendor_target, TARGET-NAME, HELP-DESCRIPTION, HELP-CATEGORY)
# define make_vendor_target
# $(eval $(call _make_target_rules,${1},${2},${3},${SELECT_VENDOR}))
# endef
define make_vendor_target
$(eval $(call _make_target_rules,${1},${2},${3},${SELECT_VENDOR}))
endef

# Usage: $(call make_every_target, TARGET-NAME, HELP-DESCRIPTION, HELP-CATEGORY)
define make_every_target
Expand All @@ -141,9 +147,9 @@ endef
help::
$(call print_help_section, "Available build targets")

# $(call make_vendor_target, export-vendor, "export all vendor packages", "[conan-cache]")
# $(call make_vendor_target, package-vendor, "create all vendor packages", "[conan-cache]")
# $(call make_vendor_target, download-vendor, "download or build vendor packages", "[conan-cache]")
$(call make_vendor_target, export-vendor, "export all vendor packages", "[conan-cache]")
$(call make_vendor_target, package-vendor, "create all vendor packages", "[conan-cache]")
$(call make_vendor_target, download-vendor, "download or build vendor packages", "[conan-cache]")

help::
echo
Expand Down Expand Up @@ -179,15 +185,15 @@ $(call make_select_target, clean-select, "remove build artifacts", "[in-source]"
help::
echo
$(call print_help_subsection, "Options")
# $(call print_help_option, WITH_VENDOR, "", "include optional vendor packages from ${_grn}UNSELECT_VENDOR${_rst}")
$(call print_help_option, WITH_VENDOR, "", "include optional vendor packages from ${_grn}UNSELECT_VENDOR${_rst}")
$(call print_help_option, WITH_PKGS, "", "include optional packages from ${_grn}UNSELECT_PKGS${_rst}")
$(call print_help_option, LOCKFILE_SOURCE, "", "use specified conanfile as lockfile source for build")
echo
$(call print_help_subsection, "Defines")
$(call print_help_option, BUILD_POLICY, ${BUILD_POLICY})
$(call print_help_define, CONAN_OPTIONS, ${CONAN_OPTIONS})
# $(call print_help_define_lines, UNSELECT_VENDOR, ${UNSELECT_VENDOR})
# $(call print_help_define_lines, SELECT_VENDOR, ${SELECT_VENDOR})
$(call print_help_define_lines, UNSELECT_VENDOR, ${UNSELECT_VENDOR})
$(call print_help_define_lines, SELECT_VENDOR, ${SELECT_VENDOR})
$(call print_help_define_lines, UNSELECT_PKGS, ${UNSELECT_PKGS})
$(call print_help_define_lines, SELECT_PKGS, ${SELECT_PKGS})
echo
Expand Down
11 changes: 11 additions & 0 deletions Makefile.docker
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ DOCKER := DOCKER_BUILDKIT=1 docker
DOCKER_IMAGE_NAME := cloe/cloe-engine
DOCKER_IMAGE_VERSION := ${PROJECT_VERSION}
DOCKER_IMAGE := ${DOCKER_IMAGE_NAME}:${DOCKER_IMAGE_VERSION}
DOCKER_DEVIMAGE := ${DOCKER_IMAGE_NAME}-dev:${DOCKER_IMAGE_VERSION}
DOCKER_CONTEXT := ${PROJECT_ROOT}

DOCKER_USER_ARGS +=
Expand Down Expand Up @@ -115,6 +116,13 @@ ubuntu-%: FORCE build-ubuntu-% test-ubuntu-%
.PHONY: all
all: $(addprefix ubuntu-,${UBUNTU_VERSIONS})

build-devc-%: FORCE Dockerfile
${DOCKER} build -f Dockerfile ${DOCKER_BUILD_ARGS} ${DOCKER_USER_ARGS} \
--build-arg UBUNTU_VERSION=$* \
--target stage-setup-system \
-t ${DOCKER_DEVIMAGE}-ubuntu-$* \
${DOCKER_CONTEXT}

build-ubuntu-%: FORCE Dockerfile
${DOCKER} build -f Dockerfile ${DOCKER_BUILD_ARGS} ${DOCKER_USER_ARGS} \
--build-arg UBUNTU_VERSION=$* \
Expand All @@ -125,6 +133,9 @@ test-ubuntu-%: FORCE
docker run ${DOCKER_RUN_ARGS} ${DOCKER_USER_ARGS} ${DOCKER_IMAGE}-ubuntu-$* \
bash -ec "[ -f /root/setup.sh ] && source /root/setup.sh; make smoketest"

run-devc-%: FORCE
docker run -it ${DOCKER_RUN_ARGS} ${DOCKER_USER_ARGS} --mount type=bind,source=$$(pwd),destination=/cloe ${DOCKER_DEVIMAGE}-ubuntu-$*

run-ubuntu-%: FORCE
docker run -it ${DOCKER_RUN_ARGS} ${DOCKER_USER_ARGS} ${DOCKER_IMAGE}-ubuntu-$*

Expand Down
2 changes: 1 addition & 1 deletion Makefile.package
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ smoketest-deps:
@for conanfile in ${TEST_CONANFILES}; do \
test -f "$${conanfile}" || continue; \
echo "Building dependencies for conanfile: $${conanfile}"; \
${CLOE_LAUNCH} prepare -P "$${conanfile}" || break; \
${CLOE_LAUNCH} prepare -P "$${conanfile}" || exit 1; \
done

# CONFIGURATION TARGETS -------------------------------------------------------
Expand Down
6 changes: 5 additions & 1 deletion Makefile.setup
Original file line number Diff line number Diff line change
Expand Up @@ -114,14 +114,18 @@ install-ubuntu-deps::
git \
graphviz \
jq \
libgl-dev \
libxinerama-dev \
libxrandr-dev \
libfontconfig1-dev \
netcat-openbsd \
patchelf \
psmisc \
python3-pip \
python3-setuptools \
python3-venv \
time \
tmux \
python3-venv \
;

# Require GCC and G++ version >= 8
Expand Down
5 changes: 5 additions & 0 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@ class Cloe(ConanFile):
settings = "os", "compiler", "build_type", "arch"
options = {
"with_vtd": [True, False],
"with_esmini": [True, False],
"with_engine": [True, False],

# Doesn't affect package ID:
"pedantic": [True, False],
}
default_options = {
"with_vtd": False,
"with_esmini": True,
"with_engine": True,

"pedantic": True,
Expand Down Expand Up @@ -54,6 +56,8 @@ def cloe_requires(dep):
cloe_requires("cloe-plugin-noisy-sensor")
cloe_requires("cloe-plugin-speedometer")
cloe_requires("cloe-plugin-virtue")
if self.options.with_esmini:
cloe_requires("cloe-plugin-esmini")
if self.options.with_vtd:
cloe_requires("cloe-plugin-vtd")

Expand All @@ -62,6 +66,7 @@ def cloe_requires(dep):
cloe_requires("cloe-engine")

# Overrides:
self.requires("zlib/1.2.13", override=True)
self.requires("fmt/9.1.0", override=True)
self.requires("inja/3.4.0", override=True)
self.requires("nlohmann_json/3.11.2", override=True)
Expand Down
1 change: 1 addition & 0 deletions docs/reference/plugins.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ installation of these simulators.

plugins/nop_simulator
plugins/minimator
plugins/esmini
plugins/vtd

.. rubric:: Controller Plugins
Expand Down
22 changes: 22 additions & 0 deletions docs/reference/plugins/esmini.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
.. reference-gen: esmini

ESMini Simulator
===================

.. todo:: Describe the esmini simulator.

Defaults
--------

The following help can be viewed with :command:`cloe-engine usage esmini`:

.. literalinclude:: esmini.yaml
:language: yaml

JSON Schema
-----------

The following can be viewed with :command:`cloe-engine usage --json esmini`:

.. literalinclude:: esmini_schema.json
:language: json
14 changes: 14 additions & 0 deletions docs/reference/plugins/esmini.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
Name: esmini
Type: simulator
Path: ~/.conan/data/cloe-plugin-esmini/0.22.0/cloe/develop/package/edd33cfae11b1ac2558435742ce028cfc34c7917/lib/cloe/simulator_esmini.so
Usage: {
"headless": "boolean :: run esmini without viewer",
"scenario": "string :: absolute path to open scenario file",
"vehicles": "object :: vehicle configuration like sensors and component mapping",
"write_images": "boolean :: save an image for each step"
}
Defaults: {
"headless": true,
"scenario": "",
"write_images": false
}
42 changes: 42 additions & 0 deletions docs/reference/plugins/esmini_schema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"$id": "~/.conan/data/cloe-plugin-esmini/0.22.0/cloe/develop/package/edd33cfae11b1ac2558435742ce028cfc34c7917/lib/cloe/simulator_esmini.so",
"$schema": "http://json-schema.org/draft-07/schema#",
"additionalProperties": false,
"description": "basic OpenScenario player",
"properties": {
"headless": {
"description": "run esmini without viewer",
"type": "boolean"
},
"scenario": {
"description": "absolute path to open scenario file",
"type": "string"
},
"vehicles": {
"additionalProperties": {
"additionalProperties": false,
"properties": {
"closed_loop": {
"description": "control the esmini vehicle",
"type": "boolean"
},
"filter_distance": {
"description": "filter distance for ground truth data",
"maximum": 1.7976931348623157e+308,
"minimum": -1.7976931348623157e+308,
"type": "number"
}
},
"type": "object"
},
"description": "vehicle configuration like sensors and component mapping",
"type": "object"
},
"write_images": {
"description": "save an image for each step",
"type": "boolean"
}
},
"title": "esmini",
"type": "object"
}
Loading
Loading