Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Feature/preprocessor command #994

Draft
wants to merge 101 commits into
base: feature/parameter_value_distribution
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
101 commits
Select commit Hold shift + click to select a range
f3c8ab8
refactor(openscenario_interpreter): delete ros messages from basic types
HansRobo Apr 26, 2023
6332613
refactor(openscenario_interpreter): comment-out UserDefinedDistribution
HansRobo Apr 26, 2023
72eda48
refactor(openscenario_interpreter): add some ifdef blocks to avoid RO…
HansRobo Apr 26, 2023
90427c5
feat(openscenario_preprocessor): add command executable
HansRobo Apr 26, 2023
b1200ca
feat(openscenario_interpreter): add library without ROS dependency (WIP)
HansRobo Apr 26, 2023
fa4cca0
chore: apply linter
HansRobo Apr 26, 2023
a0304e3
chore: apply linter
HansRobo Apr 26, 2023
c185e38
chore: fix cspell error
HansRobo Apr 26, 2023
4d7c386
chore: modify cspell setting
HansRobo Apr 26, 2023
7ea1801
refactor(openscenario_interpreter): change macro name
HansRobo Apr 26, 2023
30c5251
fix: add necessary build settings
HansRobo Apr 26, 2023
3240ed3
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo Apr 26, 2023
7d68ba8
fix(openscenario_preprocessor): disable reference scenario loading by…
HansRobo Apr 27, 2023
c20acc9
chore(openscenario_preprocessor): add template scenarios
HansRobo Apr 28, 2023
dc1a8f0
chore(openscenario_preprocessor): add dependencies
HansRobo Apr 28, 2023
7302376
feat(openscenario_preprocessor): add t4v2 class
HansRobo Apr 28, 2023
0b255ab
feat(openscenario_preprocessor): add deriver class
HansRobo Apr 28, 2023
1c5fb62
feat(openscenario_preprocessor): binary first version
HansRobo Apr 28, 2023
b565c33
chore(openscenario_preprocessor): apply linter
HansRobo Apr 28, 2023
ef25041
feat(openscenario_preprocessor): add yaml_xml.hpp
HansRobo May 1, 2023
49a1962
feat(openscenario_preprocessor): support yaml output from command
HansRobo May 1, 2023
84583cb
refactor(openscenario_preprocessor): delete tojson.hpp
HansRobo May 1, 2023
c346325
refactor(openscenario_preprocessor)
HansRobo May 1, 2023
dc64fac
chore(openscenario_preprocessor): fix build error
HansRobo May 1, 2023
69f035c
feat(openscenario_preprocessor): add skip-full-derivation option to c…
HansRobo May 10, 2023
b69a797
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo May 16, 2023
f2d631c
feat(openscenario_preprocessor): implement xosc content order normali…
HansRobo May 22, 2023
6592af6
Merge remote-tracking branch 'origin/master' into feature/preprocesso…
HansRobo May 22, 2023
f9bbb90
chore(openscenario_preprocessor): apply linter
HansRobo May 22, 2023
c6c75e1
fix(openscenario_preprocessor): fix compile error
HansRobo May 22, 2023
365abb5
fix(openscenario_preprocessor): load schema
HansRobo May 22, 2023
c54dca2
Merge remote-tracking branch 'origin/master' into feature/preprocesso…
HansRobo May 22, 2023
c342415
chore(openscenario_preprocessor): apply linter
HansRobo May 24, 2023
191cc08
chore(openscenario_preprocessor): fix cspell errors
HansRobo May 24, 2023
7b2eae3
chore(openscenario_preprocessor): delete unused dependencies
HansRobo May 24, 2023
5138ea3
chore(openscenario_preprocessor): delete unused files
HansRobo May 24, 2023
9c030a8
chore(openscenario_preprocessor): fix cspell errors
HansRobo May 24, 2023
213080a
Merge remote-tracking branch 'origin/master' into feature/preprocesso…
HansRobo May 25, 2023
e548257
chore: apply linter
HansRobo May 25, 2023
da5794c
convert json values to string to avoid error
HansRobo May 29, 2023
2a080fe
chore(openscenario_preprocessor): write-out intermediate file for debug
HansRobo Jun 1, 2023
59fa833
chore(openscenario_preprocessor): add debug message
HansRobo Jun 2, 2023
76ab421
chore(openscenario_preprocessor): load unordered yaml
HansRobo Jun 2, 2023
d7a0324
fix(openscenario_preprocessor): fix bug in coversion from xml to yaml
HansRobo Jun 5, 2023
b9536de
refactor(openscenario_preprocessor)
HansRobo Jun 5, 2023
a597cc6
chore(openscenario_preprocessor): (wip) add test
HansRobo Jun 6, 2023
17a316c
feat(preprocessor): add some test
HansRobo Jun 7, 2023
7f84a46
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo Jun 28, 2023
c2e1566
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo Aug 4, 2023
3d32c04
fix(openscenario_preprocessor): fix merge conflict
HansRobo Aug 7, 2023
7f5c04f
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo Aug 10, 2023
eab2c40
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo Aug 23, 2023
ab46d54
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo Sep 22, 2023
30cae2e
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo Oct 10, 2023
fc16038
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo Oct 11, 2023
e2926df
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo Oct 16, 2023
8d104f1
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo Nov 21, 2023
6da23f4
chore(cspell): update ignorePaths in custom_spell.json
HansRobo Nov 21, 2023
800ccc8
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo Feb 15, 2024
27b0681
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo Feb 15, 2024
0d20e7e
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo Mar 12, 2024
e76869c
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo Apr 1, 2024
b5aafe4
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo Apr 1, 2024
d4cae7d
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo Apr 4, 2024
ec2cf6f
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo Apr 9, 2024
cc9fca1
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo Apr 11, 2024
00739cd
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo Apr 19, 2024
5663070
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo Apr 30, 2024
d14df57
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo May 7, 2024
0500c13
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo May 7, 2024
cfd76ee
fix: fix compile errors
HansRobo May 7, 2024
cf81792
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo May 8, 2024
1afb1f1
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo May 8, 2024
6a68ab2
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo May 16, 2024
acca4d9
fix: fix build and link errors in openscenario_preprocessor
HansRobo May 16, 2024
b624abf
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo May 17, 2024
0fc6b1e
fix: add license notice in openscenario_preprocessor/test/test_main.py
HansRobo May 17, 2024
f3e2f76
fix: delete unavailable test for openscenario_preprocessor
HansRobo May 17, 2024
f53abbd
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo May 20, 2024
8c5b801
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo May 22, 2024
78a4847
refactor: delete ament_cpp_index dependencies from openscenario_valid…
HansRobo May 22, 2024
9cd216b
refactor: setup in-binary schema in openscenario_preprocessor
HansRobo May 22, 2024
092b988
refactor: use in-binary schema in openscenario_preprocessor
HansRobo May 22, 2024
af4339f
Merge remote-tracking branch 'origin/feature/parameter_value_distribu…
HansRobo May 22, 2024
93db015
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo May 28, 2024
7fba30e
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo May 30, 2024
33f45a1
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo Jun 4, 2024
bb95ee2
chore: apply linter
HansRobo Jun 10, 2024
3f40162
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo Jun 10, 2024
ad57746
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo Jun 12, 2024
a24aed4
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo Jun 12, 2024
30df957
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo Jun 19, 2024
a36fad0
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo Jul 5, 2024
b433eac
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo Jul 31, 2024
0e24dc0
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo Aug 19, 2024
c29b365
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo Sep 18, 2024
fc6065a
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo Sep 30, 2024
3cae15f
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo Nov 12, 2024
3b2693c
fix: add Boost::JSON to parameter_value_distribution_without_ros
HansRobo Nov 13, 2024
ab84e61
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo Nov 18, 2024
bc8a7aa
Merge branch 'feature/parameter_value_distribution' into feature/prep…
HansRobo Nov 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 68 additions & 0 deletions openscenario/openscenario_interpreter/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
endif()

