Skip to content
Snippets Groups Projects
Commit 9a93e5e8 authored by Andreas Rauschert's avatar Andreas Rauschert
Browse files

Sync from internal repo


- last manual sync before using eclipse repo directly

Signed-off-by: default avatarAndreas Rauschert <andreas.rb.rauschert@bmw.de>
parent de97eb02
No related branches found
No related tags found
1 merge request!12Sync from internal repo
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
namespace mantle_api namespace mantle_api
{ {
using UniqueId = std::uint64_t; using UniqueId = std::uint64_t;
constexpr UniqueId InvalidId{std::numeric_limits<UniqueId>::max()};
/// Common interface for all classes that can be referenced by an ID or name. /// Common interface for all classes that can be referenced by an ID or name.
class IIdentifiable class IIdentifiable
......
...@@ -72,6 +72,38 @@ inline Vec3d operator/(const Vec3d& lhs, double d) noexcept ...@@ -72,6 +72,38 @@ inline Vec3d operator/(const Vec3d& lhs, double d) noexcept
return {lhs.x / d, lhs.y / d, lhs.z / d}; return {lhs.x / d, lhs.y / d, lhs.z / d};
} }
inline Vec3d operator+=(Vec3d& lhs, const Vec3d& rhs) noexcept
{
lhs.x += rhs.x;
lhs.y += rhs.y;
lhs.z += rhs.z;
return lhs;
}
inline Vec3d operator-=(Vec3d& lhs, const Vec3d& rhs) noexcept
{
lhs.x -= rhs.x;
lhs.y -= rhs.y;
lhs.z -= rhs.z;
return lhs;
}
inline Vec3d operator+=(Vec3d& lhs, double d) noexcept
{
lhs.x += d;
lhs.y += d;
lhs.z += d;
return lhs;
}
inline Vec3d operator-=(Vec3d& lhs, double d) noexcept
{
lhs.x -= d;
lhs.y -= d;
lhs.z -= d;
return lhs;
}
} // namespace mantle_api } // namespace mantle_api
#endif // MANTLEAPI_COMMON_VECTOR_H #endif // MANTLEAPI_COMMON_VECTOR_H
...@@ -35,9 +35,9 @@ class IEnvironment ...@@ -35,9 +35,9 @@ class IEnvironment
/// Load a map file and parse it into the memory. /// Load a map file and parse it into the memory.
/// ///
/// @param file_path raw map file path from the scenario file. Resolving to a valid file path is done in the /// @param file_path map file path from the scenario file. If this path is not resolved by the engine, the
/// environment. /// environment must do so.
virtual void CreateMap(const std::string& file_path, const std::vector<Position>& map_region) = 0; virtual void CreateMap(const std::string& map_file_path, const std::vector<Position>& map_region) = 0;
/// Creates a controller from the given config. A created controller can be assigned to multiple entities /// Creates a controller from the given config. A created controller can be assigned to multiple entities
/// ///
......
/*******************************************************************************
* Copyright (c) 2021, 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 https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*******************************************************************************/
//-----------------------------------------------------------------------------
/** @file entity_helper.h */
//-----------------------------------------------------------------------------
#ifndef MANTLEAPI_TRAFFIC_ENTITY_HELPER_H
#define MANTLEAPI_TRAFFIC_ENTITY_HELPER_H
#include <MantleAPI/Traffic/i_entity.h>
#include <cmath>
namespace mantle_api
{
void SetSpeed(mantle_api::IEntity* entity, double velocity)
{
auto orientation = entity->GetOrientation();
double cos_elevation = std::cos(orientation.pitch);
mantle_api::Vec3d velocity_vector{velocity * std::cos(orientation.yaw) * cos_elevation,
velocity * std::sin(orientation.yaw) * cos_elevation,
velocity * -std::sin(orientation.pitch)};
entity->SetVelocity(velocity_vector);
}
} // namespace mantle_api
#endif // MANTLEAPI_TRAFFIC_ENTITY_HELPER_H
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#include <MantleAPI/Map/i_lane_location_query_service.h> #include <MantleAPI/Map/i_lane_location_query_service.h>
#include <algorithm> #include <algorithm>
#include <map>
#include <memory> #include <memory>
#include <vector> #include <vector>
...@@ -82,6 +83,7 @@ struct InternalControllerConfig : public IControllerConfig ...@@ -82,6 +83,7 @@ struct InternalControllerConfig : public IControllerConfig
struct ExternalControllerConfig : public IControllerConfig struct ExternalControllerConfig : public IControllerConfig
{ {
std::string name; std::string name;
std::map<std::string, std::string> parameters;
}; };
} // namespace mantle_api } // namespace mantle_api
......
...@@ -335,7 +335,7 @@ class MockEnvironment : public mantle_api::IEnvironment ...@@ -335,7 +335,7 @@ class MockEnvironment : public mantle_api::IEnvironment
mantle_api::DateTime GetDateTime() override { return mantle_api::DateTime(); } mantle_api::DateTime GetDateTime() override { return mantle_api::DateTime(); }
mantle_api::SimulationTime GetSimulationTime() override { return mantle_api::SimulationTime(); } MOCK_METHOD(mantle_api::SimulationTime, GetSimulationTime, (), (override));
private: private:
MockQueryService query_service_{}; MockQueryService query_service_{};
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment