├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.md │ ├── feature_request.md │ └── question.md ├── pull_request_template.md └── workflows │ └── ci-build.yml ├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── Dockerfile ├── Dockerfile.nvidia ├── LICENSE ├── README.md ├── build-install-build-deps.sh ├── build-nvidia-docker.sh ├── build.sh ├── doc ├── _static │ └── images │ │ ├── Connection.png │ │ ├── Demo.png │ │ ├── FieldOfView.png │ │ ├── PlayBack.png │ │ ├── SaveOSIMessage.png │ │ └── osi_visualizer.png ├── howtocontribute.rst ├── nvidia-docker.rst └── panels.rst ├── include ├── appconfig.h ├── camera.h ├── customtreewidgetitem.h ├── definitions.h ├── demodatagenerator.h ├── displayobjectdialog.h ├── fmureceiver.h ├── glfieldofview.h ├── glgrid.h ├── gllanemarking.h ├── global.h ├── globject.h ├── glpoint.h ├── gltrafficsign.h ├── gltriangle.h ├── glvehicle.h ├── glwidget.h ├── imessagesource.h ├── lane.h ├── mainwindow.h ├── osiobjectstub.h ├── osiparser.h ├── osireader.h ├── pythoncomparedialog.h ├── tcpreceiver.h ├── types.h └── utils.h ├── install-deps.sh ├── resources ├── Images │ ├── BMW_Logo.png │ ├── Connection.png │ ├── Demo.png │ ├── FOV.png │ ├── Grid.png │ ├── Over_View.png │ ├── Pause.png │ ├── Play.png │ └── Playback.png ├── Python │ ├── README.md │ └── compare_data.py ├── Shaders │ ├── FragmentShader.frag │ └── VertexShader.vert └── resources.qrc ├── run-nvidia-docker.sh └── src ├── appconfig.cpp ├── camera.cpp ├── customtreewidgetitem.cpp ├── demodatagenerator.cpp ├── displayobjectdialog.cpp ├── fmureceiver.cpp ├── glfieldofview.cpp ├── glgrid.cpp ├── gllanemarking.cpp ├── globject.cpp ├── glpoint.cpp ├── gltrafficsign.cpp ├── gltriangle.cpp ├── glvehicle.cpp ├── glwidget.cpp ├── lane.cpp ├── main.cpp ├── mainwindow.cpp ├── mainwindow.ui ├── osiparser.cpp ├── osireader.cpp ├── pythoncomparedialog.cpp ├── tcpreceiver.cpp └── utils.cpp /.github/ISSUE_TEMPLATE/bug_report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug report 3 | about: Create a report to help us improve 4 | title: '' 5 | labels: bug 6 | assignees: '' 7 | 8 | --- 9 | 10 | #### Describe the bug 11 | A clear and concise description of what the bug is. 12 | 13 | #### Describe how to reproduce the bug 14 | Steps to reproduce the behavior: 15 | 1. Go to '...' 16 | 2. Click on '....' 17 | 3. Scroll down to '....' 18 | 4. See error 19 | 20 | #### Describe the expected behavior 21 | A clear and concise description of what you expected to happen. 22 | 23 | #### Show some screenshots 24 | If applicable, add screenshots to help explain your problem. 25 | 26 | #### Describe the OS you are using 27 | - OS: [e.g. iOS, Ubuntu 18.04, Windows 10, ...] 28 | - Language: [e.g. C++, Python, ...] 29 | - Version [e.g. 3.6.8] 30 | - Graphic card: [Nvidia, ...] 31 | - Drivers installed 32 | 33 | #### Additional context 34 | Add any other context about the bug here. 35 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature request 3 | about: Suggest an idea for this project 4 | title: '' 5 | labels: feature request 6 | assignees: '' 7 | 8 | --- 9 | 10 | #### Describe the feature 11 | Is your feature request related to a problem? 12 | A clear and concise description of what the problem is. 13 | Example: I am always frustrated when [...]. 14 | 15 | #### Describe the solution you would like 16 | A clear and concise description of what you want to happen. 17 | 18 | #### Describe alternatives you have considered 19 | A clear and concise description of any alternative solutions or features you have considered. 20 | 21 | #### Describe the backwards compatibility 22 | How does the feature impact the backwards compatibility of the current major version of OSI Visualization? 23 | If the suggested feature would be implemented would there be an issue with the previous versions of OSI Visualization? What part of OSI Visualization would break or improve by this feature? 24 | 25 | #### Additional context 26 | Add any other context or screenshots about the feature request here. 27 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/question.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Question 3 | about: Ask a question if you do not understand something or just want clarifications. 4 | title: '' 5 | labels: question 6 | assignees: '' 7 | 8 | --- 9 | 10 | #### Describe the problem 11 | I want to do ... in my application, but what I am actually getting is.... 12 | Here is a screenshot that illustrates the problem: 13 | 14 | `image.png` 15 | 16 | #### Describe what you have already tried 17 | This is the most simplified version of my code that I have been able to get, which still produces the problem I described above. 18 | 19 | // my code 20 | ... 21 | 22 | Basically, what the code is doing is.... 23 | Changing ... does not work because it gives the following error: 24 | 25 | 26 | Some error 27 | 28 | 29 | #### Describe your research 30 | [The documentation here] mentioned ... but did not provide a clear example of how that is done. 31 | [This Stack Overflow question] describes a similar problem, but mine is different because.... 32 | 33 | #### Ask your question 34 | So my basic question is, how do I...? 35 | 36 | #### Additional context 37 | Add any other context or screenshots about the question here. 38 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | #### Reference to a related issue in the repository 2 | Add a reference to a related issue in the repository. 3 | 4 | #### Add a description 5 | Add a description of the changes proposed in the pull request. 6 | 7 | **Some questions to ask**: 8 | What is this change? 9 | What does it fix? 10 | Is this a bug fix or a feature? Does it break any existing functionality or force me to update to a new version? 11 | How has it been tested? 12 | 13 | #### Mention a member 14 | Add @mentions of the person or team responsible for reviewing proposed changes. 15 | 16 | #### Check the checklist 17 | 18 | - [ ] I have performed a self-review of my own code. 19 | - [ ] I have made corresponding changes to the [documentation](https://github.com/OpenSimulationInterface/osi-documentation). 20 | - [ ] My changes generate no new warnings. 21 | - [ ] I have added tests that prove my fix is effective or that my feature works. 22 | - [ ] New and existing unit tests / github actions pass locally with my changes. -------------------------------------------------------------------------------- /.github/workflows/ci-build.yml: -------------------------------------------------------------------------------- 1 | name: OSI Visualizer build pipeline 2 | 3 | on: 4 | push: 5 | pull_request: 6 | branches: [ master ] 7 | 8 | # this is a test 9 | 10 | jobs: 11 | build-osi-visualizer: 12 | name: Build OSI Visualizer 13 | 14 | runs-on: ubuntu-latest 15 | 16 | steps: 17 | - name: Checkout OSI 18 | uses: actions/checkout@v2 19 | with: 20 | submodules: true 21 | 22 | # run setup scripts 23 | - name: Setup build 24 | shell: bash 25 | run: | 26 | sudo bash ./install-deps.sh 27 | sudo bash ./build-install-build-deps.sh 28 | 29 | # run build script 30 | - name: build visualizer 31 | shell: bash 32 | run: sudo bash ./build.sh 33 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # Prerequisites 2 | *.d 3 | 4 | # Compiled Object files 5 | *.slo 6 | *.lo 7 | *.o 8 | *.obj 9 | 10 | # Precompiled Headers 11 | *.gch 12 | *.pch 13 | 14 | # Compiled Dynamic libraries 15 | *.so 16 | *.dylib 17 | *.dll 18 | 19 | # Fortran module files 20 | *.mod 21 | *.smod 22 | 23 | # Compiled Static libraries 24 | *.lai 25 | *.la 26 | *.a 27 | *.lib 28 | 29 | # Executables 30 | *.exe 31 | *.out 32 | *.app 33 | 34 | # generated Protofiles 35 | proto/generated/ 36 | 37 | # build folder 38 | build 39 | cmake-build-debug 40 | osi-visualizer 41 | 42 | # Qtcreator project file 43 | CMakeLists.txt.user 44 | 45 | # Config file 46 | appconfig.xml 47 | 48 | # Directories 49 | .idea/ 50 | .vscode/ -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "open-simulation-interface"] 2 | path = open-simulation-interface 3 | url = https://github.com/OpenSimulationInterface/open-simulation-interface.git 4 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 3.1) 2 | add_subdirectory(open-simulation-interface) 3 | file(COPY resources DESTINATION .) 4 | project(osi-visualizer) 5 | 6 | set(CMAKE_CXX_STANDARD 14) 7 | 8 | set(CMAKE_INCLUDE_CURRENT_DIR ON) 9 | set(CMAKE_AUTOMOC ON) 10 | set(CMAKE_AUTOUIC ON) 11 | set(CMAKE_AUTORCC OFF) 12 | 13 | find_package(Qt5 COMPONENTS Core Gui OpenGL Widgets Xml Network REQUIRED) 14 | 15 | find_path( 16 | FMILIB_INCLUDE_DIRS 17 | fmilib.h 18 | HINTS /usr/include/fmi-library /usr/include /usr/local/include/fmi-library /usr/local/include 19 | ) 20 | 21 | find_library( 22 | FMILIB_LIBRARY 23 | fmilib_shared 24 | HINTS /usr/lib/fmi-library /usr/lib /usr/local/lib/fmi-library /usr/local/lib 25 | ) 26 | 27 | # Unfortunately CMAKE_AUTORCC does not automatically rebuild the qrc file if one 28 | # of the contained files changes. Set up rcc manually to ensure correct builds 29 | # even if e.g. the shaders change. 30 | set(RCC_OUTPUT_FILE ${CMAKE_CURRENT_BINARY_DIR}/rcc_resources.cpp) 31 | add_custom_command(OUTPUT ${RCC_OUTPUT_FILE} 32 | COMMAND ${Qt5Core_RCC_EXECUTABLE} 33 | ARGS -o ${RCC_OUTPUT_FILE} 34 | resources.qrc 35 | WORKING_DIRECTORY ${CMAKE_CURRENT_LIST_DIR}/resources 36 | MAIN_DEPENDENCY resources/resources.qrc 37 | DEPENDS resources/Shaders/FragmentShader.frag 38 | resources/Shaders/VertexShader.vert 39 | resources/Images/Grid.png 40 | VERBATIM) 41 | set_property(SOURCE ${RCC_OUTPUT_FILE} PROPERTY SKIP_AUTOMOC ON) 42 | set_property(SOURCE ${RCC_OUTPUT_FILE} PROPERTY SKIP_AUTOUIC ON) 43 | set_property(SOURCE ${RCC_OUTPUT_FILE} PROPERTY SKIP_AUTOGEN ON) 44 | 45 | set(SOURCES 46 | src/main.cpp 47 | src/mainwindow.cpp 48 | src/pythoncomparedialog.cpp 49 | src/displayobjectdialog.cpp 50 | src/glwidget.cpp 51 | src/globject.cpp 52 | src/camera.cpp 53 | src/tcpreceiver.cpp 54 | src/osireader.cpp 55 | src/glvehicle.cpp 56 | src/gllanemarking.cpp 57 | src/lane.cpp 58 | src/glgrid.cpp 59 | src/customtreewidgetitem.cpp 60 | src/gltriangle.cpp 61 | src/appconfig.cpp 62 | src/glpoint.cpp 63 | src/gltrafficsign.cpp 64 | src/osiparser.cpp 65 | src/glfieldofview.cpp 66 | src/fmureceiver.cpp 67 | src/utils.cpp 68 | ${CMAKE_CURRENT_BINARY_DIR}/rcc_resources.cpp 69 | ) 70 | 71 | set(HEADERS 72 | include/mainwindow.h 73 | include/pythoncomparedialog.h 74 | include/displayobjectdialog.h 75 | include/glwidget.h 76 | include/globject.h 77 | include/camera.h 78 | include/imessagesource.h 79 | include/tcpreceiver.h 80 | include/osireader.h 81 | include/glvehicle.h 82 | include/gllanemarking.h 83 | include/lane.h 84 | include/glgrid.h 85 | include/types.h 86 | include/customtreewidgetitem.h 87 | include/gltriangle.h 88 | include/appconfig.h 89 | include/global.h 90 | include/glpoint.h 91 | include/gltrafficsign.h 92 | include/osiparser.h 93 | include/glfieldofview.h 94 | include/fmureceiver.h 95 | include/utils.h 96 | ) 97 | 98 | 99 | include_directories( 100 | ${CMAKE_CURRENT_LIST_DIR}/include 101 | ${FMILIB_INCLUDE_DIRS} 102 | ) 103 | 104 | 105 | add_executable(${PROJECT_NAME} 106 | ${HEADERS} 107 | ${SOURCES} 108 | ) 109 | 110 | target_link_libraries(${PROJECT_NAME} 111 | Qt5::Core 112 | Qt5::Widgets 113 | Qt5::Xml 114 | Qt5::Gui 115 | Qt5::OpenGL 116 | Qt5::Network 117 | 118 | open_simulation_interface 119 | ${FMILIB_LIBRARY} 120 | protobuf 121 | zmq 122 | ) 123 | 124 | -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | FROM ubuntu:latest 2 | 3 | RUN mkdir -p /project 4 | RUN apt-get update && apt-get install -y git vim unzip zip cmake gcc g++ qtbase5-dev libprotobuf-dev protobuf-compiler libzmq3-dev wget 5 | RUN mkdir -p /build 6 | WORKDIR /build 7 | RUN wget https://jmodelica.org/fmil/FMILibrary-2.0.3-src.zip && unzip FMILibrary-2.0.3-src.zip && mkdir build-fmil && cd build-fmil && cmake -DFMILIB_INSTALL_PREFIX=/usr/local ../FMILibrary-2.0.3 && make install 8 | 9 | VOLUME [ "/project"] 10 | WORKDIR /project 11 | -------------------------------------------------------------------------------- /Dockerfile.nvidia: -------------------------------------------------------------------------------- 1 | FROM nvidia/opengl:1.0-glvnd-devel 2 | 3 | # protobuf and osi-visualizer dependencies 4 | RUN apt-get update && apt-get install -y \ 5 | autoconf \ 6 | automake \ 7 | cmake \ 8 | curl \ 9 | doxygen \ 10 | g++ \ 11 | gcc \ 12 | git \ 13 | libtool \ 14 | libprotobuf-dev \ 15 | libzmq3-dev \ 16 | make \ 17 | protobuf-compiler \ 18 | qtbase5-dev \ 19 | unzip \ 20 | vim \ 21 | wget \ 22 | zip 23 | 24 | # install FMI Library 25 | RUN mkdir -p /build 26 | WORKDIR /build 27 | ENV FMI_VERSION="2.0.3" 28 | RUN wget https://jmodelica.org/fmil/FMILibrary-${FMI_VERSION}-src.zip \ 29 | && unzip FMILibrary-${FMI_VERSION}-src.zip \ 30 | && mkdir build-fmil \ 31 | && cd build-fmil \ 32 | && cmake -DFMILIB_INSTALL_PREFIX=/usr/local ../FMILibrary-${FMI_VERSION} \ 33 | && make install 34 | 35 | # build open-simulation interface and osi-visualizer 36 | WORKDIR /opt/osi-visualizer 37 | 38 | COPY ./ /opt/osi-visualizer/ 39 | 40 | RUN mkdir build \ 41 | && cd build \ 42 | && cmake .. \ 43 | && make \ 44 | && cp osi-visualizer ../osi-visualizer 45 | 46 | # add osi-visualizer to path 47 | ENV PATH="/opt/osi-visualizer:$PATH" 48 | 49 | # set workdir so that default command works 50 | WORKDIR /opt/osi-visualizer 51 | CMD /opt/osi-visualizer/osi-visualizer 52 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | OSI Visualizer 2 | =============================== 3 | 4 | Copyright (C) 2017 BMW AG 5 | 6 | This Source Code Form is subject to the terms of the Mozilla Public 7 | License, v. 2.0. If a copy of the MPL was not distributed with this 8 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 9 | 10 | Mozilla Public License Version 2.0 11 | ================================== 12 | 13 | 1. Definitions 14 | -------------- 15 | 16 | 1.1. "Contributor" 17 | means each individual or legal entity that creates, contributes to 18 | the creation of, or owns Covered Software. 19 | 20 | 1.2. "Contributor Version" 21 | means the combination of the Contributions of others (if any) used 22 | by a Contributor and that particular Contributor's Contribution. 23 | 24 | 1.3. "Contribution" 25 | means Covered Software of a particular Contributor. 26 | 27 | 1.4. "Covered Software" 28 | means Source Code Form to which the initial Contributor has attached 29 | the notice in Exhibit A, the Executable Form of such Source Code 30 | Form, and Modifications of such Source Code Form, in each case 31 | including portions thereof. 32 | 33 | 1.5. "Incompatible With Secondary Licenses" 34 | means 35 | 36 | (a) that the initial Contributor has attached the notice described 37 | in Exhibit B to the Covered Software; or 38 | 39 | (b) that the Covered Software was made available under the terms of 40 | version 1.1 or earlier of the License, but not also under the 41 | terms of a Secondary License. 42 | 43 | 1.6. "Executable Form" 44 | means any form of the work other than Source Code Form. 45 | 46 | 1.7. "Larger Work" 47 | means a work that combines Covered Software with other material, in 48 | a separate file or files, that is not Covered Software. 49 | 50 | 1.8. "License" 51 | means this document. 52 | 53 | 1.9. "Licensable" 54 | means having the right to grant, to the maximum extent possible, 55 | whether at the time of the initial grant or subsequently, any and 56 | all of the rights conveyed by this License. 57 | 58 | 1.10. "Modifications" 59 | means any of the following: 60 | 61 | (a) any file in Source Code Form that results from an addition to, 62 | deletion from, or modification of the contents of Covered 63 | Software; or 64 | 65 | (b) any new file in Source Code Form that contains any Covered 66 | Software. 67 | 68 | 1.11. "Patent Claims" of a Contributor 69 | means any patent claim(s), including without limitation, method, 70 | process, and apparatus claims, in any patent Licensable by such 71 | Contributor that would be infringed, but for the grant of the 72 | License, by the making, using, selling, offering for sale, having 73 | made, import, or transfer of either its Contributions or its 74 | Contributor Version. 75 | 76 | 1.12. "Secondary License" 77 | means either the GNU General Public License, Version 2.0, the GNU 78 | Lesser General Public License, Version 2.1, the GNU Affero General 79 | Public License, Version 3.0, or any later versions of those 80 | licenses. 81 | 82 | 1.13. "Source Code Form" 83 | means the form of the work preferred for making modifications. 84 | 85 | 1.14. "You" (or "Your") 86 | means an individual or a legal entity exercising rights under this 87 | License. For legal entities, "You" includes any entity that 88 | controls, is controlled by, or is under common control with You. For 89 | purposes of this definition, "control" means (a) the power, direct 90 | or indirect, to cause the direction or management of such entity, 91 | whether by contract or otherwise, or (b) ownership of more than 92 | fifty percent (50%) of the outstanding shares or beneficial 93 | ownership of such entity. 94 | 95 | 2. License Grants and Conditions 96 | -------------------------------- 97 | 98 | 2.1. Grants 99 | 100 | Each Contributor hereby grants You a world-wide, royalty-free, 101 | non-exclusive license: 102 | 103 | (a) under intellectual property rights (other than patent or trademark) 104 | Licensable by such Contributor to use, reproduce, make available, 105 | modify, display, perform, distribute, and otherwise exploit its 106 | Contributions, either on an unmodified basis, with Modifications, or 107 | as part of a Larger Work; and 108 | 109 | (b) under Patent Claims of such Contributor to make, use, sell, offer 110 | for sale, have made, import, and otherwise transfer either its 111 | Contributions or its Contributor Version. 112 | 113 | 2.2. Effective Date 114 | 115 | The licenses granted in Section 2.1 with respect to any Contribution 116 | become effective for each Contribution on the date the Contributor first 117 | distributes such Contribution. 118 | 119 | 2.3. Limitations on Grant Scope 120 | 121 | The licenses granted in this Section 2 are the only rights granted under 122 | this License. No additional rights or licenses will be implied from the 123 | distribution or licensing of Covered Software under this License. 124 | Notwithstanding Section 2.1(b) above, no patent license is granted by a 125 | Contributor: 126 | 127 | (a) for any code that a Contributor has removed from Covered Software; 128 | or 129 | 130 | (b) for infringements caused by: (i) Your and any other third party's 131 | modifications of Covered Software, or (ii) the combination of its 132 | Contributions with other software (except as part of its Contributor 133 | Version); or 134 | 135 | (c) under Patent Claims infringed by Covered Software in the absence of 136 | its Contributions. 137 | 138 | This License does not grant any rights in the trademarks, service marks, 139 | or logos of any Contributor (except as may be necessary to comply with 140 | the notice requirements in Section 3.4). 141 | 142 | 2.4. Subsequent Licenses 143 | 144 | No Contributor makes additional grants as a result of Your choice to 145 | distribute the Covered Software under a subsequent version of this 146 | License (see Section 10.2) or under the terms of a Secondary License (if 147 | permitted under the terms of Section 3.3). 148 | 149 | 2.5. Representation 150 | 151 | Each Contributor represents that the Contributor believes its 152 | Contributions are its original creation(s) or it has sufficient rights 153 | to grant the rights to its Contributions conveyed by this License. 154 | 155 | 2.6. Fair Use 156 | 157 | This License is not intended to limit any rights You have under 158 | applicable copyright doctrines of fair use, fair dealing, or other 159 | equivalents. 160 | 161 | 2.7. Conditions 162 | 163 | Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted 164 | in Section 2.1. 165 | 166 | 3. Responsibilities 167 | ------------------- 168 | 169 | 3.1. Distribution of Source Form 170 | 171 | All distribution of Covered Software in Source Code Form, including any 172 | Modifications that You create or to which You contribute, must be under 173 | the terms of this License. You must inform recipients that the Source 174 | Code Form of the Covered Software is governed by the terms of this 175 | License, and how they can obtain a copy of this License. You may not 176 | attempt to alter or restrict the recipients' rights in the Source Code 177 | Form. 178 | 179 | 3.2. Distribution of Executable Form 180 | 181 | If You distribute Covered Software in Executable Form then: 182 | 183 | (a) such Covered Software must also be made available in Source Code 184 | Form, as described in Section 3.1, and You must inform recipients of 185 | the Executable Form how they can obtain a copy of such Source Code 186 | Form by reasonable means in a timely manner, at a charge no more 187 | than the cost of distribution to the recipient; and 188 | 189 | (b) You may distribute such Executable Form under the terms of this 190 | License, or sublicense it under different terms, provided that the 191 | license for the Executable Form does not attempt to limit or alter 192 | the recipients' rights in the Source Code Form under this License. 193 | 194 | 3.3. Distribution of a Larger Work 195 | 196 | You may create and distribute a Larger Work under terms of Your choice, 197 | provided that You also comply with the requirements of this License for 198 | the Covered Software. If the Larger Work is a combination of Covered 199 | Software with a work governed by one or more Secondary Licenses, and the 200 | Covered Software is not Incompatible With Secondary Licenses, this 201 | License permits You to additionally distribute such Covered Software 202 | under the terms of such Secondary License(s), so that the recipient of 203 | the Larger Work may, at their option, further distribute the Covered 204 | Software under the terms of either this License or such Secondary 205 | License(s). 206 | 207 | 3.4. Notices 208 | 209 | You may not remove or alter the substance of any license notices 210 | (including copyright notices, patent notices, disclaimers of warranty, 211 | or limitations of liability) contained within the Source Code Form of 212 | the Covered Software, except that You may alter any license notices to 213 | the extent required to remedy known factual inaccuracies. 214 | 215 | 3.5. Application of Additional Terms 216 | 217 | You may choose to offer, and to charge a fee for, warranty, support, 218 | indemnity or liability obligations to one or more recipients of Covered 219 | Software. However, You may do so only on Your own behalf, and not on 220 | behalf of any Contributor. You must make it absolutely clear that any 221 | such warranty, support, indemnity, or liability obligation is offered by 222 | You alone, and You hereby agree to indemnify every Contributor for any 223 | liability incurred by such Contributor as a result of warranty, support, 224 | indemnity or liability terms You offer. You may include additional 225 | disclaimers of warranty and limitations of liability specific to any 226 | jurisdiction. 227 | 228 | 4. Inability to Comply Due to Statute or Regulation 229 | --------------------------------------------------- 230 | 231 | If it is impossible for You to comply with any of the terms of this 232 | License with respect to some or all of the Covered Software due to 233 | statute, judicial order, or regulation then You must: (a) comply with 234 | the terms of this License to the maximum extent possible; and (b) 235 | describe the limitations and the code they affect. Such description must 236 | be placed in a text file included with all distributions of the Covered 237 | Software under this License. Except to the extent prohibited by statute 238 | or regulation, such description must be sufficiently detailed for a 239 | recipient of ordinary skill to be able to understand it. 240 | 241 | 5. Termination 242 | -------------- 243 | 244 | 5.1. The rights granted under this License will terminate automatically 245 | if You fail to comply with any of its terms. However, if You become 246 | compliant, then the rights granted under this License from a particular 247 | Contributor are reinstated (a) provisionally, unless and until such 248 | Contributor explicitly and finally terminates Your grants, and (b) on an 249 | ongoing basis, if such Contributor fails to notify You of the 250 | non-compliance by some reasonable means prior to 60 days after You have 251 | come back into compliance. Moreover, Your grants from a particular 252 | Contributor are reinstated on an ongoing basis if such Contributor 253 | notifies You of the non-compliance by some reasonable means, this is the 254 | first time You have received notice of non-compliance with this License 255 | from such Contributor, and You become compliant prior to 30 days after 256 | Your receipt of the notice. 257 | 258 | 5.2. If You initiate litigation against any entity by asserting a patent 259 | infringement claim (excluding declaratory judgment actions, 260 | counter-claims, and cross-claims) alleging that a Contributor Version 261 | directly or indirectly infringes any patent, then the rights granted to 262 | You by any and all Contributors for the Covered Software under Section 263 | 2.1 of this License shall terminate. 264 | 265 | 5.3. In the event of termination under Sections 5.1 or 5.2 above, all 266 | end user license agreements (excluding distributors and resellers) which 267 | have been validly granted by You or Your distributors under this License 268 | prior to termination shall survive termination. 269 | 270 | ************************************************************************ 271 | * * 272 | * 6. Disclaimer of Warranty * 273 | * ------------------------- * 274 | * * 275 | * Covered Software is provided under this License on an "as is" * 276 | * basis, without warranty of any kind, either expressed, implied, or * 277 | * statutory, including, without limitation, warranties that the * 278 | * Covered Software is free of defects, merchantable, fit for a * 279 | * particular purpose or non-infringing. The entire risk as to the * 280 | * quality and performance of the Covered Software is with You. * 281 | * Should any Covered Software prove defective in any respect, You * 282 | * (not any Contributor) assume the cost of any necessary servicing, * 283 | * repair, or correction. This disclaimer of warranty constitutes an * 284 | * essential part of this License. No use of any Covered Software is * 285 | * authorized under this License except under this disclaimer. * 286 | * * 287 | ************************************************************************ 288 | 289 | ************************************************************************ 290 | * * 291 | * 7. Limitation of Liability * 292 | * -------------------------- * 293 | * * 294 | * Under no circumstances and under no legal theory, whether tort * 295 | * (including negligence), contract, or otherwise, shall any * 296 | * Contributor, or anyone who distributes Covered Software as * 297 | * permitted above, be liable to You for any direct, indirect, * 298 | * special, incidental, or consequential damages of any character * 299 | * including, without limitation, damages for lost profits, loss of * 300 | * goodwill, work stoppage, computer failure or malfunction, or any * 301 | * and all other commercial damages or losses, even if such party * 302 | * shall have been informed of the possibility of such damages. This * 303 | * limitation of liability shall not apply to liability for death or * 304 | * personal injury resulting from such party's negligence to the * 305 | * extent applicable law prohibits such limitation. Some * 306 | * jurisdictions do not allow the exclusion or limitation of * 307 | * incidental or consequential damages, so this exclusion and * 308 | * limitation may not apply to You. * 309 | * * 310 | ************************************************************************ 311 | 312 | 8. Litigation 313 | ------------- 314 | 315 | Any litigation relating to this License may be brought only in the 316 | courts of a jurisdiction where the defendant maintains its principal 317 | place of business and such litigation shall be governed by laws of that 318 | jurisdiction, without reference to its conflict-of-law provisions. 319 | Nothing in this Section shall prevent a party's ability to bring 320 | cross-claims or counter-claims. 321 | 322 | 9. Miscellaneous 323 | ---------------- 324 | 325 | This License represents the complete agreement concerning the subject 326 | matter hereof. If any provision of this License is held to be 327 | unenforceable, such provision shall be reformed only to the extent 328 | necessary to make it enforceable. Any law or regulation which provides 329 | that the language of a contract shall be construed against the drafter 330 | shall not be used to construe this License against a Contributor. 331 | 332 | 10. Versions of the License 333 | --------------------------- 334 | 335 | 10.1. New Versions 336 | 337 | Mozilla Foundation is the license steward. Except as provided in Section 338 | 10.3, no one other than the license steward has the right to modify or 339 | publish new versions of this License. Each version will be given a 340 | distinguishing version number. 341 | 342 | 10.2. Effect of New Versions 343 | 344 | You may distribute the Covered Software under the terms of the version 345 | of the License under which You originally received the Covered Software, 346 | or under the terms of any subsequent version published by the license 347 | steward. 348 | 349 | 10.3. Modified Versions 350 | 351 | If you create software not governed by this License, and you want to 352 | create a new license for such software, you may create and use a 353 | modified version of this License if you rename the license and remove 354 | any references to the name of the license steward (except to note that 355 | such modified license differs from this License). 356 | 357 | 10.4. Distributing Source Code Form that is Incompatible With Secondary 358 | Licenses 359 | 360 | If You choose to distribute Source Code Form that is Incompatible With 361 | Secondary Licenses under the terms of this version of the License, the 362 | notice described in Exhibit B of this License must be attached. 363 | 364 | Exhibit A - Source Code Form License Notice 365 | ------------------------------------------- 366 | 367 | This Source Code Form is subject to the terms of the Mozilla Public 368 | License, v. 2.0. If a copy of the MPL was not distributed with this 369 | file, You can obtain one at http://mozilla.org/MPL/2.0/. 370 | 371 | If it is not possible or desirable to put the notice in a particular 372 | file, then You may include the notice in a location (such as a LICENSE 373 | file in a relevant directory) where a recipient would be likely to look 374 | for such a notice. 375 | 376 | You may add additional accurate notices of copyright ownership. 377 | 378 | Exhibit B - "Incompatible With Secondary Licenses" Notice 379 | --------------------------------------------------------- 380 | 381 | This Source Code Form is "Incompatible With Secondary Licenses", as 382 | defined by the Mozilla Public License, v. 2.0. 383 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # OSI Visualizer 2 | 3 | [![OSI Visualizer build pipeline](https://github.com/OpenSimulationInterface/osi-visualizer/actions/workflows/ci-build.yml/badge.svg)](https://github.com/OpenSimulationInterface/osi-visualizer/actions/workflows/ci-build.yml) 4 | 5 | OSI Visualizer serves as a visualization tool for the current implementation of [OSI (Open Simulation Interface)](https://github.com/OpenSimulationInterface/open-simulation-interface) messages. It supports `GroundTruth`, `SensorView` and `SensorData` messages and allows the visualization of two independent data channels using different input types (file and network stream). For more information see the documentation [here](https://opensimulationinterface.github.io/osi-documentation/osi-visualizer/README.html). 6 | 7 | ## Usage 8 | 9 | Use the configuration panel at the right (see Screenshot below) to load e.g. a [OSI trace file](https://opensimulationinterface.github.io/osi-documentation/open-simulation-interface/doc/fileformat.html) for channel 1 at `Playback` and choose a port to which it will be send (here 5564). Select the data type `SensorView` according to the content of the file. After that enter into the IP field the `localhost` and into the port field the receiving port (here 5563) for channel 2 in the panel below at `Connection`. Select the data type it is expected to visualize (here `SensorData`). In this example an intermediary on localhost processes the data from the input file using a [OSMP](https://github.com/OpenSimulationInterface/osi-sensor-model-packaging) sensor model, transforms it into `SensorData` and sends it to port 5563. 10 | 11 | ![](resources/Images/Over_View.png) 12 | 13 | Now you can click on play for channel 1 and 2 and you can visualize the communication between these two channels. Channel 1 plays the selected OSI input file scenario and sends out the OSI message to port 5564 at the same time. Channel 2 visualizes the received OSI messages at `localhost` at port 5563 showing it on the canvas (see demo screenshot below). 14 | 15 | ![](resources/Images/Demo.png) 16 | 17 | ## Installation 18 | 19 | #### Environment and dependencies 20 | 21 | Currently we recommend users to use the osi-visualizer under Ubuntu Linux 18.04 LTS. You can see a working development environment based on Ubuntu 18.04 LTS in the Docker file in the repository. 22 | 23 | * [cmake](https://cmake.org/) (>= 3.5) 24 | * [Qt](http://download.qt.io/official_releases/qt/) (>= 5.5.0) 25 | * [ZeroMQ](http://zeromq.org/intro:get-the-software) (>= 4.2.1) OSI Visualizer needs to use ZeroMQ libraries to complete the socket communication between different sensor / traffic / scenario simulators. Note that the C++ Bindings are required as well. 26 | * [protobuf](https://github.com/google/protobuf) (>= 2.6.1) 27 | * [FMILibrary](https://svn.jmodelica.org/FMILibrary/tags) (>= 2.0.2) 28 | * [OSI](https://github.com/OpenSimulationInterface/open-simulation-interface.git) (>= 3.1.2) 29 | 30 | 31 | It is often a good idea to first update the system using 32 | 33 | ```bash 34 | $ sudo apt-get update && sudo apt-get upgrade && sudo apt-get autoremove 35 | ``` 36 | 37 | to ensure up-to-date packages. 38 | 39 | You can install package dependencies using the provided `install-deps.sh`, and OSI and FMILibrary build dependencies using the provided `build-install-build-deps.sh`: 40 | 41 | ```bash 42 | $ sudo bash install-deps.sh 43 | $ sudo bash build-install-build-deps.sh 44 | ``` 45 | 46 | #### Build and run 47 | ```bash 48 | $ bash build.sh 49 | $ ./build/osi-visualizer 50 | ``` 51 | 52 | or just manually if dependecies are already installed: 53 | 54 | ```bash 55 | $ git clone https://github.com/OpenSimulationInterface/osi-visualizer.git 56 | $ cd osi-visualizer 57 | $ git submodule update --init 58 | $ mkdir build 59 | $ cd build 60 | $ cmake .. 61 | $ make -j8 62 | $ ./osi-visualizer 63 | ``` 64 | -------------------------------------------------------------------------------- /build-install-build-deps.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo " 4 | ################################# 5 | # Installing OSI 3 6 | ################################# 7 | " 8 | git submodule update --init 9 | cd open-simulation-interface 10 | git clone https://github.com/OpenSimulationInterface/proto2cpp.git 11 | mkdir -p build 12 | cd build 13 | cmake .. 14 | make -j8 15 | make install 16 | cd ../.. 17 | 18 | 19 | echo " 20 | ################################# 21 | # Installing FMI 2.0.2 22 | ################################# 23 | " 24 | mkdir -p fmi_library 25 | cd fmi_library 26 | 27 | fmi_library_include_install_dir=/usr/local/include/fmi-library 28 | fmi_library_lib_install_dir=/usr/local/lib/fmi-library 29 | 30 | if ! [ -e ${fmi_library_include_install_dir} -a -e ${fmi_library_lib_install_dir} ] 31 | then 32 | echo "Downloading FMI library..." 33 | 34 | if [ ! -d FMILibrary-2.0.2 ] 35 | then 36 | wget --no-parent -nH --cut-dirs=2 -r https://jmodelica.org/FMILibrary/FMILibrary-2.0.2-src.zip 37 | fi 38 | 39 | echo "Building FMI library..." 40 | unzip FMILibrary-2.0.2-src.zip 41 | cd FMILibrary-2.0.2 42 | mkdir -p build 43 | cd build 44 | cmake .. 45 | make -j8 46 | make -j8 install 47 | cd ../install 48 | 49 | if [ ! -d ${fmi_library_include_install_dir} ] 50 | then 51 | sudo mkdir -p ${fmi_library_include_install_dir} 52 | sudo cp -uvrf ./include/* ${fmi_library_include_install_dir}/ 53 | fi 54 | 55 | if [ ! -d ${fmi_library_lib_install_dir} ] 56 | then 57 | sudo mkdir -p ${fmi_library_lib_install_dir} 58 | sudo cp -uvrf ./lib/* ${fmi_library_lib_install_dir}/ 59 | fi 60 | fi -------------------------------------------------------------------------------- /build-nvidia-docker.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | docker build -f Dockerfile.nvidia -t osi-standard/osi-visualizer-nvidia . 3 | -------------------------------------------------------------------------------- /build.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | echo " 4 | ################################# 5 | # Building OSI Visualizer 6 | ################################# 7 | " 8 | mkdir -p build 9 | cd build 10 | cmake .. 11 | make -j8 12 | -------------------------------------------------------------------------------- /doc/_static/images/Connection.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimulationInterface/osi-visualizer/763bec95626761bd0900a93eecb2992a6abac342/doc/_static/images/Connection.png -------------------------------------------------------------------------------- /doc/_static/images/Demo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimulationInterface/osi-visualizer/763bec95626761bd0900a93eecb2992a6abac342/doc/_static/images/Demo.png -------------------------------------------------------------------------------- /doc/_static/images/FieldOfView.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimulationInterface/osi-visualizer/763bec95626761bd0900a93eecb2992a6abac342/doc/_static/images/FieldOfView.png -------------------------------------------------------------------------------- /doc/_static/images/PlayBack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimulationInterface/osi-visualizer/763bec95626761bd0900a93eecb2992a6abac342/doc/_static/images/PlayBack.png -------------------------------------------------------------------------------- /doc/_static/images/SaveOSIMessage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimulationInterface/osi-visualizer/763bec95626761bd0900a93eecb2992a6abac342/doc/_static/images/SaveOSIMessage.png -------------------------------------------------------------------------------- /doc/_static/images/osi_visualizer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/OpenSimulationInterface/osi-visualizer/763bec95626761bd0900a93eecb2992a6abac342/doc/_static/images/osi_visualizer.png -------------------------------------------------------------------------------- /doc/howtocontribute.rst: -------------------------------------------------------------------------------- 1 | Contributors' Guidelines 2 | ========================== 3 | 4 | Introduction 5 | ------------ 6 | 7 | The purpose of this document is to help contributors get started with 8 | the OSI Visualizer codebase. 9 | 10 | 11 | Reporting issues 12 | ---------------- 13 | 14 | The simplest way to contribute to OSI Visualizer is to report issues that you may 15 | find with the project on `github `__. Everyone can create issues. 16 | Always make sure to search the existing issues before reporting a new one. 17 | Issues may be created to discuss: 18 | 19 | - `Feature requests or Ideas `_ 20 | - `Bugs `_ 21 | - `Questions `_ 22 | - `Other `_ 23 | 24 | If practicable issues should be closed by a referenced pull request or commit (`here `_ you can find keywords to close issues automatically). To help developers and maintainers we provide a `pull request template `_ which will be generated each time you create a new pull request. 25 | 26 | See `here `_ for more on our git workflow. 27 | 28 | Documentation 29 | ---------------- 30 | 31 | - Documentation changes can be performed by anyone. 32 | - Consider adding stuff to the `osi-documentation `_ or directly to the `doc `_ folder in the repository. 33 | - When new changes are made directly to the `osi-documentation `_ repo the documentation will be rebuild and the new changes can be seen. When making documentation changes in the `doc `_ folder of the repository the changes will be visible when the daily chron job of osi-documentation is executed. 34 | -------------------------------------------------------------------------------- /doc/nvidia-docker.rst: -------------------------------------------------------------------------------- 1 | Nvidia Docker 2 | ============== 3 | 4 | The aim is to be able to run the osi-visualizer in docker to 5 | provide an automated and flexible way for downloading, installing and setting up all necessary files and dependencies for osi-visualizer. Ideally it would only take time to build the first docker image, after that starting the image, i.e. running the visualizer, will be straight forward. 6 | 7 | General Information 8 | ------------------- 9 | 10 | The following Docker version was used: Docker version 18.03.1-ce, build 9ee9f40 11 | 12 | For download and installation please refer to the following link: 13 | https://docs.docker.com/install/linux/docker-ce/ubuntu/ 14 | 15 | You will also need nvidia-docker2, please refer to the following link: 16 | https://github.com/NVIDIA/nvidia-docker/wiki/Installation-(version-2.0) 17 | 18 | Build 19 | ----- 20 | .. code-block:: bash 21 | 22 | cd osi-visualizer 23 | sh build-nvidia-docker.sh # will build the image for you 24 | sh run-nvidia-docker.sh # will run the visualizer for you 25 | 26 | OSI-Visualizer protobuf files 27 | ----------------------------- 28 | 29 | In order to load files into osi-visualizer, you need to place your *.pb files in "osi_pb" (mounted as a volume to the image). 30 | 31 | Note 32 | ----- 33 | 34 | Currently the osi-visualizer is set up and tested to work with the 35 | playback option, for using other functionalities of the 36 | osi-visualizer like socket communication then some updates should 37 | probably be done to the docker file. 38 | 39 | If after running the image the following error appears: 40 | 41 | .. code-block:: bash 42 | 43 | Creating network “osi-visualizer_default” with the default driver 44 | No protocol specified QXcbConnection: Could not connect to display:1 45 | 46 | then add the following command and run the image again (no need to 47 | build the docker image again): 48 | 49 | .. code-block:: bash 50 | 51 | sudo xhost + -------------------------------------------------------------------------------- /doc/panels.rst: -------------------------------------------------------------------------------- 1 | Panels 2 | ======== 3 | 4 | Connection: 5 | ------------- 6 | 7 | The channel receives osi message from the network with specific IP 8 | address and port number, and shows up different data types. 9 | 10 | .. image:: _static/images/Connection.png 11 | :align: center 12 | 13 | Playback: 14 | ------------- 15 | 16 | The channel receives osi message from the loaded file. The tool will 17 | check a header file of the same name with a extension: .txth. If it doesn't 18 | exist, the tool will create one automatically for the first time. A 19 | "Delta-Delay" variable can be set to slow down the playback speed in 20 | case of very large message files. By default this value is "0" ms. 21 | 22 | Example: Set it to 10 ms, each message will have 10 ms more delay for 23 | playing. 24 | 25 | Besides the tool provides sending out osi message to network with specific port number. 26 | 27 | .. image:: _static/images/PlayBack.png 28 | :align: center 29 | 30 | Show Field of View: 31 | -------------------- 32 | 33 | Shows the field of view for sensors, like lidar, on the grid. Users can set 34 | minimum range, maximum range, azimuth positive angle and azimuth 35 | negative angle. 36 | 37 | .. image:: _static/images/FieldOfView.png 38 | :align: center 39 | 40 | Save OSI Message: 41 | ------------------ 42 | 43 | Log or cut out part of the osi message stream and save it to another 44 | file. By default the threshold is 1000000 OSI messages. The User can change 45 | this threshold in the `appconfig.cpp `_. 46 | 47 | .. image:: _static/images/SaveOSIMessage.png 48 | :align: center 49 | 50 | Menu options 51 | ---------------- 52 | 53 | File Menu: 54 | ~~~~~~~~~~~~ 55 | 56 | ``Play``: Play/Pause Channel 1 by default. 57 | 58 | ``Python Compare``: A standalone compare tool to compare two osi 59 | message file directly. By default, it takes the playback file from these 60 | two channels. It supports flexible selecting random file as well. Just 61 | put the python scripts into folder: ./Resources/Python/ before start 62 | this tool. Then all the scripts will be shown up in the "Python Scripts" 63 | select menu. The compare script should take the two osi files' full path 64 | as arguments. The compare result can be exported to a text file by 65 | clicking the "Export" button. 66 | 67 | ``Quit``: Quit the visualizer. 68 | 69 | View Menu: 70 | ~~~~~~~~~~~~ 71 | 72 | ``Combine Channels``: Config two channels' "Play/Pause" 73 | simultaneously, or not. It can only be checked when the channels are at 74 | the same status: both "Play" or "Pause". By default, it is unchecked. 75 | 76 | ``Show Grid``: Show up the grid in the canvas. By default, it is 77 | checked. 78 | 79 | ``Show Object details``: Select object from the Objects Overview tree. 80 | Show up the selected object's position, velocity and acceleration in 81 | another independent dialog. By default, it is checked. 82 | 83 | The others are self-explaining. 84 | 85 | Notice 86 | ------ 87 | 88 | When playing large osi files, try to adapt the Delta Delay. Then the 89 | tool renders smoothly. 90 | 91 | .. _OSI (Open Simulation Interface): https://github.com/OpenSimulationInterface/open-simulation-interface 92 | .. _`https://cmake.org/`: https://cmake.org/ 93 | .. _`http://download.qt.io/official_releases/qt/`: http://download.qt.io/official_releases/qt/ 94 | .. _`http://zeromq.org/intro:get-the-software`: http://zeromq.org/intro:get-the-software 95 | .. _`https://github.com/google/protobuf`: https://github.com/google/protobuf 96 | .. _`https://svn.jmodelica.org/FMILibrary/tags`: https://svn.jmodelica.org/FMILibrary/tags 97 | .. _Open Simulation Interface: https://github.com/OpenSimulationInterface/open-simulation-interface.git -------------------------------------------------------------------------------- /include/appconfig.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | #ifndef OSI_VISUALIZER_APP_CONFIG_H 8 | #define OSI_VISUALIZER_APP_CONFIG_H 9 | #include "types.h" 10 | #include 11 | #include 12 | 13 | class AppConfig 14 | { 15 | public: 16 | AppConfig(QString fileName); 17 | bool Load(); 18 | bool Save(); 19 | 20 | QString ch1IPAddress_; 21 | QString ch1PortNum_; 22 | DataType ch1DataType_; 23 | bool ch1FMURxCheck_; 24 | QString ch1LoadFMURx_; 25 | QString ch1LoadFile_; 26 | DataType ch1PlaybackDataType_; 27 | int ch1DeltaDelay_; 28 | bool ch1EnableSendOut_; 29 | QString ch1SendOutPortNum_; 30 | bool ch1FMUTxCheck_; 31 | QString ch1LoadFMUTx_; 32 | bool ch1ShowFOV_; 33 | float ch1MinRadius_; 34 | float ch1MaxRadius_; 35 | float ch1AzimuthPos_; 36 | float ch1AzimuthNeg_; 37 | 38 | QString ch2IPAddress_; 39 | QString ch2PortNum_; 40 | DataType ch2DataType_; 41 | bool ch2FMURxCheck_; 42 | QString ch2LoadFMURx_; 43 | QString ch2LoadFile_; 44 | DataType ch2PlaybackDataType_; 45 | int ch2DeltaDelay_; 46 | bool ch2EnableSendOut_; 47 | QString ch2SendOutPortNum_; 48 | bool ch2FMUTxCheck_; 49 | QString ch2LoadFMUTx_; 50 | bool ch2ShowFOV_; 51 | float ch2MinRadius_; 52 | float ch2MaxRadius_; 53 | float ch2AzimuthPos_; 54 | float ch2AzimuthNeg_; 55 | 56 | bool combineChannel_; 57 | bool showGrid_; 58 | bool showObjectDetails_; 59 | bool lockCamera_; 60 | LaneType laneType_; 61 | QMap typeColors_; 62 | 63 | int osiMsgSaveThreshold_; 64 | QString srcPath_; 65 | 66 | private: 67 | QString configFileName_; 68 | QString config_file_path_{"/tmp/lime/osi_visualizer"}; 69 | }; 70 | 71 | #endif // OSI_VISUALIZER_APP_CONFIG_H 72 | -------------------------------------------------------------------------------- /include/camera.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | #ifndef OSI_VISUALIZER_CAMERA_H 8 | #define OSI_VISUALIZER_CAMERA_H 9 | #include "globject.h" 10 | #include 11 | #include 12 | 13 | typedef enum 14 | { 15 | Default, 16 | BirdsEye 17 | } CameraPerspective; 18 | 19 | class Camera 20 | { 21 | public: 22 | explicit Camera(CameraPerspective perspective = Default); 23 | 24 | void UpdateUp(); 25 | void SetUp(QVector3D up); 26 | QVector3D GetUp() { return up_; } 27 | 28 | void UpdateRight(); 29 | QVector3D GetRight() { return right_; } 30 | 31 | void SetToObjectPosition(GLObject* object); 32 | void SetPosition(float x, float y, float z); 33 | void SetPosition(QVector3D position); 34 | QVector3D GetPosition() { return position_; } 35 | 36 | void SetOrientation(float orientation); 37 | float GetOrientation() { return orientation_; } 38 | 39 | void ResetAll(); 40 | void ResetPosition(); 41 | void ResetOrientation(); 42 | 43 | void Translate(QVector3D translation); 44 | void Translate(float x, float y, float z); 45 | 46 | void RotateAroundYAxis(float rotationRad); 47 | 48 | // void SetTarget(QVector3D target); 49 | // void SetTarget(float x, float y, float z); 50 | 51 | QMatrix4x4 viewMatrix_; 52 | GLObject* trackedObject_; 53 | QVector3D resetPosition_; 54 | 55 | private: 56 | void UpdateViewMatrix(); 57 | 58 | float minY_; 59 | float orientation_; 60 | QVector3D position_; 61 | QVector3D target_; 62 | QVector3D up_; 63 | QVector3D right_; 64 | QVector4D initialUp_; 65 | float resetOrientation_; 66 | }; 67 | #endif // OSI_VISUALIZER_CAMERA_H -------------------------------------------------------------------------------- /include/customtreewidgetitem.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | #ifndef OSI_VISUALIZER_CUSTOM_WIDGET_ITEM_H 8 | #define OSI_VISUALIZER_CUSTOM_WIDGET_ITEM_H 9 | #include "globject.h" 10 | #include "types.h" 11 | #include 12 | #include 13 | 14 | class CustomTreeWidgetItem : public QTreeWidgetItem 15 | { 16 | public: 17 | CustomTreeWidgetItem(GLObject* glObject); 18 | 19 | bool ignoreClick_; 20 | GLObject* glObject_; 21 | ObjectType objectType_; 22 | QElapsedTimer* lastClickTimer_; 23 | }; 24 | #endif // OSI_VISUALIZER_CUSTOM_WIDGET_ITEM_H -------------------------------------------------------------------------------- /include/definitions.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | 8 | #ifndef OSI_VISUALIZER_DEFINITIONS_H 9 | #define OSI_VISUALIZER_DEFINITIONS_H 10 | 11 | #include 12 | 13 | // Edit path according to the location of your source files 14 | const QString srcPath = "./"; 15 | 16 | #define DRAW_CENTER_LINES false 17 | #define DRAW_LANE_BOUNDARIES true 18 | 19 | #endif // OSI_VISUALIZER_DEFINITIONS_H 20 | -------------------------------------------------------------------------------- /include/demodatagenerator.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | #ifndef OSI_VISUALIZER_DEMO_DATA_GENERATOR_H 8 | #define OSI_VISUALIZER_DEMO_DATA_GENERATOR_H 9 | #include "osiobjectstub.h" 10 | #include 11 | 12 | class DemoDataGenerator 13 | { 14 | public: 15 | DemoDataGenerator(QList* vehicles); 16 | void Update(); 17 | 18 | private: 19 | QList* vehicles; 20 | }; 21 | #endif // OSI_VISUALIZER_DEMO_DATA_GENERATOR_H 22 | -------------------------------------------------------------------------------- /include/displayobjectdialog.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | #ifndef OSI_VISUALIZER_DISPLAY_OBJECT_DIALOG_H 8 | #define OSI_VISUALIZER_DISPLAY_OBJECT_DIALOG_H 9 | #ifdef _WIN32 10 | #define WIN32_LEAN_AND_MEAN 11 | #endif 12 | #include "globject.h" 13 | 14 | #include 15 | #include 16 | 17 | class DisplayObjectDialog : public QDialog 18 | { 19 | Q_OBJECT 20 | 21 | public: 22 | explicit DisplayObjectDialog(QWidget* parent); 23 | 24 | void UpdateObjectInformation(const GLObject& object); 25 | 26 | private: 27 | QLabel* positionX_; 28 | QLabel* positionY_; 29 | QLabel* positionZ_; 30 | QLabel* velocityX_; 31 | QLabel* velocityY_; 32 | QLabel* velocityZ_; 33 | QLabel* accelerationX_; 34 | QLabel* accelerationY_; 35 | QLabel* accelerationZ_; 36 | }; 37 | #endif // OSI_VISUALIZER_DISPLAY_OBJECT_DIALOG_H -------------------------------------------------------------------------------- /include/fmureceiver.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | 8 | 9 | 10 | #pragma once 11 | 12 | #include 13 | 14 | #include 15 | 16 | #include "osi_sensordata.pb.h" 17 | #include "imessagesource.h" 18 | #include "types.h" 19 | 20 | 21 | extern "C" { 22 | #include 23 | #include 24 | } 25 | 26 | /* The following names come from FMU modelDescription.in.xml */ 27 | #define FMI_SENDER_NAME "sender" 28 | #define FMI_RECEIVER_NAME "receiver" 29 | #define FMI_ADDRESS_NAME "address" 30 | #define FMI_PORT_NAME "port" 31 | 32 | #define FMI_DATA_OUT_BASELO_NAME "OSMPSensorDataOut.base.lo" 33 | #define FMI_DATA_OUT_BASEHI_NAME "OSMPSensorDataOut.base.hi" 34 | #define FMI_DATA_OUT_SIZE_NAME "OSMPSensorDataOut.size" 35 | 36 | /* local index defines */ 37 | #define FMI_INTEGER_SENSORDATA_OUT_BASELO_IDX 0 // correspond to FMI_DATA_OUT_BASELO_NAME 38 | #define FMI_INTEGER_SENSORDATA_OUT_BASEHI_IDX 1 // correspond to FMI_DATA_OUT_BASEHI_NAME 39 | #define FMI_INTEGER_SENSORDATA_OUT_SIZE_IDX 2 // correspond to FMI_DATA_OUT_SIZE_NAME 40 | #define FMI_INTEGER_LAST_OUT_IDX FMI_INTEGER_SENSORDATA_OUT_SIZE_IDX 41 | #define FMI_INTEGER_OUT_VARS (FMI_INTEGER_LAST_OUT_IDX + 1) 42 | 43 | class FMUReceiver: public QObject, public IMessageSource 44 | { 45 | Q_OBJECT 46 | 47 | public: 48 | FMUReceiver(); 49 | 50 | signals: 51 | void Connected(DataType dataType); 52 | void Disconnected(const QString& message = ""); 53 | void UpdateSliderTime(int sliderValue); 54 | void MessageSDReceived(const osi3::SensorData& sd); 55 | void MessageSVReceived(const osi3::SensorView& sv); 56 | 57 | public slots: 58 | void DisconnectRequested(); 59 | void ConnectRequested(const QString& ipAddress, 60 | const QString& port, 61 | const QString& fmuPath, 62 | DataType dataType); 63 | 64 | private: 65 | 66 | void ReceiveLoop(); 67 | 68 | bool isRunning_; 69 | bool isThreadTerminated_; 70 | DataType currentDataType_; 71 | 72 | 73 | // FMU interface 74 | fmi2_import_t* fmu_; 75 | fmi2_callback_functions_t callBackFunctions_; 76 | jm_callbacks callbacks_; 77 | fmi_import_context_t* context_; 78 | 79 | jm_status_enu_t jmStatus_; 80 | fmi2_status_t fmiStatus_; 81 | 82 | fmi2_real_t tStart_; 83 | fmi2_real_t tEnd_; 84 | fmi2_real_t tCurrent_; 85 | fmi2_real_t hStep_; 86 | 87 | std::string ip_; 88 | std::string port_; 89 | std::string FMUPath_; 90 | std::string tmpPath_; 91 | enum class LogLevel 92 | { 93 | Warn, 94 | Debug 95 | }; 96 | LogLevel logLevel_; 97 | std::string currentBuffer_; 98 | fmi2_value_reference_t vr_[FMI_INTEGER_OUT_VARS]; 99 | 100 | // initialize fmu wrapper specific logger, create fmi import context and check fmi version 101 | bool initializeFMUWrapper(); 102 | // import fmu binary file 103 | bool importFMU(); 104 | // setup and initialize FMU 105 | bool initializeFMU(); 106 | // protobuf accessors 107 | template bool get_fmi_sensor_data_in(T& data); 108 | }; 109 | 110 | 111 | -------------------------------------------------------------------------------- /include/glfieldofview.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | #ifndef OSI_VISUALIZER_GL_FIELD_OF_VIEW_H 8 | #define OSI_VISUALIZER_GL_FIELD_OF_VIEW_H 9 | #include "globject.h" 10 | 11 | class GLFieldOfView : public GLObject 12 | { 13 | public: 14 | GLFieldOfView(QOpenGLFunctions_4_3_Core* functions, 15 | const float minRadius, 16 | const float maxRadius, 17 | const float azimuthPosAngle, 18 | const float azimuthNegAngle); 19 | 20 | void UpdateParameter(const float minRadius, 21 | const float maxRadius, 22 | const float azimuthPosAngle, 23 | const float azimuthNegAngle); 24 | }; 25 | #endif // OSI_VISUALIZER_GL_FIELD_OF_VIEW_H -------------------------------------------------------------------------------- /include/glgrid.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | #ifndef OSI_VISUALIZER_GL_GRID_H 8 | #define OSI_VISUALIZER_GL_GRID_H 9 | #include "globject.h" 10 | 11 | class GLGrid : public GLObject 12 | { 13 | public: 14 | GLGrid(QOpenGLFunctions_4_3_Core* functions, const QString& srcPath); 15 | }; 16 | #endif // OSI_VISUALIZER_GL_GRID_H -------------------------------------------------------------------------------- /include/gllanemarking.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | #ifndef OSI_VISUALIZER_GL_LANE_MARKING_H 8 | #define OSI_VISUALIZER_GL_LANE_MARKING_H 9 | #include "globject.h" 10 | 11 | class GLLaneMarking : public GLObject 12 | { 13 | public: 14 | GLLaneMarking(QOpenGLFunctions_4_3_Core* functions, const QVector& laneMarkers); 15 | }; 16 | #endif // OSI_VISUALIZER_GL_LANE_MARKING_H -------------------------------------------------------------------------------- /include/global.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | #ifndef OSI_VISUALIZER_GLOBAL_H 8 | #define OSI_VISUALIZER_GLOBAL_H 9 | #include "types.h" 10 | #include 11 | #include 12 | 13 | class Global 14 | { 15 | public: 16 | static QString GetObjectTypeName(const ObjectType& type, bool plural = false) 17 | { 18 | QString name; 19 | switch (type) 20 | { 21 | case ObjectType::UnknownObject: 22 | name = "UnknownObject"; 23 | break; 24 | case ObjectType::OtherObject: 25 | name = "OtherObject"; 26 | break; 27 | case ObjectType::Car: 28 | name = "Car"; 29 | break; 30 | case ObjectType::Truck: 31 | name = "Truck"; 32 | break; 33 | case ObjectType::MotorBike: 34 | name = "MotorBike"; 35 | break; 36 | case ObjectType::Bicycle: 37 | name = "Bicycle"; 38 | break; 39 | case ObjectType::Trailer: 40 | name = "Trailer"; 41 | break; 42 | case ObjectType::Pedestrian: 43 | name = "Pedestrian"; 44 | break; 45 | case ObjectType::Animal: 46 | name = "Animal"; 47 | break; 48 | case ObjectType::Bridge: 49 | name = "Bridge"; 50 | break; 51 | case ObjectType::Building: 52 | name = "Building"; 53 | break; 54 | case ObjectType::Pylon: 55 | name = "Pylon"; 56 | break; 57 | case ObjectType::ReflectorPost: 58 | name = "ReflectorPost"; 59 | break; 60 | case ObjectType::Delineator: 61 | name = "Delineator"; 62 | break; 63 | case ObjectType::TrafficSign: 64 | name = "TrafficSign"; 65 | break; 66 | case ObjectType::TrafficLight: 67 | name = "TrafficLight"; 68 | break; 69 | default: 70 | break; 71 | } 72 | 73 | if (plural && type != ObjectType::UnknownObject) 74 | { 75 | name += "s"; 76 | } 77 | 78 | return name; 79 | } 80 | 81 | static QList GetAllObjectTypes() 82 | { 83 | QList types; 84 | types.append(ObjectType::UnknownObject); 85 | types.append(ObjectType::OtherObject); 86 | types.append(ObjectType::Car); 87 | types.append(ObjectType::Truck); 88 | types.append(ObjectType::MotorBike); 89 | types.append(ObjectType::Bicycle); 90 | types.append(ObjectType::Trailer); 91 | types.append(ObjectType::Pedestrian); 92 | types.append(ObjectType::Animal); 93 | types.append(ObjectType::Bridge); 94 | types.append(ObjectType::Building); 95 | types.append(ObjectType::Pylon); 96 | types.append(ObjectType::ReflectorPost); 97 | types.append(ObjectType::Delineator); 98 | types.append(ObjectType::TrafficSign); 99 | types.append(ObjectType::TrafficLight); 100 | 101 | return types; 102 | } 103 | }; 104 | #endif // OSI_VISUALIZER_GLOBAL_H -------------------------------------------------------------------------------- /include/globject.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | #ifndef OSI_VISUALIZER_GL_OBJECT_H 8 | #define OSI_VISUALIZER_GL_OBJECT_H 9 | #include "types.h" 10 | #include 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | 19 | class GLObject 20 | { 21 | public: 22 | GLObject(GLenum primitiveType, 23 | QOpenGLFunctions_4_3_Core* functions, 24 | QString id = "", 25 | GLenum drawType = GL_STATIC_DRAW); 26 | 27 | ~GLObject(); 28 | 29 | void Init(); 30 | void UpdateVertexBuffer(); 31 | void Translate(QVector3D position, bool updateMatrix = true); 32 | void Translate(float x, float y, float z, bool updateMatrix = true); 33 | void RotateAroundYAxis(float rotation, bool updateMatrix = true); 34 | 35 | void SetText(QString text); 36 | 37 | void SetTexture(QImage image, bool generateMipMaps); 38 | 39 | void SetColor(QColor color) { color_ = color; } 40 | QColor GetColor() const { return color_; } 41 | 42 | void SetPosition(QVector3D position, bool updateMatrix = true); 43 | void SetPosition(float x, float y, float z, bool updateMatrix = true); 44 | QVector3D GetPosition() const { return position_; } 45 | 46 | void SetOrientation(float orientation, bool updateMatrix = true); 47 | float GetOrientation() const { return orientation_; } 48 | 49 | GLenum GetPrimitiveType() const { return primitiveType_; } 50 | GLObject* GetTextObject() { return textObject_.get(); } 51 | 52 | void SetObjectType(ObjectType type) { objectType_ = type; } 53 | ObjectType GetObjectType() const { return objectType_; } 54 | 55 | QString id_; 56 | GLuint vaoId_; 57 | GLuint textureId_; 58 | QString text_; 59 | QSize halfSize_; 60 | bool isVisible_; 61 | bool forceInvisible_; 62 | bool alreadyInObjectTree_; 63 | QMatrix4x4 modelMatrix_; 64 | QVector vertices_; 65 | QVector texCoords_; 66 | QVector3D velocity_; 67 | QVector3D acceleration_; 68 | QVector3D realPosition_; 69 | 70 | private: 71 | void Update(bool updateMatrix); 72 | void GenerateDescriptionTexture(); 73 | 74 | GLuint vboId_; 75 | GLuint vboTexCoordId_; 76 | QColor color_; 77 | GLenum drawType_; 78 | float orientation_; 79 | QVector3D position_; 80 | GLenum primitiveType_; 81 | std::shared_ptr textObject_; 82 | bool isInitialized_; 83 | int lastVertexSize_; 84 | ObjectType objectType_; 85 | QOpenGLFunctions_4_3_Core* functions_; 86 | }; 87 | #endif // OSI_VISUALIZER_GL_OBJECT_H -------------------------------------------------------------------------------- /include/glpoint.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | #ifndef OSI_VISUALIZER_GL_POINT_H 8 | #define OSI_VISUALIZER_GL_POINT_H 9 | #include "globject.h" 10 | 11 | class GLPoint : public GLObject 12 | { 13 | public: 14 | GLPoint(QOpenGLFunctions_4_3_Core* functions, QString id); 15 | }; 16 | #endif // OSI_VISUALIZER_GL_POINT_H -------------------------------------------------------------------------------- /include/gltrafficsign.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | #ifndef OSI_VISUALIZER_GL_TRAFFIC_SIGN_H 8 | #define OSI_VISUALIZER_GL_TRAFFIC_SIGN_H 9 | #include "globject.h" 10 | 11 | class GLTrafficSign : public GLObject 12 | { 13 | public: 14 | GLTrafficSign(QOpenGLFunctions_4_3_Core* functions, QString id); 15 | }; 16 | #endif // OSI_VISUALIZER_GL_TRAFFIC_SIGN_H -------------------------------------------------------------------------------- /include/gltriangle.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | #ifndef OSI_VISUALIZER_GL_TRIANGLE_H 8 | #define OSI_VISUALIZER_GL_TRIANGLE_H 9 | #include "globject.h" 10 | 11 | class GLTriangle : public GLObject 12 | { 13 | public: 14 | GLTriangle(QOpenGLFunctions_4_3_Core* functions); 15 | }; 16 | #endif // OSI_VISUALIZER_GL_TRIANGLE_H -------------------------------------------------------------------------------- /include/glvehicle.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | #ifndef OSI_VISUALIZER_GL_VEHICLE_H 8 | #define OSI_VISUALIZER_GL_VEHICLE_H 9 | #include "globject.h" 10 | 11 | class GLVehicle : public GLObject 12 | { 13 | public: 14 | GLVehicle(QOpenGLFunctions_4_3_Core* functions, QString id, float xExtend, float zExtend); 15 | 16 | GLVehicle(QOpenGLFunctions_4_3_Core* functions, QString id, QVector3D v0, QVector3D v1, QVector3D v2, QVector3D v3); 17 | }; 18 | #endif // OSI_VISUALIZER_GL_VEHICLE_H -------------------------------------------------------------------------------- /include/glwidget.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | #ifndef OSI_VISUALIZER_GL_WIDGET_H 8 | #define OSI_VISUALIZER_GL_WIDGET_H 9 | #include "appconfig.h" 10 | #include "camera.h" 11 | #include "glgrid.h" 12 | #include "globject.h" 13 | #include "imessagesource.h" 14 | #include "lane.h" 15 | #include "types.h" 16 | 17 | #include "glfieldofview.h" 18 | 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | 25 | class QWheelEvent; 26 | 27 | class GLWidget : public QOpenGLWidget, protected QOpenGLFunctions_4_3_Core 28 | { 29 | Q_OBJECT 30 | 31 | public: 32 | GLWidget(QWidget* parent, 33 | IMessageSource* msgSource, 34 | QMap& treeNodes, 35 | const AppConfig& config); 36 | 37 | void UpdateIMessageSource(IMessageSource* msgSource); 38 | 39 | void UpdateFOVPaint(const bool showFOV); 40 | 41 | void UpdateFOVParam(const float minRadius, 42 | const float maxRadius, 43 | const float azimuthPosAngle, 44 | const float azimuthNegAngle); 45 | 46 | signals: 47 | void DisplayObjectInformation(GLObject* object); 48 | void SetTrackingEnabled(bool enable); 49 | 50 | public slots: 51 | 52 | void UpdateGrid(); 53 | void Disconnected(); 54 | void StartTracking(); 55 | void ResetCameraAll(); 56 | void ResetCameraOrient(); 57 | void Connected(DataType dataType); 58 | void TreeItemChanged(QTreeWidgetItem* item, int column); 59 | void TreeItemClicked(QTreeWidgetItem* item, int column); 60 | void MessageParsed(const Message& message, const LaneMessage& laneMessage); 61 | 62 | protected: 63 | void paintGL(); 64 | void initializeGL(); 65 | void resizeGL(int width, int height); 66 | bool eventFilter(QObject* obj, QEvent* event); 67 | 68 | private: 69 | void ResetObjectTextOrientations(); 70 | void RenderObject(GLObject* object); 71 | void MouseWheel(QWheelEvent* event); 72 | void KeyPressed(QSet pressedKeys); 73 | 74 | float minCameraY_; 75 | bool ignoreUpdate_; 76 | bool isOpenGLInitizalized_; 77 | int uniformMvpLocation_; 78 | int uniformColorLocation_; 79 | int uniformUseTextureLocation_; 80 | DataType currentDataType_; 81 | 82 | Camera* camera_; 83 | QPoint mousePos_; 84 | const AppConfig& config_; 85 | QVector lanes_; 86 | QSet pressedKeys_; 87 | QList sceneKeys_; 88 | IMessageSource* msgSource_; 89 | bool isFirstMsgReceived_; 90 | GLObject* selectedObject_; 91 | QMatrix4x4 projectionMatrix_; 92 | QVector staticObjects_; 93 | QVector simulationObjects_; 94 | QOpenGLShaderProgram shaderProgram_; 95 | QMap& treeNodes_; 96 | 97 | bool showFOV_; 98 | GLFieldOfView* objFOV_; 99 | }; 100 | #endif // OSI_VISUALIZER_GL_WIDGET_H -------------------------------------------------------------------------------- /include/imessagesource.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | #ifndef OSI_VISUALIZER_IMESSAGE_SOURCE_H 8 | #define OSI_VISUALIZER_IMESSAGE_SOURCE_H 9 | 10 | class IMessageSource 11 | { 12 | public: 13 | IMessageSource() : isPaused_(false), isConnected_(false) {} 14 | 15 | bool isPaused_; 16 | bool isConnected_; 17 | }; 18 | #endif // OSI_VISUALIZER_IMESSAGE_SOURCE_H -------------------------------------------------------------------------------- /include/lane.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | #ifndef OSI_VISUALIZER_LANE_H 8 | #define OSI_VISUALIZER_LANE_H 9 | #include "gllanemarking.h" 10 | #include 11 | #include 12 | 13 | class Lane 14 | { 15 | public: 16 | Lane(int id, const QVector >& laneMarkings, QOpenGLFunctions_4_3_Core* functions); 17 | 18 | void UpdateLaneMarkings(const QVector >& laneMarkings); 19 | 20 | int laneId_; 21 | bool isVisible_; 22 | QVector glLaneMarkings_; 23 | 24 | private: 25 | void AddLaneMarking(const QVector& laneMarkers); 26 | 27 | QOpenGLFunctions_4_3_Core* functions_; 28 | }; 29 | #endif // OSI_VISUALIZER_LANE_H -------------------------------------------------------------------------------- /include/mainwindow.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | #ifndef OSI_VISUALIZER_MAIN_WINDOW_H 8 | #define OSI_VISUALIZER_MAIN_WINDOW_H 9 | #ifdef _WIN32 10 | #define WIN32_LEAN_AND_MEAN 11 | #endif 12 | #include "appconfig.h" 13 | #include "globject.h" 14 | #include "types.h" 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | class GLWidget; 23 | class TCPReceiver; 24 | class AppConfig; 25 | class OsiParser; 26 | class OsiReader; 27 | class DisplayObjectDialog; 28 | 29 | namespace Ui 30 | { 31 | class MainWindow; 32 | } 33 | 34 | class MainWindow : public QMainWindow 35 | { 36 | Q_OBJECT 37 | 38 | public: 39 | explicit MainWindow(QWidget* parent = nullptr); 40 | ~MainWindow(); 41 | 42 | void LocalUpdate(); 43 | 44 | signals: 45 | void UpdateGrid(); 46 | void UpdateLane(); 47 | 48 | void ConnectRequested(const QString& ipAddress, const QString& port, const DataType dataType); 49 | 50 | void ConnectRequested2(const QString& ipAddress, const QString& port, const DataType dataType); 51 | 52 | void StartPlaybackRequested(const QString& fileName, const DataType dataType); 53 | 54 | void StartPlaybackRequested2(const QString& fileName, const DataType dataType); 55 | 56 | public slots: 57 | void EnableExport(bool enable); 58 | void EnableExport2(bool enable); 59 | void SaveOSIMsgOverflow(int osiMsgSaveThreshold); 60 | void SaveOSIMsgOverflow2(int osiMsgSaveThreshold); 61 | void ToggleSaveOSIMessage(); 62 | void ToggleSaveOSIMessage2(); 63 | void Connected(DataType dataType); 64 | void Connected2(DataType dataType); 65 | void Disconnected(const QString& message); 66 | void Disconnected2(const QString& message); 67 | 68 | void UpdateSliderRange(int sliderRange); 69 | void UpdateSliderRange2(int sliderRange); 70 | void UpdateSliderValue(int sliderValue); 71 | void UpdateSliderTime(int sliderValue); 72 | void UpdateSliderValue2(int sliderValue); 73 | void UpdateSliderTime2(int sliderValue); 74 | 75 | void DisplayObjectInformation(GLObject* object); 76 | void DisplayObjectInformation2(GLObject* object); 77 | 78 | void SetTrackingEnabled(bool enable); 79 | void SetTrackingEnabled2(bool enable); 80 | 81 | // slots for menu 82 | private slots: 83 | void LockCheckBoxToggled(bool checked); 84 | void ShowGridCheckBoxToggled(bool checked); 85 | void ShowObjectOverview(bool checked); 86 | void ChooseBoundaryLanes(); 87 | void ChooseCenterLanes(); 88 | void Quit(); 89 | 90 | private slots: 91 | void RBConnection(); 92 | void RBConnection2(); 93 | void RBPlayback(); 94 | void RBPlayback2(); 95 | 96 | void CBDataTypeCon(int index); 97 | void CBDataTypePlay(int index); 98 | void CBDataTypeCon2(int index); 99 | void CBDataTypePlay2(int index); 100 | void ToggleShowFOV(); 101 | void ToggleShowFOV2(); 102 | 103 | void LoadFileEdited(const QString& text); 104 | void LoadFileBrowse(); 105 | void LoadFileEdited2(const QString& text); 106 | void LoadFileBrowse2(); 107 | 108 | void EnableSendToNetwork(); 109 | void EnableSendToNetwork2(); 110 | 111 | void PlayPauseButtonClicked(); 112 | void PlayPauseButtonClicked2(); 113 | 114 | void ShowContextMenu(const QPoint& pos); 115 | 116 | void ConnectDisplayObjectInformation(QTreeWidgetItem*, int); 117 | void ConnectDisplayObjectInformation2(QTreeWidgetItem*, int); 118 | void DisplayObjectDialogFinished(int); 119 | void DisplayObjectDialogFinished2(int); 120 | 121 | void CombineChannels(); 122 | 123 | void ShowFOV(); 124 | void ShowFOV2(); 125 | 126 | void CBZmqTypeChangeConnect1(const QString&); 127 | void CBZmqTypeChangePlayback1(const QString&); 128 | 129 | void CBZmqTypeChangeConnect2(const QString&); 130 | void CBZmqTypeChangePlayback2(const QString&); 131 | 132 | private: 133 | void closeEvent(QCloseEvent* event); 134 | 135 | void ConnectSignalsToSlots(); 136 | void EnableSrcRadioButton(bool enable); 137 | void EnableSrcRadioButton2(bool enable); 138 | void ToggleSrcGroups(); 139 | void ToggleSrcGroups2(); 140 | 141 | void EnableSrcGroups(bool enable); 142 | void EnableSrcGroups2(bool enable); 143 | 144 | void EnableConnectionGroup1(bool enable); 145 | void EnableConnectionGroup2(bool enable); 146 | 147 | void EnablePlaybackGroup1(bool enable); 148 | void EnablePlaybackGroup2(bool enable); 149 | 150 | void EnableSlider(bool enable); 151 | void EnableSlider2(bool enable); 152 | 153 | void TogglePlayPauseButton(); 154 | void TogglePlayPauseButton2(); 155 | 156 | void CancelSaveOSIMessage(); 157 | void CancelSaveOSIMessage2(); 158 | void UpdateGLWidgetMessageSource(); 159 | void UpdateGLWidgetMessageSource2(); 160 | 161 | void UpdateFields(); 162 | void UpdateFields2(); 163 | 164 | bool UpdateConfigure(); 165 | bool UpdateConfigure2(); 166 | 167 | void InitLoadConfigure(); 168 | void InitComboBoxes(); 169 | void InitLaneTypeMenu(); 170 | 171 | void UpdateLegend(); 172 | void InitObjectTree(); 173 | void InitObjectTree2(); 174 | void InitLegendGroupBox(); 175 | QTreeWidgetItem* CreateTreeNode(const QString& text, const ObjectType& type); 176 | 177 | void PythonCompare(); 178 | 179 | void LocalPlayPause(); 180 | void LocalPlayPause2(); 181 | 182 | void Play(); 183 | void TogglePause(); 184 | void Stop(); 185 | 186 | void Play2(); 187 | void TogglePause2(); 188 | void Stop2(); 189 | 190 | void ResetSliderTime(); 191 | void ResetSliderTime2(); 192 | 193 | QString GetStringFromMilliSecond(int milliSec); 194 | 195 | void UpdateCombineChannelMenu(); 196 | 197 | bool CheckFieldsValidity(); 198 | bool CheckFieldsValidity2(); 199 | 200 | void ShowErrorMessage(const QString& errMsg); 201 | 202 | void EnableShowFOV(const bool enable); 203 | void EnableShowFOV2(const bool enable); 204 | 205 | // Configurations 206 | AppConfig config_; 207 | 208 | // Source come from ethernet or input file 209 | bool isSrcConnection_; 210 | bool isSrcConnection2_; 211 | 212 | // Play or Pause 213 | bool isPlaying_; 214 | bool isPlaying2_; 215 | 216 | // ethernet connected 217 | bool isConnected_; 218 | bool isConnected2_; 219 | // input file playback 220 | bool isPlayed_; 221 | bool isPlayed2_; 222 | 223 | bool isSavingOSI_; 224 | bool isSavingOSI2_; 225 | bool isOverflow_; 226 | bool isOverflow2_; 227 | 228 | Ui::MainWindow* ui_; 229 | 230 | GLWidget* glWidget_; 231 | TCPReceiver* tcpReceiver_; 232 | OsiReader* reader_; 233 | OsiParser* osiparser_; 234 | 235 | GLWidget* glWidget2_; 236 | TCPReceiver* tcpReceiver2_; 237 | OsiReader* reader2_; 238 | OsiParser* osiparser2_; 239 | 240 | QMap colorWidgets_; 241 | QMap treeNodes_; 242 | QMap treeNodes2_; 243 | 244 | QIcon playIcon_; 245 | QIcon pauseIcon_; 246 | 247 | DisplayObjectDialog* displayObjectDlg_; 248 | DisplayObjectDialog* displayObjectDlg2_; 249 | 250 | const QString zmqPushPull_{"Push/Pull"}; 251 | const QString zmqPubSub_{"Pub/Sub"}; 252 | }; 253 | #endif // OSI_VISUALIZER_MAIN_WINDOW_H 254 | -------------------------------------------------------------------------------- /include/osiobjectstub.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | #ifndef OSI_VISUALIZER_OSI_OBJECT_STUB_H 8 | #define OSI_VISUALIZER_OSI_OBJECT_STUB_H 9 | #include 10 | 11 | enum ObjectType 12 | { 13 | Vehicle, 14 | TrafficSign 15 | }; 16 | 17 | class OSIObjectStub 18 | { 19 | public: 20 | OSIObjectStub(); 21 | OSIObjectStub(int id, ObjectType type, QVector3D position, float orientation); 22 | 23 | int id; 24 | ObjectType type; 25 | QVector3D position; 26 | float orientation; 27 | }; 28 | #endif // OSI_VISUALIZER_OSI_OBJECT_STUB_H -------------------------------------------------------------------------------- /include/osiparser.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | 8 | #ifndef OSI_VISUALIZER_OSIPARSER_H 9 | #define OSI_VISUALIZER_OSIPARSER_H 10 | #include "global.h" 11 | #include "mainwindow.h" 12 | #include "osi_sensordata.pb.h" 13 | #include "types.h" 14 | #include 15 | #include 16 | #include 17 | 18 | class OsiParser : public QObject 19 | { 20 | Q_OBJECT 21 | 22 | public: 23 | OsiParser(const AppConfig& config); 24 | 25 | void CancelSaveOSIMessage(); 26 | 27 | signals: 28 | void MessageParsed(const Message& message, const LaneMessage& laneMessage); 29 | void EnableExport(bool enable); 30 | void SaveOSIMsgOverflow(int osiMsgSaveThreshold); 31 | 32 | public slots: 33 | void ExportOsiMessage(); 34 | void ParseReceivedSDMessage(const osi3::SensorData& sd); 35 | void ParseReceivedSVMessage(const osi3::SensorView& sv); 36 | 37 | private: 38 | template 39 | void LocalMonitor(const T& data); 40 | 41 | void ParseGroundtruth(const osi3::GroundTruth& groundTruth, Message& objectMessage, LaneMessage& laneMessage); 42 | 43 | void ParseGroundtruthMovingObject(Message& objectMessage, 44 | const osi3::BaseMoving& baseObject, 45 | const ObjectType objectType, 46 | const QString& idStr); 47 | 48 | void ParseGroundtruthStationaryObject(Message& objectMessage, 49 | const osi3::BaseStationary& baseObject, 50 | const ObjectType objectType, 51 | const QString& idStr); 52 | 53 | void ParseSensorData(const osi3::SensorData& sensorData, Message& objectMessage, LaneMessage& laneMessage); 54 | 55 | void ParseSensorDataMovingObject(Message& objectMessage, 56 | const osi3::BaseMoving& baseObject, 57 | const ObjectType objectType, 58 | const QString& idStr); 59 | 60 | void ParseSensorDataStationaryObject(Message& objectMessage, 61 | const osi3::BaseStationary& baseObject, 62 | const ObjectType objectType, 63 | const QString& idStr); 64 | 65 | ObjectType GetObjectTypeFromOsiObjectType(const osi3::MovingObject_VehicleClassification_Type& vehicleType); 66 | ObjectType GetObjectTypeFromOsiObjectType(const osi3::MovingObject_Type& objectType); 67 | ObjectType GetObjectTypeFromOsiObjectType(const osi3::StationaryObject_Classification_Type& objectType); 68 | ObjectType GetObjectTypeFromOsiObjectType(const osi3::TrafficSign_MainSign_Classification_Type& objectType); 69 | ObjectType GetObjectTypeFromOsiObjectType(const osi3::TrafficLight_Classification_Mode& objectType); 70 | 71 | bool isFirstMessage_; 72 | 73 | bool startSaveOSIMsg_; 74 | std::string osiMsgString_; 75 | int osiMsgNumber_; 76 | 77 | const AppConfig& config_; 78 | }; 79 | 80 | #endif // OSI_VISUALIZER_OSIPARSER_H 81 | -------------------------------------------------------------------------------- /include/osireader.h: -------------------------------------------------------------------------------- 1 | /// 2 | /// @file 3 | /// @copyright Copyright (C) 2017, Bayerische Motoren Werke Aktiengesellschaft (BMW AG) 4 | /// 5 | /// @brief 6 | /// 7 | #ifndef OSI_VISUALIZER_OSIREADER_H 8 | #define OSI_VISUALIZER_OSIREADER_H 9 | 10 | #include "osi_sensordata.pb.h" 11 | #include "osi_version.pb.h" 12 | 13 | #include 14 | 15 | #include 16 | #include 17 | 18 | #include 19 | #include 20 | 21 | #include "imessagesource.h" 22 | #include "types.h" 23 | 24 | class OsiReader : public QObject, public IMessageSource 25 | { 26 | Q_OBJECT 27 | 28 | public: 29 | OsiReader(const int* deltaDelay, const bool& enableSendOut, std::string pubPortNum, int socketType); 30 | 31 | QString SetupConnection(bool enable); 32 | 33 | void SetSendOutPortNum(const std::string& port) { pubPortNumber_ = port; } 34 | 35 | signals: 36 | void Connected(DataType dataType); 37 | void UpdateSliderRange(int sliderRange); 38 | void UpdateSliderValue(int sliderValue); 39 | void Disconnected(const QString& message = ""); 40 | void MessageSDSendout(const osi3::SensorData& SensorData); 41 | void MessageSVSendout(const osi3::SensorView& SensorView); 42 | 43 | public slots: 44 | void StartReadFile(const QString& osiFileName, const DataType dataType); 45 | void StopReadFile(); 46 | void SliderValueChanged(int newValue); 47 | 48 | private: 49 | void ReadHeader(); 50 | bool CreateHeader(QString& errorMsg); 51 | template 52 | bool BuildUpStamps(bool& isFirstMsg, 53 | double& firstTimeStamp, 54 | const std::string& message, 55 | const std::streamoff& offset); 56 | 57 | void SaveHeader(); 58 | 59 | void SendMessageLoop(); 60 | template 61 | bool SendMessage(T& data, 62 | bool& isFirstMessage, 63 | bool& isRefreshMessage, 64 | uint64_t& preTimeStamp, 65 | const std::string& message); 66 | 67 | void SendOutMessage(const std::string& message); 68 | 69 | QString SetZMQConnection(); 70 | QString FreeZMQConnection(); 71 | 72 | bool isRunning_; 73 | bool isReadTerminated_; 74 | 75 | QString osiFileName_; 76 | QString osiHeaderName_; 77 | 78 | uint64_t firstTimeStamp_; 79 | // std::map