find_package(ament_cmake_auto REQUIRED)
find_package(Boost REQUIRED COMPONENTS filesystem)

ament_auto_find_build_dependencies()

Expand Down Expand Up @@ -97,6 +98,73 @@ install(
DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/test
DESTINATION share/${PROJECT_NAME})

# ------------------------------------------------------------------------------
# parameter value distribution without ROS
# ------------------------------------------------------------------------------
add_library(parameter_value_distribution_without_ros STATIC
src/syntax/open_scenario.cpp
src/syntax/file_header.cpp
src/syntax/license.cpp
src/syntax/properties.cpp
src/syntax/property.cpp
src/syntax/file.cpp
src/syntax/open_scenario_category.cpp
src/syntax/parameter_value_distribution_definition.cpp
src/syntax/parameter_value_distribution.cpp
src/syntax/distribution_definition.cpp
src/syntax/deterministic.cpp
src/syntax/deterministic_parameter_distribution.cpp
src/syntax/deterministic_multi_parameter_distribution.cpp
src/syntax/deterministic_multi_parameter_distribution_type.cpp
src/syntax/value_set_distribution.cpp
src/syntax/deterministic_single_parameter_distribution.cpp
src/syntax/deterministic_single_parameter_distribution_type.cpp
src/syntax/distribution_range.cpp
src/syntax/range.cpp
src/syntax/distribution_set.cpp
src/syntax/distribution_set_element.cpp
src/syntax/stochastic.cpp
src/syntax/stochastic_distribution.cpp
src/syntax/stochastic_distribution_type.cpp
src/syntax/histogram.cpp
src/syntax/histogram_bin.cpp
src/syntax/normal_distribution.cpp
src/syntax/log_normal_distribution.cpp
src/syntax/poisson_distribution.cpp
src/syntax/probability_distribution_set.cpp
src/syntax/probability_distribution_set_element.cpp
src/syntax/uniform_distribution.cpp

src/syntax/boolean.cpp
src/syntax/double.cpp
src/syntax/integer.cpp
src/syntax/unsigned_integer.cpp
src/syntax/unsigned_short.cpp

src/syntax/parameter_value_set.cpp

src/utility/demangle.cpp

src/evaluate.cpp
src/object.cpp
src/parameter_distribution.cpp
src/scope.cpp)

