openMSL / sl-2-0-traffic-participant-model-repository-template

Template repository: Clone and build your ASAM OSI traffic participant model.
Mozilla Public License 2.0
3 stars 2 forks source link

Add and use TrafficCommand input and TrafficCommandUpdate output #4

Closed ClemensLinnhoff closed 4 months ago

ClemensLinnhoff commented 10 months ago

Reference to a related issue in the repository

3

Add a description

Take this checklist as orientation for yourself, if this PR is ready for Maintainer Review

jdsika commented 10 months ago

This is an improvement for you @nocll - feel free to exchange with @ClemensLinnhoff and review

nocll commented 10 months ago

@jdsika This PR would facilitate modeling non-ego traffic agents with the template. So the agent can get action commands from a scenario engine, and can reply if the action was completed. This is of course an improvement for the template. Also good to be consistent with OSI spec.

However, this is not a feature I would use for now:

On a related question -- maybe more an OSI issue: In this definition do you know why SensorData input is not considered for the Traffic participant models?

ClemensLinnhoff commented 10 months ago

On a related question -- maybe more an OSI issue: In this definition do you know why SensorData input is not considered for the Traffic participant models?

I fully agree. There should be a model type, that receives a SensorData and outputs a TrafficUpdate. I already created an issue in OSMP a while back to discuss this: https://github.com/OpenSimulationInterface/osi-sensor-model-packaging/issues/102 It would be great, if you could comment there, to stress, that this is something, that is actually needed.

ClemensLinnhoff commented 10 months ago
  • Using this also requires re-working the environment simulator to send the TrafficCommand messages

We are already working on enabling esmini to provide the TrafficCommand message: https://github.com/esmini/esmini/issues/499

nocll commented 10 months ago

It would be great, if you could comment there, to stress, that this is something, that is actually needed.

Ah good! OK I added a comment there.

github-actions[bot] commented 6 months ago

Cpp-Linter Report :warning:

Some files did not pass the configured checks!

