Skip to content

Commit

Permalink
Add ESMini visualization plugin to ReportGUI (#159)
Browse files Browse the repository at this point in the history
Signed-off-by: romanodanilo <[email protected]>
Signed-off-by: romanodanilo <[email protected]>
  • Loading branch information
romanodanilo authored Sep 9, 2024
1 parent e64272f commit f58695c
Show file tree
Hide file tree
Showing 7 changed files with 511 additions and 150 deletions.
19 changes: 16 additions & 3 deletions examples/esmini_viewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,26 @@ project(${ESMINI_VIEWER})
set(CMAKE_INSTALL_RPATH $ORIGIN/../../lib)

set_property(GLOBAL PROPERTY USE_FOLDERS true)
find_package(XercesC REQUIRED)

include_directories(${ESMINI_VIEWER} PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}/../../src/report_modules/report_module_gui/src
${XercesC_INCLUDE_DIRS}
)

add_library(${ESMINI_VIEWER} SHARED esmini_viewer.cpp helper.cpp)
target_link_libraries(${ESMINI_VIEWER} PRIVATE qc4openx-common $<$<PLATFORM_ID:Linux>:stdc++fs>)
add_library(${ESMINI_VIEWER} SHARED esmini_viewer.cpp)

# Check if the platform requires linking with CMAKE_DL_LIBS (typically on Linux)
if(CMAKE_DL_LIBS)
target_link_libraries(${ESMINI_VIEWER} PRIVATE ${CMAKE_DL_LIBS})
endif()

target_link_libraries(
${ESMINI_VIEWER}
PRIVATE
qc4openx-common
$<$<PLATFORM_ID:Linux>:stdc++fs>
${XercesC_LIBRARIES}
)

install(
TARGETS ${ESMINI_VIEWER}
Expand Down
68 changes: 45 additions & 23 deletions examples/esmini_viewer/README.md
Original file line number Diff line number Diff line change
@@ -1,41 +1,63 @@
# Esmini viewer plugin

This folder contain the plugin to add an odr viewer based on esmini-odrviewer application

The esmini plugin is a plugin to open esmini simulator to visualize an input OpenDRIVE file

The plugin depends on esminiLib API. More information about the API can be found on the [official documentation](https://esmini.github.io/#_esmini_lib_programming)

## Installation

After building the framework, a new plugin will be shown in the `File` dropdown menu of the ReportGUI application

The plugin executes the command
The plugin depends on a single file, the esminiLib library that is included in each [esmini release](https://github.com/esmini/esmini/releases).

- If you are working on windows, the library you will need is `esminiLib.dll`

- If you are working on Linux, the library is `libesminiLib.so`

The library file needs to be downloaded on user local computer.

Then, the application searches for the library file following this approach:

1. Check if library file is present in the folder pointed by the `ESMINI_LIB_PATH` environment variable
2. Check if library file is present in the folder where the `ReportGUI` executable is present

So in order to use the plugin you can either:

- Define the ESMINI_LIB_PATH environment variable to where you downloaded the library file from esmini

e.g.
```
export ESMINI_LIB_PATH=/home/user/Downloads/esmini-demo/bin
```
- Copy the library file to the location where ReportGUI application is present
```
odrviewer --density 0 --window 100 100 800 800 --odr YOUR_ODR
```
e.g.
```
cp /home/user/Downloads/esmini-demo/bin/libesminiLib.so ~/qc-build/bin/
```
So in order to execute this you need to
1. Download esmini-demo from [esmini release page](https://github.com/esmini/esmini/releases)
2. Install `odrviewer` in your system path
- Linux install
Long term installation:
## Additional information
```
sudo mv esmini-demo/bin/odrviewer /usr/local/bin/
```
#### Which OpenDRIVE file to render
Short term installation:
In order to establish which openDRIVE file to render in esmini, the plugin reads the `InputFile`` param from currently shown result file:
```
export PATH=$PATH:esmini-demo/bin/
```
- If it is an OTX file, ignore it
- If it is an XODR file, wrap it in a simple and empty xosc file
- If it is an XOSC file, extract its XODR file and wrap it in a simple and empty xosc file
## Usage
The template empty scenario file is created starting from [the string defined here](./xml_util.h#30)
The plugin checks the input file pointed by the xqar file you are inspecting:
#### esminiLib function
- If it is an OTX file, the plugin does not show anything
- If it is an ODR file, the plugin shows it
- If it is an OSC file, the plugin get the correspoding openDRIVE file from the input openSCENARIO and shows that road network
The plugin uses the following function from esminiLib:
Currently the plugin has only the functionality of showing the road network and it is presented for demonstration purposes.
- [`SE_Init`](https://github.com/esmini/esmini/blob/master/EnvironmentSimulator/Libraries/esminiLib/esminiLib.cpp#L645): used to initialize the player to visualize the right OpenDRIVE file
- [`SE_GetIdByName`](https://github.com/esmini/esmini/blob/master/EnvironmentSimulator/Libraries/esminiLib/esminiLib.cpp#L1424): to retrieve the `marker` object used to move the camera in the scenario
- [`SE_ReportObjectPosXYH`](https://github.com/esmini/esmini/blob/master/EnvironmentSimulator/Libraries/esminiLib/esminiLib.cpp#L1191): used to move the camera at specified location
- [`SE_Step`](https://github.com/esmini/esmini/blob/master/EnvironmentSimulator/Libraries/esminiLib/esminiLib.cpp#L955): used to allow the esmini player to advance
- [`SE_Close`](https://github.com/esmini/esmini/blob/master/EnvironmentSimulator/Libraries/esminiLib/esminiLib.cpp#L939): used to close the esmini player
Loading

0 comments on commit f58695c

Please sign in to comment.