add_definitions("-DBOOST_ALLOW_DEPRECATED_HEADERS")
# cspell: ignore DPARAMETER
target_compile_definitions(parameter_value_distribution_without_ros PUBLIC -DPARAMETER_VALUE_DISTRIBUTION_ONLY)
target_include_directories(parameter_value_distribution_without_ros PUBLIC include)
target_include_directories(parameter_value_distribution_without_ros PUBLIC ${boost_json_SOURCE_DIR}/include)
target_include_directories(parameter_value_distribution_without_ros PUBLIC ${scenario_simulator_exception_INCLUDE_DIRS})
target_link_libraries(parameter_value_distribution_without_ros
Boost::filesystem
Boost::json
pugixml)

install(
TARGETS parameter_value_distribution_without_ros
LIBRARY DESTINATION lib/${PROJECT_NAME})

# ------------------------------------------------------------------------------
# test
# ------------------------------------------------------------------------------
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,12 @@
#ifndef OPENSCENARIO_INTERPRETER__READER__ATTRIBUTE_HPP_
#define OPENSCENARIO_INTERPRETER__READER__ATTRIBUTE_HPP_

#ifndef PARAMETER_VALUE_DISTRIBUTION_ONLY
#include <ament_index_cpp/get_package_share_directory.hpp>
#include <boost/algorithm/string/replace.hpp>
#include <concealer/execute.hpp>
#endif // PARAMETER_VALUE_DISTRIBUTION_ONLY

#include <boost/algorithm/string/replace.hpp>
#include <functional>
#include <openscenario_interpreter/reader/evaluate.hpp>
#include <openscenario_interpreter/syntax/parameter_type.hpp>
Expand All @@ -38,6 +41,7 @@ auto substitute(std::string attribute, Scope & scope)
{
auto dirname = [](auto &&, auto && scope) { return scope.dirname(); };

#ifndef PARAMETER_VALUE_DISTRIBUTION_ONLY
auto find_pkg_share = [](auto && package_name, auto &&) {
return ament_index_cpp::get_package_share_directory(package_name);
};
Expand All @@ -61,9 +65,11 @@ auto substitute(std::string attribute, Scope & scope)
return result;
}
};
#endif // PARAMETER_VALUE_DISTRIBUTION_ONLY