clang-tidy reports: 25 concern(s) - **src/MyTrafficParticipantModel.h:50:21:** warning: [[cppcoreguidelines-avoid-non-const-global-variables](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/avoid-non-const-global-variables.html)] > variable 'private_log_file' is non-const and globally accessible, consider making it const ```h static ofstream private_log_file; ^ /home/runner/work/sl-2-0-traffic-participant-model-repository-template/sl-2-0-traffic-participant-model-repository-template/src/MyTrafficParticipantModel.h:82:21: warning: 1024 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers] char buffer[1024]; ^ /home/runner/work/sl-2-0-traffic-participant-model-repository-template/sl-2-0-traffic-participant-model-repository-template/src/MyTrafficParticipantModel.h:86:27: warning: 1024 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers] vsnprintf(buffer, 1024, format, arg); ^ ``` - **src/OSMP.cpp:50:16:** warning: [[cppcoreguidelines-avoid-non-const-global-variables](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/avoid-non-const-global-variables.html)] > variable 'private_log_file' is non-const and globally accessible, consider making it const ```cpp ofstream OSMP::private_log_file; ^ ``` - **src/OSMP.cpp:60:5:** warning: [[cppcoreguidelines-pro-type-member-init](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-type-member-init.html)] > uninitialized record type: 'myaddr' ```cpp union Addrconv ^ ``` - **src/OSMP.cpp:69:12:** warning: [[cppcoreguidelines-pro-type-union-access](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-type-union-access.html)] > do not access members of unions; use (boost::)variant instead ```cpp myaddr.base.lo = lo; ^ ``` - **src/OSMP.cpp:70:12:** warning: [[cppcoreguidelines-pro-type-union-access](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-type-union-access.html)] > do not access members of unions; use (boost::)variant instead ```cpp myaddr.base.hi = hi; ^ ``` - **src/OSMP.cpp:71:12:** warning: [[cppcoreguidelines-pro-type-reinterpret-cast](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-type-reinterpret-cast.html)] > do not use reinterpret_cast ```cpp return reinterpret_cast(myaddr.address); ^ ``` - **src/OSMP.cpp:71:43:** warning: [[cppcoreguidelines-pro-type-union-access](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-type-union-access.html)] > do not access members of unions; use (boost::)variant instead ```cpp return reinterpret_cast(myaddr.address); ^ ``` - **src/OSMP.cpp:82:5:** warning: [[cppcoreguidelines-pro-type-member-init](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-type-member-init.html)] > uninitialized record type: 'myaddr' ```cpp union Addrconv ^ ``` - **src/OSMP.cpp:91:12:** warning: [[cppcoreguidelines-pro-type-union-access](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-type-union-access.html)] > do not access members of unions; use (boost::)variant instead ```cpp myaddr.address = reinterpret_cast(ptr); ^ ``` - **src/OSMP.cpp:91:22:** warning: [[cppcoreguidelines-pro-type-reinterpret-cast](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-type-reinterpret-cast.html)] > do not use reinterpret_cast ```cpp myaddr.address = reinterpret_cast(ptr); ^ ``` - **src/OSMP.cpp:92:17:** warning: [[cppcoreguidelines-pro-type-union-access](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-type-union-access.html)] > do not access members of unions; use (boost::)variant instead ```cpp hi = myaddr.base.hi; ^ ``` - **src/OSMP.cpp:93:17:** warning: [[cppcoreguidelines-pro-type-union-access](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-type-union-access.html)] > do not access members of unions; use (boost::)variant instead ```cpp lo = myaddr.base.lo; ^ ``` - **src/OSMP.cpp:263:18:** warning: [[readability-convert-member-functions-to-static](https://clang.llvm.org/extra/clang-tidy/checks/readability/convert-member-functions-to-static.html)] > method 'DoStart' can be made static ```cpp fmi2Status OSMP::DoStart(fmi2Boolean tolerance_defined, fmi2Real tolerance, fmi2Real start_time, fmi2Boolean stop_time_defined, fmi2Real stop_time) ^ ``` - **src/OSMP.cpp:268:18:** warning: [[readability-convert-member-functions-to-static](https://clang.llvm.org/extra/clang-tidy/checks/readability/convert-member-functions-to-static.html)] > method 'DoEnterInitializationMode' can be made static ```cpp fmi2Status OSMP::DoEnterInitializationMode() ^ ``` - **src/OSMP.cpp:337:18:** warning: [[readability-convert-member-functions-to-static](https://clang.llvm.org/extra/clang-tidy/checks/readability/convert-member-functions-to-static.html)] > method 'DoTerm' can be made static ```cpp fmi2Status OSMP::DoTerm() ^ ``` - **src/OSMP.cpp:348:1:** warning: [[cppcoreguidelines-pro-type-member-init](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-type-member-init.html)] > constructor does not initialize these fields: boolean_vars_, integer_vars_, real_vars_ ```cpp OSMP::OSMP(fmi2String theinstance_name, ^ ``` - **src/OSMP.cpp:508:24:** warning: [[cppcoreguidelines-pro-bounds-constant-array-index](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-bounds-constant-array-index.html)] > do not use array subscript when the index is not an integer constant expression ```cpp value[i] = real_vars_[vr[i]]; ^ ``` - **src/OSMP.cpp:532:24:** warning: [[cppcoreguidelines-pro-bounds-constant-array-index](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-bounds-constant-array-index.html)] > do not use array subscript when the index is not an integer constant expression ```cpp value[i] = integer_vars_[vr[i]]; ^ ``` - **src/OSMP.cpp:549:24:** warning: [[cppcoreguidelines-pro-bounds-constant-array-index](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-bounds-constant-array-index.html)] > do not use array subscript when the index is not an integer constant expression ```cpp value[i] = boolean_vars_[vr[i]]; ^ ``` - **src/OSMP.cpp:566:24:** warning: [[cppcoreguidelines-pro-bounds-constant-array-index](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-bounds-constant-array-index.html)] > do not use array subscript when the index is not an integer constant expression ```cpp value[i] = string_vars_[vr[i]].c_str(); ^ ``` - **src/OSMP.cpp:583:13:** warning: [[cppcoreguidelines-pro-bounds-constant-array-index](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-bounds-constant-array-index.html)] > do not use array subscript when the index is not an integer constant expression ```cpp real_vars_[vr[i]] = value[i]; ^ ``` - **src/OSMP.cpp:600:13:** warning: [[cppcoreguidelines-pro-bounds-constant-array-index](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-bounds-constant-array-index.html)] > do not use array subscript when the index is not an integer constant expression ```cpp integer_vars_[vr[i]] = value[i]; ^ ``` - **src/OSMP.cpp:617:13:** warning: [[cppcoreguidelines-pro-bounds-constant-array-index](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-bounds-constant-array-index.html)] > do not use array subscript when the index is not an integer constant expression ```cpp boolean_vars_[vr[i]] = value[i]; ^ ``` - **src/OSMP.cpp:634:13:** warning: [[cppcoreguidelines-pro-bounds-constant-array-index](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/pro-bounds-constant-array-index.html)] > do not use array subscript when the index is not an integer constant expression ```cpp string_vars_[vr[i]] = value[i]; ^ ``` - **src/OSMP.h:140:21:** warning: [[cppcoreguidelines-avoid-non-const-global-variables](https://clang.llvm.org/extra/clang-tidy/checks/cppcoreguidelines/avoid-non-const-global-variables.html)] > variable 'private_log_file' is non-const and globally accessible, consider making it const ```h static ofstream private_log_file; ^ /home/runner/work/sl-2-0-traffic-participant-model-repository-template/sl-2-0-traffic-participant-model-repository-template/src/OSMP.h:172:21: warning: 1024 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers] char buffer[1024]; ^ /home/runner/work/sl-2-0-traffic-participant-model-repository-template/sl-2-0-traffic-participant-model-repository-template/src/OSMP.h:176:27: warning: 1024 is a magic number; consider replacing it with a named constant [cppcoreguidelines-avoid-magic-numbers,readability-magic-numbers] vsnprintf(buffer, 1024, format, arg); ^ ```

Have any feedback or feature suggestions? Share it here.

ClemensLinnhoff commented 4 months ago

@jdsika reminder to review