Commit 3fd95081 authored by Christoph Kochendoerfer's avatar Christoph Kochendoerfer Committed by Reinhard Biegel
Browse files

Prototype of openPASS implementation of mantle_api

parent d80b1893
Pipeline #7357 canceled with stage
in 0 seconds
# - Find MANTLE
# Find the MANTLE includes and library
#
# MANTLE_INCLUDE_DIR - Where to find MANTLE includes
FIND_PATH(MANTLE_INCLUDE_DIR "MantleAPI/Execution/i_environment.h"
PATHS
${PREFIX_PATH}
DOC "MANTLE - Headers"
)
set(MANTLE_TEST_INCLUDE_DIR ${MANTLE_INCLUDE_DIR}/../test CACHE PATH "MANTLE - Mocks for testing")
message(STATUS "Found MantleAPI: ${MANTLE_INCLUDE_DIR}")
# - Find OPENSCENARIOENGINE
# Find the OPENSCENARIOENGINE includes and library
#
# OPENSCENARIOENGINE_INCLUDE_DIR - Where to find OPENSCENARIOENGINE includes
FIND_PATH(OPENSCENARIOENGINE_INCLUDE_DIR "OpenScenarioEngine/OpenScenarioEngine.h"
PATHS
${PREFIX_PATH}
DOC "OPENSCENARIOENGINE - Headers"
)
FIND_PATH(OPENSCENARIOENGINE_SRC_INCLUDE_DIR "EntityCreator.h"
PATHS
${PREFIX_PATH}
DOC "OPENSCENARIOENGINE - SRC Headers"
)
message(STATUS "Found OSC Engine includes: ${OPENSCENARIOENGINE_INCLUDE_DIR}")
message(STATUS "Found OSC Engine src includes: ${OPENSCENARIOENGINE_SRC_INCLUDE_DIR}")
# - Find OPENSCENARIOPARSER
# Find the OPENSCENARIOPARSER includes and library
#
# OPENSCENARIOPARSER_INCLUDE_DIR - Where to find OPENSCENARIOPARSER includes
FIND_PATH(OPENSCENARIOPARSER_INCLUDE_DIR "openScenarioLib/generated/v1_1/api/ApiClassInterfacesV1_1.h"
PATHS
${PREFIX_PATH}
DOC "OPENSCENARIOPARSER - Headers"
)
message(STATUS "Found OSC Parser: ${OPENSCENARIOPARSER_INCLUDE_DIR}")
# - Find UNITS
# Find the UNITS includes and library
#
# UNITS_INCLUDE_DIR - Where to find UNITS includes
FIND_PATH(UNITS_INCLUDE_DIR "units.h"
PATHS
${PREFIX_PATH}
DOC "UNITS - Headers"
)
......@@ -232,7 +232,11 @@ function(add_openpass_target)
endif()
add_executable(${PARSED_ARG_NAME} EXCLUDE_FROM_ALL ${PARSED_ARG_HEADERS} ${PARSED_ARG_SOURCES} ${PARSED_ARG_UIS})
target_include_directories(${PARSED_ARG_NAME} PRIVATE
${MANTLE_TEST_INCLUDE_DIR}
)
target_link_libraries(${PARSED_ARG_NAME}
GTest::gtest
GTest::gmock
......
......@@ -97,6 +97,13 @@ if(WITH_SIMCORE OR WITH_TESTS)
endif()
endif()
include(FindMantleAPI)
include(FindOpenScenarioEngine)
include(FindOpenScenarioParser)
include(FindUnits)
include_directories(SYSTEM ${MANTLE_INCLUDE_DIR} ${UNITS_INCLUDE_DIR})
if(WITH_TESTS)
find_package(GTest REQUIRED CONFIG) # force config mode for better lookup consistency with newer gtest versions
message(STATUS "Found GTest: ${GTest_DIR}")
......@@ -185,4 +192,3 @@ if(WITH_DOC)
endif()
###############################################################################
......@@ -47,7 +47,7 @@ inline AgentVehicleType GetAgentVehicleType(const std::string &strVehicleType)
{
if (0 == strVehicleType.compare("car"))
{
return AgentVehicleType::Car;
return mantle_api::VehicleClass::kMedium_car;
}
else if (0 == strVehicleType.compare("pedestrian"))
{
......@@ -63,7 +63,7 @@ inline AgentVehicleType GetAgentVehicleType(const std::string &strVehicleType)
}
else if (0 == strVehicleType.compare("truck"))
{
return AgentVehicleType::Truck;
return mantle_api::VehicleClass::kHeavy_truck;
}
return AgentVehicleType::Undefined;
}
......@@ -99,7 +99,7 @@ inline std::string GetAgentVehicleTypeStr(const int vehicleTypeCode)
resultString = GetAgentVehicleTypeStr(AgentVehicleType::Undefined);
break;
case 0:
resultString = GetAgentVehicleTypeStr(AgentVehicleType::Car);
resultString = GetAgentVehicleTypeStr(mantle_api::VehicleClass::kMedium_car);
break;
case 1:
resultString = GetAgentVehicleTypeStr(AgentVehicleType::Pedestrian);
......@@ -111,7 +111,7 @@ inline std::string GetAgentVehicleTypeStr(const int vehicleTypeCode)
resultString = GetAgentVehicleTypeStr(AgentVehicleType::Bicycle);
break;
case 4:
resultString = GetAgentVehicleTypeStr(AgentVehicleType::Truck);
resultString = GetAgentVehicleTypeStr(mantle_api::VehicleClass::kHeavy_truck);
break;
default:
resultString = "unknown type";
......
/********************************************************************************
* Copyright (c) 2021 ITK Engineering GmbH
* 2022 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
......@@ -67,9 +68,9 @@ bool VehicleModelImporter::ParseParticipants(int id, QDomNode vehicleNode,
AgentVehicleType agentVehicleType = GetAgentVehicleType(vehicleString);
int vehicleTypeId = static_cast<int>(agentVehicleType);
QString vehicleTypeIdString = QString::number(vehicleTypeId);
QString weight = vehicleNode.toElement().attribute("mass");
QString mue = "";
QString weight = "";
QString ixx = "";
QString iyy = "";
QString izz = "";
......@@ -84,8 +85,6 @@ bool VehicleModelImporter::ParseParticipants(int id, QDomNode vehicleNode,
if( name == "FrictionCoefficient"){
mue = value;
}else if (name == "Mass") {
weight = value;
}
else if (name == "MomentInertiaRoll")
{
......
/********************************************************************************
* Copyright (c) 2017-2021 ITK Engineering GmbH
* 2022 Bayerische Motoren Werke Aktiengesellschaft (BMW AG)
*
* This program and the accompanying materials are made available under the
* terms of the Eclipse Public License 2.0 which is available at
......@@ -67,6 +68,7 @@ bool XmlModelsConfig::WriteToXml(QXmlStreamWriter *xmlWriter)
for (XmlAgent agent : agents)
{
xmlWriter->writeStartElement("Vehicle");
xmlWriter->writeAttribute("mass", agent.weight);
xmlWriter->writeAttribute("name","Agent_" + QString::number(agent.id));
xmlWriter->writeAttribute("vehicleCategory", "car"); // always "car"
xmlWriter->writeStartElement("Properties");
......@@ -95,10 +97,6 @@ bool XmlModelsConfig::WriteToXml(QXmlStreamWriter *xmlWriter)
xmlWriter->writeAttribute("value","1.0");
xmlWriter->writeEndElement(); // Property
xmlWriter->writeStartElement("Property");
xmlWriter->writeAttribute("name","Mass");
xmlWriter->writeAttribute("value",agent.weight);
xmlWriter->writeEndElement(); // Property
xmlWriter->writeStartElement("Property");
xmlWriter->writeAttribute("name","MaximumEngineSpeed");
xmlWriter->writeAttribute("value","10000.0");
xmlWriter->writeEndElement(); // Property
......
......@@ -26,6 +26,7 @@ configure_file(
include_directories(
${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_LIST_DIR}/..
${MANTLE_INCLUDE_DIR}
)
if(WITH_SIMCORE)
......
<Profiles SchemaVersion="0.4.8">
<Profiles SchemaVersion="0.5">
<AgentProfiles>
<AgentProfile Name="LuxuryClassCarAgent" Type="Dynamic">
<DriverProfiles>
<DriverProfile Name="Regular" Probability="1.0"/>
</DriverProfiles>
<VehicleProfiles>
<VehicleProfile Name="BMW 7 1" Probability="0.5"/>
<VehicleProfile Name="BMW 7 2" Probability="0.5"/>
</VehicleProfiles>
<SystemProfiles>
<SystemProfile Name="BMW 7 1" Probability="0.5"/>
<SystemProfile Name="BMW 7 2" Probability="0.5"/>
</SystemProfiles>
<VehicleModels>
<VehicleModel Name="car_bmw_7_1" Probability="0.5"/>
<VehicleModel Name="car_bmw_7_2" Probability="0.5"/>
</VehicleModels>
</AgentProfile>
<AgentProfile Name="MiddleClassCarAgent" Type="Dynamic">
<DriverProfiles>
<DriverProfile Name="Regular" Probability="1.0"/>
</DriverProfiles>
<VehicleProfiles>
<VehicleProfile Name="Mini Cooper" Probability="0.4"/>
<VehicleProfile Name="BMW i3" Probability="0.3"/>
<VehicleProfile Name="BMW 3" Probability="0.3"/>
</VehicleProfiles>
<SystemProfiles>
<SystemProfile Name="Mini Cooper" Probability="0.4"/>
<SystemProfile Name="BMW i3" Probability="0.3"/>
<SystemProfile Name="BMW 3" Probability="0.3"/>
</SystemProfiles>
<VehicleModels>
<VehicleModel Name="car_mini_cooper" Probability="0.4"/>
<VehicleModel Name="car_bmw_i3" Probability="0.3"/>
<VehicleModel Name="car_bmw_3" Probability="0.3"/>
</VehicleModels>
</AgentProfile>
<AgentProfile Name="TruckAgent" Type="Dynamic">
<DriverProfiles>
<DriverProfile Name="RegularTruck" Probability="1.0"/>
</DriverProfiles>
<VehicleProfiles>
<VehicleProfile Name="Truck" Probability="1.0"/>
</VehicleProfiles>
<SystemProfiles>
<SystemProfile Name="Truck" Probability="1.0"/>
</SystemProfiles>
<VehicleModels>
<VehicleModel Name="truck" Probability="1.0"/>
</VehicleModels>
</AgentProfile>
<AgentProfile Name="BusAgent" Type="Dynamic">
<AgentProfile Name="BusAgent" Type="Dynamic">
<DriverProfiles>
<DriverProfile Name="RegularBus" Probability="1.0"/>
</DriverProfiles>
<VehicleProfiles>
<VehicleProfile Name="Bus" Probability="1.0"/>
</VehicleProfiles>
<SystemProfiles>
<SystemProfile Name="Bus" Probability="1.0"/>
</SystemProfiles>
<VehicleModels>
<VehicleModel Name="bus" Probability="1.0"/>
</VehicleModels>
</AgentProfile>
</AgentProfiles>
<VehicleProfiles>
<VehicleProfile Name="BMW 7 1">
<Model Name="car_bmw_7_1"/>
<SystemProfiles>
<SystemProfile Name="BMW 7 1">
<Components/>
<Sensors/>
</VehicleProfile>
<VehicleProfile Name="BMW 7 2">
<Model Name="car_bmw_7_2"/>
</SystemProfile>
<SystemProfile Name="BMW 7 2">
<Components/>
<Sensors/>
</VehicleProfile>
<VehicleProfile Name="Mini Cooper">
<Model Name="car_mini_cooper"/>
</SystemProfile>
<SystemProfile Name="Mini Cooper">
<Components/>
<Sensors/>
</VehicleProfile>
<VehicleProfile Name="BMW i3">
<Model Name="car_bmw_i3"/>
</SystemProfile>
<SystemProfile Name="BMW i3">
<Components/>
<Sensors/>
</VehicleProfile>
<VehicleProfile Name="BMW 3">
<Model Name="car_bmw_3"/>
</SystemProfile>
<SystemProfile Name="BMW 3">
<Components/>
<Sensors/>
</VehicleProfile>
<VehicleProfile Name="Truck">
<Model Name="truck"/>
</SystemProfile>
<SystemProfile Name="Truck">
<Components/>
<Sensors/>
</VehicleProfile>
<VehicleProfile Name="Bus">
<Model Name="bus"/>
</SystemProfile>
<SystemProfile Name="Bus">
<Components/>
<Sensors/>
</VehicleProfile>
</VehicleProfiles>
</SystemProfile>
</SystemProfiles>
<ProfileGroup Type="Driver">
<Profile Name="Regular">
<String Key="Type" Value="AlgorithmAgentFollowingDriverModel"/>
......
......@@ -6,10 +6,10 @@
</ParameterDeclarations>
<CatalogLocations>
<VehicleCatalog>
<Directory path="VehicleModelsCatalog.xosc"/>
<Directory path="Vehicles"/>
</VehicleCatalog>
<PedestrianCatalog>
<Directory path="PedestrianModelsCatalog.xosc"/>
<Directory path="Vehicles"/>
</PedestrianCatalog>
<ControllerCatalog>
<Directory path=""/>
......@@ -36,7 +36,14 @@
</RoadNetwork>
<Entities>
<ScenarioObject name="Ego">
<CatalogReference catalogName="ProfilesCatalog.xml" entryName="MiddleClassCarAgent"/>
<CatalogReference catalogName="VehicleCatalog" entryName="car_mini_cooper"/>
<ObjectController>
<Controller name="Ego">
<Properties>
<Property name="AgentProfile" value="MiddleClassCarAgent"/>
</Properties>
</Controller>
</ObjectController>
</ScenarioObject>
<EntitySelection name="ScenarioAgents">
<Members/>
......@@ -56,7 +63,7 @@
<PrivateAction>
<LongitudinalAction>
<SpeedAction>
<SpeedActionDynamics dynamicsShape="linear" value="0.0" dynamicsDimension="rate"/>
<SpeedActionDynamics dynamicsShape="step" value="0.0" dynamicsDimension="rate"/>
<SpeedActionTarget>
<AbsoluteTargetSpeed value="43.5"/>
</SpeedActionTarget>
......@@ -66,7 +73,11 @@
</Private>
</Actions>
</Init>
<Story/>
<Story name="">
<Act name="">
<ManeuverGroup name="" maximumExecutionCount="1"/>
</Act>
</Story>
<StopTrigger>
<ConditionGroup>
<Condition name="EndTime" delay="0" conditionEdge="rising">
......
......@@ -4,9 +4,6 @@
<Catalog name="PedestrianCatalog">
<Pedestrian model="pedestrian_child" mass="30.0" name="pedestrian_child" pedestrianCategory="pedestrian">
<ParameterDeclarations/>
<Properties>
<Property name="Mass" value="40.0"/>
</Properties>
<BoundingBox>
<Center x="0.0645" y="0.0" z="0.577"/>
<Dimensions width="0.298" length="0.711" height="1.154"/>
......@@ -15,9 +12,6 @@
</Pedestrian>
<Pedestrian model="pedestrian_adult" mass="80.0" name="pedestrian_adult" pedestrianCategory="pedestrian">
<ParameterDeclarations/>
<Properties>
<Property name="Mass" value="70.0"/>
</Properties>
<BoundingBox>
<Center x="0.1" y="0.0" z="0.9"/>
<Dimensions width="0.5" length="0.6" height="1.8"/>
......
......@@ -60,11 +60,6 @@
</Observation>
</Observations>
<Spawners>
<Spawner>
<Library>SpawnerScenario</Library>
<Type>PreRun</Type>
<Priority>1</Priority>
</Spawner>
<Spawner>
<Library>SpawnerPreRunCommon</Library>
<Type>PreRun</Type>
......
<Profiles SchemaVersion="0.4.8">
<Profiles SchemaVersion="0.5">
<AgentProfiles>
<AgentProfile Name="EgoAgent" Type="Dynamic">
<DriverProfiles>
<DriverProfile Name="EgoDriver" Probability="1.0"/>
</DriverProfiles>
<VehicleProfiles>
<VehicleProfile Name="EgoVehicle" Probability="1.0"/>
</VehicleProfiles>
<SystemProfiles>
<SystemProfile Name="EgoVehicle" Probability="1.0"/>
</SystemProfiles>
<VehicleModels>
<VehicleModel Name="car_bmw_7_1" Probability="1.0"/>
</VehicleModels>
</AgentProfile>
<AgentProfile Name="TFAgent" Type="Dynamic">
<DriverProfiles>
<DriverProfile Name="Regular" Probability="1.0"/>
</DriverProfiles>
<VehicleProfiles>
<VehicleProfile Name="TFVehicle" Probability="1.0"/>
</VehicleProfiles>
<SystemProfiles>
<SystemProfile Name="TFVehicle" Probability="1.0"/>
</SystemProfiles>
<VehicleModels>
<VehicleModel Name="car_bmw_7_1" Probability="1.0"/>
</VehicleModels>
</AgentProfile>
<AgentProfile Name="LuxuryClassCarAgent" Type="Dynamic">
<DriverProfiles>
<DriverProfile Name="Regular" Probability="1.0"/>
</DriverProfiles>
<VehicleProfiles>
<VehicleProfile Name="BMW 7 1" Probability="0.5"/>
<VehicleProfile Name="BMW 7 2" Probability="0.5"/>
</VehicleProfiles>
<SystemProfiles>
<SystemProfile Name="BMW 7 1" Probability="0.5"/>
<SystemProfile Name="BMW 7 2" Probability="0.5"/>
</SystemProfiles>
<VehicleModels>
<VehicleModel Name="car_bmw_7_1" Probability="0.5"/>
<VehicleModel Name="car_bmw_7_2" Probability="0.5"/>
</VehicleModels>
</AgentProfile>
<AgentProfile Name="MiddleClassCarAgent" Type="Dynamic">
<DriverProfiles>
<DriverProfile Name="Regular" Probability="1.0"/>
</DriverProfiles>
<VehicleProfiles>
<VehicleProfile Name="Mini Cooper" Probability="0.4"/>
<VehicleProfile Name="BMW i3" Probability="0.3"/>
<VehicleProfile Name="BMW 3" Probability="0.3"/>
</VehicleProfiles>
<SystemProfiles>
<SystemProfile Name="Mini Cooper" Probability="0.4"/>
<SystemProfile Name="BMW i3" Probability="0.3"/>
<SystemProfile Name="BMW 3" Probability="0.3"/>
</SystemProfiles>
<VehicleModels>
<VehicleModel Name="car_mini_cooper" Probability="0.4"/>
<VehicleModel Name="car_bmw_i3" Probability="0.3"/>
<VehicleModel Name="car_bmw_3" Probability="0.3"/>
</VehicleModels>
</AgentProfile>
<AgentProfile Name="TruckAgent" Type="Dynamic">
<DriverProfiles>
<DriverProfile Name="Regular" Probability="1.0"/>
</DriverProfiles>
<VehicleProfiles>
<VehicleProfile Name="Truck" Probability="0.5"/>
<VehicleProfile Name="Bus" Probability="0.5"/>
</VehicleProfiles>
<SystemProfiles>
<SystemProfile Name="Truck" Probability="0.5"/>
<SystemProfile Name="Bus" Probability="0.5"/>
</SystemProfiles>
<VehicleModels>
<VehicleModel Name="truck" Probability="0.5"/>
<VehicleModel Name="bus" Probability="0.5"/>
</VehicleModels>
</AgentProfile>
</AgentProfiles>
<VehicleProfiles>
<VehicleProfile Name="EgoVehicle">
<Model Name="car_bmw_7_1"/>
<SystemProfiles>
<SystemProfile Name="EgoVehicle">
<Components>
<Component Type="AEB">
<Profiles>
......@@ -60,18 +78,15 @@
</Component>
</Components>
<Sensors>
<Sensor Id="0">
<Position Name="Default" Longitudinal="3.7" Lateral="1.09" Height="0.5" Pitch="0.0" Yaw="0.0" Roll="0.0"/>
<Sensor Id="0" Position="FrontWindow">
<Profile Type="Geometric2D" Name="Standard"/>
</Sensor>
<Sensor Id="1">
<Position Name="Default" Longitudinal="3.7" Lateral="-1.09" Height="0.5" Pitch="0.0" Yaw="0.0" Roll="0.0"/>
<Sensor Id="1" Position="FrontWindow">
<Profile Type="Geometric2D" Name="Standard"/>
</Sensor>
</Sensors>
</VehicleProfile>
<VehicleProfile Name="TFVehicle">
<Model Name="car_bmw_7_1"/>
</SystemProfile>
<SystemProfile Name="TFVehicle">
<Components>
<Component Type="Dynamics_TrajectoryFollower">
<Profiles>
......@@ -80,43 +95,36 @@
</Component>
</Components>
<Sensors/>
</VehicleProfile>
<VehicleProfile Name="BMW 7 1">
<Model Name="car_bmw_7_1"/>
</SystemProfile>
<SystemProfile Name="BMW 7 1">
<Components/>
<Sensors/>
</VehicleProfile>
<VehicleProfile Name="BMW 7 2">
<Model Name="car_bmw_7_2"/>
</SystemProfile>
<SystemProfile Name="BMW 7 2">
<Components/>
<Sensors/>
</VehicleProfile>
<VehicleProfile Name="Mini Cooper">
<Model Name="car_mini_cooper"/>
</SystemProfile>
<SystemProfile Name="Mini Cooper">
<Components/>
<Sensors/>
</VehicleProfile>
<VehicleProfile Name="BMW i3">
<Model Name="car_bmw_i3"/>
</SystemProfile>
<SystemProfile Name="BMW i3">
<Components/>
<Sensors/>
</VehicleProfile>
<VehicleProfile Name="BMW 3">
<Model Name="car_bmw_3"/>
</SystemProfile>
<SystemProfile Name="BMW 3">
<Components/>
<Sensors/>
</VehicleProfile>
<VehicleProfile Name="Truck">
<Model Name="truck"/>
</SystemProfile>
<SystemProfile Name="Truck">
<Components/>
<Sensors/>
</VehicleProfile>
<VehicleProfile Name="Bus">
<Model Name="bus"/>
</SystemProfile>
<SystemProfile Name="Bus">
<Components/>
<Sensors/>
</VehicleProfile>
</VehicleProfiles>
</SystemProfile>
</SystemProfiles>
<ProfileGroup Type="Driver">
<Profile Name="EgoDriver">
<String Key="Type" Value="AlgorithmAgentFollowingDriverModel"/>
......
......@@ -52,11 +52,6 @@
</Observation>
</Observations>
<Spawners>
<Spawner>
<Library>SpawnerScenario</Library>
<Type>PreRun</Type>
<Priority>1</Priority>
</Spawner>
<Spawner>
<Library>SpawnerPreRunCommon</Library>
<Type>PreRun</Type>
......
<Profiles SchemaVersion="0.4.8">
<Profiles SchemaVersion="0.5">
<AgentProfiles>