Skip to content
Snippets Groups Projects
Commit 06be7490 authored by René Paris's avatar René Paris
Browse files

mod: adjust Obstacle/SpawnSpace to breaking changes in mantle

parent d55b76d7
No related branches found
No related tags found
No related merge requests found
Pipeline #77219 failed
......@@ -30,7 +30,7 @@ Obstacle Obstacle::GetEndingSentinel(units::length::meter_t value)
return {{value, value}, nullptr, units::velocity::meters_per_second_t{std::numeric_limits<double>::max()}};
}
Obstacle ToObstacle(const mantle_api::IEntity* entity, const mantle_api::ITrafficAreaStream& stream)
Obstacle ToObstacle(std::shared_ptr<mantle_api::IEntity> entity, const mantle_api::ITrafficAreaStream& stream)
{
const auto halfLength{entity->GetProperties()->bounding_box.dimension.length / units::dimensionless::scalar_t{2.0}};
const auto offset{entity->GetProperties()->bounding_box.geometric_center.x};
......@@ -47,7 +47,7 @@ std::set<Obstacle, Less<ToMin>> GetObstacles(const mantle_api::ITrafficAreaStrea
const units::length::meter_t max{stream.GetLength()};
while (min < max)
{
const mantle_api::IEntity* entity{stream.GetEntity(mantle_api::ITrafficAreaStream::SearchDirection::kDownstream, min, max - min)};
auto entity{stream.GetEntity(mantle_api::ITrafficAreaStream::SearchDirection::kDownstream, min, max - min)};
if (is_uninitialized(entity))
{
break;
......
......@@ -231,15 +231,15 @@ bool SpawnSpace::Spawn(size_t entityNr)
const auto &stream{*std::next(area->begin(), std::distance(spot_area->begin(), spot_stream))};
const mantle_api::Pose pose{stream->Convert(mantle_api::ITrafficAreaStream::StreamPose{{interval.max, {}}, {}}).value()};
EntityCreator entityCreator{environment_};
std::string name{"Common" + std::to_string(entityNr)};
mantle_api::IEntity &entity{entityCreator.CreateEntity(ToEntity{}(objectTemplate.object_template), name)};
entity.SetName(name);
entity.SetPosition(pose.position);
entity.SetOrientation(pose.orientation);
entity.SetVelocity(util::Rotate(safe_velocity, pose.orientation));
EntityCreator entityCreator{environment_};
std::string name{"Common" + std::to_string(entityNr)};
auto entity{entityCreator.CreateEntity(ToEntity{}(objectTemplate.object_template), name)};
entity->SetName(name);
entity->SetPosition(pose.position);
entity->SetOrientation(pose.orientation);
entity->SetVelocity(util::Rotate(safe_velocity, pose.orientation));
CreateEntityControllers(entity, objectTemplate.object_template->GetObjectController());
CreateEntityControllers(*entity.get(), objectTemplate.object_template->GetObjectController());
const Interval occupied_space{interval.max - spawn_parameters.entity_length, interval.max};
UpdateSpot(*spot_stream, spot, occupied_space, safe_velocity);
......
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