auto var = [](auto && name, auto && scope) {
// TODO: Return the value of the launch configuration variable instead of the OpenSCENARIO parameter.
// TODO: Return the value of the launch configuration variable instead of the OpenSCENARIO
// parameter.
if (const auto found = scope.ref(name); found) {
return boost::lexical_cast<String>(found);
} else {
Expand All @@ -76,14 +82,16 @@ auto substitute(std::string attribute, Scope & scope)
std::string, std::function<std::string(const std::string &, Scope &)> >
substitutions{
{"dirname", dirname},
// TODO {"env", env},
// TODO {"eval", eval},
// TODO {"exec-in-package", exec_in_package},
// TODO {"find-exec", find_exec},
// TODO {"find-pkg-prefix", find_pkg_prefix},
// TODO {"env", env},
// TODO {"eval", eval},
// TODO {"exec-in-package", exec_in_package},
// TODO {"find-exec", find_exec},
// TODO {"find-pkg-prefix", find_pkg_prefix},
#ifndef PARAMETER_VALUE_DISTRIBUTION_ONLY
{"find-pkg-share", find_pkg_share},
{"ros2",
ros2}, // NOTE: TIER IV extension (Not included in the ROS 2 Launch XML Substitution)
#endif // PARAMETER_VALUE_DISTRIBUTION_ONLY
{"var", var},
};

Expand Down Expand Up @@ -136,7 +144,8 @@ auto readAttribute(const std::string & name, const Node & node, const Scope & sc
}
};

// NOTE: https://www.asam.net/index.php?eID=dumpFile&t=f&f=4092&token=d3b6a55e911b22179e3c0895fe2caae8f5492467#_parameters
// NOTE:
// https://www.asam.net/index.php?eID=dumpFile&t=f&f=4092&token=d3b6a55e911b22179e3c0895fe2caae8f5492467#_parameters

if (const auto & attribute = node.attribute(name.c_str())) {
// NOTE: `substitute` is TIER IV extension (Non-OpenSCENARIO standard)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,11 @@
#include <memory>
#include <openscenario_interpreter/name.hpp>
#include <openscenario_interpreter/syntax/catalog_locations.hpp>

#ifndef PARAMETER_VALUE_DISTRIBUTION_ONLY
#include <openscenario_interpreter/syntax/entity.hpp>
#endif // PARAMETER_VALUE_DISTRIBUTION_ONLY

#include <openscenario_interpreter/utility/demangle.hpp>
#include <random>
#include <unordered_map>
Expand Down Expand Up @@ -191,7 +195,9 @@ class Scope
public:
const std::string name;

#ifndef PARAMETER_VALUE_DISTRIBUTION_ONLY
std::list<Entity> actors;
#endif // PARAMETER_VALUE_DISTRIBUTION_ONLY

// NOTE: `random_engine` is used only for sharing random number generator in Stochastic now
std::default_random_engine random_engine;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#include <openscenario_interpreter/scope.hpp>
#include <openscenario_interpreter/syntax/distribution_range.hpp>
#include <openscenario_interpreter/syntax/distribution_set.hpp>
#include <openscenario_interpreter/syntax/user_defined_distribution.hpp>
#include <pugixml.hpp>

namespace openscenario_interpreter
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
#include <openscenario_interpreter/syntax/poisson_distribution.hpp>
#include <openscenario_interpreter/syntax/probability_distribution_set.hpp>
#include <openscenario_interpreter/syntax/uniform_distribution.hpp>
#include <openscenario_interpreter/syntax/user_defined_distribution.hpp>
#include <pugixml.hpp>

namespace openscenario_interpreter
Expand Down
10 changes: 8 additions & 2 deletions openscenario/openscenario_interpreter/src/scope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,12 @@
#include <iterator>
#include <openscenario_interpreter/scope.hpp>
#include <openscenario_interpreter/syntax/open_scenario.hpp>
#include <openscenario_interpreter/syntax/scenario_object.hpp>
#include <scenario_simulator_exception/exception.hpp>

#ifndef PARAMETER_VALUE_DISTRIBUTION_ONLY
#include <openscenario_interpreter/syntax/scenario_object.hpp>
#endif // PARAMETER_VALUE_DISTRIBUTION_ONLY

namespace openscenario_interpreter
{
EnvironmentFrame::EnvironmentFrame(EnvironmentFrame & outer_frame, const std::string & name)
Expand Down Expand Up @@ -99,8 +102,11 @@ Scope::Scope(const std::string & name, const Scope & outer)
: open_scenario(outer.open_scenario),
frame(std::shared_ptr<EnvironmentFrame>(new EnvironmentFrame(*outer.frame, name))),
scenario_definition(outer.scenario_definition),
name(name),
name(name)
#ifndef PARAMETER_VALUE_DISTRIBUTION_ONLY
,
actors(outer.actors)
#endif // PARAMETER_VALUE_DISTRIBUTION_ONLY
{
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ DeterministicSingleParameterDistributionType::DeterministicSingleParameterDistri
: Group(
choice(tree,
std::make_pair("DistributionSet", [&](auto && node){ return make<DistributionSet >(node, scope);}),
std::make_pair("DistributionRange", [&](auto && node){ return make<DistributionRange >(node, scope);}),
std::make_pair("UserDefinedDistribution", [&](auto && node){ return make<UserDefinedDistribution>(node, scope);})))
std::make_pair("DistributionRange", [&](auto && node){ return make<DistributionRange >(node, scope);})))
// std::make_pair("UserDefinedDistribution", [&](auto && node){ return make<UserDefinedDistribution>(node, scope);})))
// clang-format on
{
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,10 @@
#include <openscenario_interpreter/reader/element.hpp>
#include <openscenario_interpreter/syntax/open_scenario.hpp>
#include <openscenario_interpreter/syntax/open_scenario_category.hpp>

#ifndef PARAMETER_VALUE_DISTRIBUTION_ONLY
#include <openscenario_interpreter/syntax/scenario_definition.hpp>
#endif // PARAMETER_VALUE_DISTRIBUTION_ONLY

namespace openscenario_interpreter
{
Expand Down Expand Up @@ -48,6 +51,7 @@ auto operator<<(boost::json::object & json, const OpenScenario & datum) -> boost
{
json["version"] = "1.0";

#ifndef PARAMETER_VALUE_DISTRIBUTION_ONLY
json["frame"] = datum.frame;

json["CurrentStates"].emplace_object();
Expand All @@ -63,6 +67,7 @@ auto operator<<(boost::json::object & json, const OpenScenario & datum) -> boost
if (datum.category.is<ScenarioDefinition>()) {
json["OpenSCENARIO"].emplace_object() << datum.category.as<ScenarioDefinition>();
}
#endif // PARAMETER_VALUE_DISTRIBUTION_ONLY

return json;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,14 @@
// See the License for the specific language governing permissions and
// limitations under the License.

#ifndef PARAMETER_VALUE_DISTRIBUTION_ONLY
#include <openscenario_interpreter/syntax/catalog_definition.hpp>
#include <openscenario_interpreter/syntax/scenario_definition.hpp>
#endif // PARAMETER_VALUE_DISTRIBUTION_ONLY

#include <openscenario_interpreter/reader/element.hpp>
#include <openscenario_interpreter/syntax/open_scenario_category.hpp>
#include <openscenario_interpreter/syntax/parameter_value_distribution_definition.hpp>
#include <openscenario_interpreter/syntax/scenario_definition.hpp>

namespace openscenario_interpreter
{
Expand All @@ -25,8 +29,10 @@ OpenScenarioCategory::OpenScenarioCategory(const pugi::xml_node & tree, Scope &
: Group(
// clang-format off
choice(tree,
#ifndef PARAMETER_VALUE_DISTRIBUTION_ONLY
std::make_pair("Storyboard", [&](auto &&) { return make<ScenarioDefinition >(tree, scope);}), // DIRTY HACK!!!
std::make_pair("Catalog", [&](auto &&) { return make<CatalogDefinition >(tree, scope);}),
#endif // PARAMETER_VALUE_DISTRIBUTION_ONLY
std::make_pair("ParameterValueDistribution",[&](auto &&) { return make<ParameterValueDistributionDefinition>(tree, scope);})))
// clang-format on
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ StochasticDistributionType::StochasticDistributionType(const pugi::xml_node & no
std::make_pair("NormalDistribution", [&](auto && node){return make<NormalDistribution >(node, scope);}),
std::make_pair("UniformDistribution", [&](auto && node){return make<UniformDistribution >(node, scope);}),
std::make_pair("PoissonDistribution", [&](auto && node){return make<PoissonDistribution >(node, scope);}),
std::make_pair("Histogram", [&](auto && node){return make<Histogram >(node, scope);}),
std::make_pair("UserDefinedDistribution", [&](auto && node){return make<UserDefinedDistribution >(node, scope);})))
std::make_pair("Histogram", [&](auto && node){return make<Histogram >(node, scope);})))
// std::make_pair("UserDefinedDistribution", [&](auto && node){return make<UserDefinedDistribution >(node, scope);})))
// clang-format on
{
}
Expand Down
43 changes: 42 additions & 1 deletion openscenario/openscenario_preprocessor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,65 @@ cmake_minimum_required(VERSION 3.16.3) # Ubuntu 20.04 default CMake version
project(openscenario_preprocessor)

if(NOT CMAKE_CXX_STANDARD)
set(CMAKE_CXX_STANDARD 14)
set(CMAKE_CXX_STANDARD 17)
endif()

if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang")
add_compile_options(-Wall -Wextra -Wpedantic)
endif()

find_package(ament_cmake_auto REQUIRED)
find_package(XercesC REQUIRED)
find_package(Boost REQUIRED COMPONENTS filesystem program_options regex)
find_package(pugixml REQUIRED)


ament_auto_find_build_dependencies()

ament_auto_add_executable(${PROJECT_NAME}_node
src/schema.cpp
src/${PROJECT_NAME}.cpp
src/${PROJECT_NAME}_node.cpp)

target_link_libraries(${PROJECT_NAME}_node XercesC::XercesC)
target_link_libraries(${PROJECT_NAME}_node yaml-cpp)

find_library(parameter_value_distribution_LIBRARIES parameter_value_distribution_without_ros)

file(READ ${openscenario_validator_DIR}/../../openscenario_validator/schema/OpenSCENARIO-1.3.xsd ${PROJECT_NAME}_OPENSCENARIO_1_3_XSD)
configure_file(configure/schema.cpp src/schema.cpp)

add_executable(${PROJECT_NAME}_command
src/t4v2.cpp
src/schema.cpp
src/${PROJECT_NAME}.cpp
src/${PROJECT_NAME}_command.cpp)

# cspell: ignore DPARAMETER
target_compile_definitions(${PROJECT_NAME}_command PUBLIC -DPARAMETER_VALUE_DISTRIBUTION_ONLY)

target_include_directories(${PROJECT_NAME}_command PUBLIC include)
target_include_directories(${PROJECT_NAME}_command PUBLIC ${XercesC_INCLUDE_DIRS})
target_include_directories(${PROJECT_NAME}_command PUBLIC ${YAML_CPP_INCLUDE_DIRS})
target_include_directories(${PROJECT_NAME}_command PUBLIC ${YAML_CPP_INCLUDE_DIRS})
target_include_directories(${PROJECT_NAME}_command PUBLIC ${openscenario_interpreter_INCLUDE_DIRS})
target_include_directories(${PROJECT_NAME}_command PUBLIC ${openscenario_validator_INCLUDE_DIRS})

target_link_libraries(${PROJECT_NAME}_command Boost::filesystem Boost::program_options Boost::regex)
target_link_libraries(${PROJECT_NAME}_command XercesC::XercesC)
target_link_libraries(${PROJECT_NAME}_command pugixml)
target_link_libraries(${PROJECT_NAME}_command yaml-cpp)

target_link_libraries(${PROJECT_NAME}_command ${parameter_value_distribution_LIBRARIES})

install(TARGETS ${PROJECT_NAME}_node ${PROJECT_NAME}_command
RUNTIME DESTINATION lib/${PROJECT_NAME}
)

if(BUILD_TESTING)
find_package(ament_lint_auto REQUIRED)
ament_lint_auto_find_test_dependencies()
ament_add_pytest_test(test_${PROJECT_NAME} "test/test_main.py")
endif()

ament_auto_package()
20 changes: 20 additions & 0 deletions openscenario/openscenario_preprocessor/configure/schema.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// Copyright 2015 TIER IV, Inc. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

#include <openscenario_preprocessor/schema.hpp>

namespace openscenario_preprocessor
{
const char schema[] = R"###(${${PROJECT_NAME}_OPENSCENARIO_1_3_XSD})###";
} // namespace openscenario_preprocessor
Loading
Loading