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

HdMapUtils refactor (PR 5/6) - extend lanelet_wrapper: add ::traffic_lights, use wide in traffic_simulator, remove hdmap_utils #1482

Draft
wants to merge 29 commits into
base: ref/RJD-1387-hdmap-utils-to-lanelet-wrapper-route
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
bb9b92d
feat(traffic_simulator): exxtend lanelet_wrapper: add ::traffic_light…
dmoszynski Dec 9, 2024
7a5378e
ref(traffic_simulator): use lanelet_wapper::traffic_lights and utils …
dmoszynski Dec 9, 2024
259e7b6
ref(traffic_simulator, behavior_tree_plugin, random_test_runner): rem…
dmoszynski Dec 9, 2024
d1f8a89
feat(traffic_simulator): remove EntityManager::setTrafficLights use c…
dmoszynski Dec 9, 2024
c591013
feat(traffic_simulator): remove hdmap_utils
dmoszynski Dec 9, 2024
b2ada94
fix(traffic_simulator): bring back hdmap_utils tests
dmoszynski Dec 9, 2024
c239504
Revert "feat(traffic_simulator): remove EntityManager::setTrafficLigh…
dmoszynski Dec 9, 2024
190b5e4
Merge branch 'ref/RJD-1387-hdmap-utils-to-lanelet-wrapper-route' into…
dmoszynski Dec 9, 2024
57c0eec
Merge branch 'ref/RJD-1387-hdmap-utils-to-lanelet-wrapper-route' into…
dmoszynski Dec 9, 2024
3f0e0cf
Merge branch 'ref/RJD-1387-hdmap-utils-to-lanelet-wrapper-route' into…
dmoszynski Dec 10, 2024
a04ea0a
Merge remote-tracking branch 'origin/ref/RJD-1387-hdmap-utils-to-lane…
dmoszynski Dec 10, 2024
b027350
Merge branch 'ref/RJD-1387-hdmap-utils-to-lanelet-wrapper-route' into…
dmoszynski Dec 10, 2024
e4af2c2
Merge branch 'ref/RJD-1387-hdmap-utils-to-lanelet-wrapper-route' into…
dmoszynski Dec 11, 2024
b20ab14
Merge remote-tracking branch 'origin/ref/RJD-1387-hdmap-utils-to-lane…
TauTheLepton Jan 8, 2025
8aad36c
Merge remote-tracking branch 'origin/ref/RJD-1387-hdmap-utils-to-lane…
TauTheLepton Jan 15, 2025
eafadb9
Merge remote-tracking branch 'origin/ref/RJD-1387-hdmap-utils-to-lane…
TauTheLepton Jan 22, 2025
541f3d2
Merge branch 'ref/RJD-1387-hdmap-utils-to-lanelet-wrapper-route' into…
TauTheLepton Jan 23, 2025
8a1a5be
Merge remote-tracking branch 'tier4/ref/RJD-1387-hdmap-utils-to-lanel…
TauTheLepton Jan 31, 2025
0475e93
Merge branch 'ref/RJD-1387-hdmap-utils-to-lanelet-wrapper-route' into…
TauTheLepton Feb 3, 2025
9ee8ea6
Merge branch 'ref/RJD-1387-hdmap-utils-to-lanelet-wrapper-route' into…
TauTheLepton Feb 5, 2025
22330bd
Merge remote-tracking branch 'tier4/ref/RJD-1387-hdmap-utils-to-lanel…
TauTheLepton Feb 11, 2025
bf5e736
Trailing return type and format code
TauTheLepton Feb 11, 2025
8f99b3f
Use trailing return type
TauTheLepton Feb 11, 2025
b33164c
Merge branch 'ref/RJD-1387-hdmap-utils-to-lanelet-wrapper-route' into…
TauTheLepton Feb 12, 2025
fded822
Merge branch 'ref/RJD-1387-hdmap-utils-to-lanelet-wrapper-route' into…
TauTheLepton Feb 13, 2025
48240f2
Merge branch 'ref/RJD-1387-hdmap-utils-to-lanelet-wrapper-route' into…
TauTheLepton Feb 18, 2025
1eebf06
Merge branch 'ref/RJD-1387-hdmap-utils-to-lanelet-wrapper-route' into…
TauTheLepton Feb 19, 2025
6c262d0
Merge branch 'ref/RJD-1387-hdmap-utils-to-lanelet-wrapper-route' into…
TauTheLepton Feb 20, 2025
f115f21
Merge branch 'ref/RJD-1387-hdmap-utils-to-lanelet-wrapper-route' into…
TauTheLepton Mar 6, 2025
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
1 change: 0 additions & 1 deletion Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ EXPAND_AS_DEFINED += EXPECT_VECTOR3_EQ
EXPAND_AS_DEFINED += FORWARD_GETTER_TO_TRAFFIC_LIGHT_MANAGER
EXPAND_AS_DEFINED += FORWARD_TO_ENTITY
EXPAND_AS_DEFINED += FORWARD_TO_ENTITY_MANAGER
EXPAND_AS_DEFINED += FORWARD_TO_HDMAP_UTILS
EXPAND_AS_DEFINED += TEST
EXPAND_AS_DEFINED += THROW_ERROR
EXPAND_AS_DEFINED += THROW_SEMANTIC_ERROR
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <traffic_simulator/data_type/behavior.hpp>
#include <traffic_simulator/data_type/entity_status.hpp>
#include <traffic_simulator/entity/entity_base.hpp>
#include <traffic_simulator/hdmap_utils/hdmap_utils.hpp>
#include <traffic_simulator/helper/stop_watch.hpp>
#include <traffic_simulator/traffic_lights/traffic_lights.hpp>
#include <traffic_simulator_msgs/msg/obstacle.hpp>
Expand Down Expand Up @@ -72,7 +71,6 @@ class ActionNode : public BT::ActionNodeBase
BT::InputPort<EntityStatusDict>("other_entity_status"),
BT::InputPort<lanelet::Ids>("route_lanelets"),
BT::InputPort<std::optional<double>>("target_speed"),
BT::InputPort<std::shared_ptr<hdmap_utils::HdMapUtils>>("hdmap_utils"),
BT::InputPort<std::shared_ptr<traffic_simulator::CanonicalizedEntityStatus>>("canonicalized_entity_status"),
BT::InputPort<std::shared_ptr<traffic_simulator::TrafficLightsBase>>("traffic_lights"),
BT::InputPort<traffic_simulator::behavior::Request>("request"),
Expand All @@ -97,7 +95,6 @@ class ActionNode : public BT::ActionNodeBase

protected:
traffic_simulator::behavior::Request request;
std::shared_ptr<hdmap_utils::HdMapUtils> hdmap_utils;
std::shared_ptr<traffic_simulator::TrafficLightsBase> traffic_lights;
std::shared_ptr<traffic_simulator::CanonicalizedEntityStatus> canonicalized_entity_status;
double current_time;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@
#include <optional>
#include <string>
#include <traffic_simulator/behavior/behavior_plugin_base.hpp>
#include <traffic_simulator/hdmap_utils/hdmap_utils.hpp>
#include <traffic_simulator_msgs/msg/entity_status.hpp>
#include <vector>
#include <visualization_msgs/msg/marker_array.hpp>
Expand All @@ -38,9 +37,9 @@ namespace entity_behavior
class PedestrianBehaviorTree : public BehaviorPluginBase
{
public:
void configure(const rclcpp::Logger & logger) override;
auto configure(const rclcpp::Logger & logger) -> void override;
auto update(const double current_time, const double step_time) -> void override;
const std::string & getCurrentAction() const override;
auto getCurrentAction() const -> const std::string & override;

#define DEFINE_GETTER_SETTER(NAME, TYPE) \
TYPE get##NAME() override { return tree_.rootBlackboard()->get<TYPE>(get##NAME##Key()); } \
Expand All @@ -56,7 +55,6 @@ class PedestrianBehaviorTree : public BehaviorPluginBase
DEFINE_GETTER_SETTER(DebugMarker, std::vector<visualization_msgs::msg::Marker>)
DEFINE_GETTER_SETTER(DefaultMatchingDistanceForLaneletPoseCalculation, double)
DEFINE_GETTER_SETTER(GoalPoses, std::vector<geometry_msgs::msg::Pose>)
DEFINE_GETTER_SETTER(HdMapUtils, std::shared_ptr<hdmap_utils::HdMapUtils>)
DEFINE_GETTER_SETTER(LaneChangeParameters, traffic_simulator::lane_change::Parameter)
DEFINE_GETTER_SETTER(Obstacle, std::optional<traffic_simulator_msgs::msg::Obstacle>)
DEFINE_GETTER_SETTER(OtherEntityStatus, EntityStatusDict)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include <optional>
#include <string>
#include <traffic_simulator/behavior/behavior_plugin_base.hpp>
#include <traffic_simulator/hdmap_utils/hdmap_utils.hpp>
#include <traffic_simulator_msgs/msg/entity_status.hpp>
#include <traffic_simulator_msgs/msg/obstacle.hpp>
#include <traffic_simulator_msgs/msg/waypoints_array.hpp>
Expand All @@ -38,9 +37,9 @@ namespace entity_behavior
class VehicleBehaviorTree : public BehaviorPluginBase
{
public:
auto configure(const rclcpp::Logger & logger) -> void override;
auto update(const double current_time, const double step_time) -> void override;
void configure(const rclcpp::Logger & logger) override;
const std::string & getCurrentAction() const override;
auto getCurrentAction() const -> const std::string & override;

auto getBehaviorParameter() -> traffic_simulator_msgs::msg::BehaviorParameter override;

Expand All @@ -60,7 +59,6 @@ class VehicleBehaviorTree : public BehaviorPluginBase
DEFINE_GETTER_SETTER(DebugMarker, std::vector<visualization_msgs::msg::Marker>)
DEFINE_GETTER_SETTER(DefaultMatchingDistanceForLaneletPoseCalculation, double)
DEFINE_GETTER_SETTER(GoalPoses, std::vector<geometry_msgs::msg::Pose>)
DEFINE_GETTER_SETTER(HdMapUtils, std::shared_ptr<hdmap_utils::HdMapUtils>)
DEFINE_GETTER_SETTER(LaneChangeParameters, traffic_simulator::lane_change::Parameter)
DEFINE_GETTER_SETTER(Obstacle, std::optional<traffic_simulator_msgs::msg::Obstacle>)
DEFINE_GETTER_SETTER(OtherEntityStatus, EntityStatusDict)
Expand Down
3 changes: 0 additions & 3 deletions simulation/behavior_tree_plugin/src/action_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ auto ActionNode::getBlackBoardValues() -> void
if (!getInput<double>("current_time", current_time)) {
THROW_SIMULATION_ERROR("failed to get input current_time in ActionNode");
}
if (!getInput<std::shared_ptr<hdmap_utils::HdMapUtils>>("hdmap_utils", hdmap_utils)) {
THROW_SIMULATION_ERROR("failed to get input hdmap_utils in ActionNode");
}
if (!getInput<std::shared_ptr<traffic_simulator::TrafficLightsBase>>(
"traffic_lights", traffic_lights)) {
THROW_SIMULATION_ERROR("failed to get input traffic_lights in ActionNode");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <optional>
#include <scenario_simulator_exception/exception.hpp>
#include <string>
#include <traffic_simulator/utils/distance.hpp>
#include <traffic_simulator/utils/route.hpp>
#include <vector>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <scenario_simulator_exception/exception.hpp>
#include <string>
#include <traffic_simulator/helper/stop_watch.hpp>
#include <traffic_simulator/utils/distance.hpp>
#include <traffic_simulator/utils/route.hpp>
#include <vector>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
#include <rclcpp/rclcpp.hpp>
#include <scenario_simulator_exception/exception.hpp>
#include <string>
#include <traffic_simulator/utils/distance.hpp>
#include <traffic_simulator/utils/route.hpp>
#include <utility>
#include <vector>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <optional>
#include <scenario_simulator_exception/exception.hpp>
#include <string>
#include <traffic_simulator/utils/distance.hpp>
#include <traffic_simulator/utils/route.hpp>
#include <utility>
#include <vector>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <optional>
#include <scenario_simulator_exception/exception.hpp>
#include <string>
#include <traffic_simulator/utils/distance.hpp>
#include <traffic_simulator/utils/route.hpp>
#include <utility>
#include <vector>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
#include <optional>
#include <scenario_simulator_exception/exception.hpp>
#include <string>
#include <traffic_simulator/utils/distance.hpp>
#include <traffic_simulator/utils/route.hpp>
#include <vector>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
#include <optional>
#include <scenario_simulator_exception/exception.hpp>
#include <string>
#include <traffic_simulator/utils/pose.hpp>
#include <traffic_simulator/utils/route.hpp>
#include <vector>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ private: \
DEFINE_GETTER_SETTER(BehaviorParameter, traffic_simulator_msgs::msg::BehaviorParameter, behavior_parameter_)
DEFINE_GETTER_SETTER(CanonicalizedEntityStatus, std::shared_ptr<traffic_simulator::CanonicalizedEntityStatus>, canonicalized_entity_status_)
DEFINE_GETTER_SETTER(CurrentTime, double, current_time_)
DEFINE_GETTER_SETTER(HdMapUtils, std::shared_ptr<hdmap_utils::HdMapUtils>, hdmap_utils_)
DEFINE_GETTER_SETTER(PolylineTrajectory, std::shared_ptr<traffic_simulator_msgs::msg::PolylineTrajectory>, polyline_trajectory)
DEFINE_GETTER_SETTER(Request, traffic_simulator::behavior::Request, request)
DEFINE_GETTER_SETTER(StepTime, double, step_time_)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,7 @@ void toMsg(const rosgraph_msgs::Clock & proto, rosgraph_msgs::msg::Clock & time)
void toProto(const std_msgs::msg::Header & header, std_msgs::Header & proto);
void toMsg(const std_msgs::Header & proto, std_msgs::msg::Header & header);

// clang-format off
#define DEFINE_CONVERSION(PACKAGE, TYPENAME) \
auto toProto(const PACKAGE::msg::TYPENAME &, PACKAGE::TYPENAME &)->void; \
auto toMsg(const PACKAGE::TYPENAME &, PACKAGE::msg::TYPENAME &)->void
Expand Down Expand Up @@ -254,6 +255,7 @@ auto toMsg(
traffic_light_bulb_state.color = convert_color(proto.color());
traffic_light_bulb_state.confidence = proto.confidence();
}
// clang-format on

auto toProtobufMessage(const traffic_simulator_msgs::msg::Vertex &)
-> traffic_simulator_msgs::Vertex;
Expand Down
2 changes: 1 addition & 1 deletion simulation/traffic_simulator/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ ament_auto_add_library(traffic_simulator SHARED
src/entity/misc_object_entity.cpp
src/entity/pedestrian_entity.cpp
src/entity/vehicle_entity.cpp
src/hdmap_utils/hdmap_utils.cpp
src/helper/helper.cpp
src/helper/ostream_helpers.cpp
src/job/job.cpp
Expand Down Expand Up @@ -72,6 +71,7 @@ ament_auto_add_library(traffic_simulator SHARED
src/utils/lanelet_map.cpp
src/utils/pose.cpp
src/utils/route.cpp
src/utils/traffic_lights.cpp
)

ament_auto_add_library(visualization_component SHARED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
#include <traffic_simulator/data_type/lanelet_pose.hpp>
#include <traffic_simulator/entity/entity_base.hpp>
#include <traffic_simulator/entity/entity_manager.hpp>
#include <traffic_simulator/hdmap_utils/hdmap_utils.hpp>
#include <traffic_simulator/helper/helper.hpp>
#include <traffic_simulator/simulation_clock/simulation_clock.hpp>
#include <traffic_simulator/traffic/traffic_controller.hpp>
Expand Down Expand Up @@ -70,8 +69,7 @@ class API
entity_manager_ptr_(
std::make_shared<entity::EntityManager>(node, configuration, node_parameters_)),
traffic_lights_ptr_(std::make_shared<TrafficLights>(
node, entity_manager_ptr_->getHdmapUtils(),
getROS2Parameter<std::string>("architecture_type", "awf/universe/20240605"))),
node, getROS2Parameter<std::string>("architecture_type", "awf/universe/20240605"))),
traffic_controller_ptr_(std::make_shared<traffic::TrafficController>(
[this](const std::string & name) { despawn(name); }, entity_manager_ptr_,
configuration.auto_sink_entity_types)),
Expand Down Expand Up @@ -328,7 +326,6 @@ class API
FORWARD_TO_ENTITY_MANAGER(getEntityNames);
FORWARD_TO_ENTITY_MANAGER(getEntityPointer);
FORWARD_TO_ENTITY_MANAGER(getFirstEgoName);
FORWARD_TO_ENTITY_MANAGER(getHdmapUtils);
FORWARD_TO_ENTITY_MANAGER(isEntityExist);
FORWARD_TO_ENTITY_MANAGER(isNpcLogicStarted);
FORWARD_TO_ENTITY_MANAGER(resetBehaviorPlugin);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@
#ifndef TRAFFIC_SIMULATOR__BEHAVIOR__BEHAVIOR_PLUGIN_BASE_HPP_
#define TRAFFIC_SIMULATOR__BEHAVIOR__BEHAVIOR_PLUGIN_BASE_HPP_

#include <geometry/spline/catmull_rom_subspline.hpp>
#include <optional>
#include <string>
#include <traffic_simulator/behavior/follow_trajectory.hpp>
#include <traffic_simulator/data_type/behavior.hpp>
#include <traffic_simulator/data_type/entity_status.hpp>
#include <traffic_simulator/hdmap_utils/hdmap_utils.hpp>
#include <traffic_simulator/data_type/lane_change.hpp>
#include <traffic_simulator/traffic_lights/traffic_lights.hpp>
#include <traffic_simulator_msgs/msg/behavior_parameter.hpp>
#include <traffic_simulator_msgs/msg/entity_type.hpp>
Expand All @@ -40,27 +41,26 @@ class BehaviorPluginBase
{
public:
virtual ~BehaviorPluginBase() = default;
virtual void configure(const rclcpp::Logger & logger) = 0;
virtual auto configure(const rclcpp::Logger & logger) -> void = 0;
virtual auto update(const double current_time, const double step_time) -> void = 0;
virtual const std::string & getCurrentAction() const = 0;
virtual auto getCurrentAction() const -> const std::string & = 0;

#define DEFINE_GETTER_SETTER(NAME, KEY, TYPE) \
virtual TYPE get##NAME() = 0; \
virtual void set##NAME(const TYPE & value) = 0; \
auto get##NAME##Key() const->const std::string & \
{ \
static const std::string key = KEY; \
return key; \
// clang-format off
#define DEFINE_GETTER_SETTER(NAME, KEY, TYPE) \
virtual auto get##NAME() -> TYPE = 0; \
virtual auto set##NAME(const TYPE & value) -> void = 0; \
/* */ auto get##NAME##Key() const -> const std::string & \
{ \
static const std::string key = KEY; \
return key; \
}

// clang-format off
DEFINE_GETTER_SETTER(BehaviorParameter, "behavior_parameter", traffic_simulator_msgs::msg::BehaviorParameter)
DEFINE_GETTER_SETTER(CanonicalizedEntityStatus, "canonicalized_entity_status", std::shared_ptr<traffic_simulator::CanonicalizedEntityStatus>)
DEFINE_GETTER_SETTER(CurrentTime, "current_time", double)
DEFINE_GETTER_SETTER(DebugMarker, "debug_marker", std::vector<visualization_msgs::msg::Marker>)
DEFINE_GETTER_SETTER(DefaultMatchingDistanceForLaneletPoseCalculation, "matching_distance_for_lanelet_pose_calculation", double)
DEFINE_GETTER_SETTER(GoalPoses, "goal_poses", std::vector<geometry_msgs::msg::Pose>)
DEFINE_GETTER_SETTER(HdMapUtils, "hdmap_utils", std::shared_ptr<hdmap_utils::HdMapUtils>)
DEFINE_GETTER_SETTER(LaneChangeParameters, "lane_change_parameters", traffic_simulator::lane_change::Parameter)
DEFINE_GETTER_SETTER(Obstacle, "obstacle", std::optional<traffic_simulator_msgs::msg::Obstacle>)
DEFINE_GETTER_SETTER(OtherEntityStatus, "other_entity_status", EntityStatusDict)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@ class EgoEntity : public VehicleEntity, private concealer::FieldOperatorApplicat

explicit EgoEntity(
const std::string & name, const CanonicalizedEntityStatus &,
const std::shared_ptr<hdmap_utils::HdMapUtils> &,
const traffic_simulator_msgs::msg::VehicleParameters &, const Configuration &,
const rclcpp::node_interfaces::NodeParametersInterface::SharedPtr &);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
#include <traffic_simulator/data_type/entity_status.hpp>
#include <traffic_simulator/data_type/lane_change.hpp>
#include <traffic_simulator/data_type/speed_change.hpp>
#include <traffic_simulator/hdmap_utils/hdmap_utils.hpp>
#include <traffic_simulator/helper/helper.hpp>
#include <traffic_simulator/job/job_list.hpp>
#include <traffic_simulator/traffic_lights/traffic_lights.hpp>
Expand All @@ -50,9 +49,7 @@ namespace entity
class EntityBase
{
public:
explicit EntityBase(
const std::string & name, const CanonicalizedEntityStatus & entity_status,
const std::shared_ptr<hdmap_utils::HdMapUtils> & hdmap_utils_ptr);
explicit EntityBase(const std::string & name, const CanonicalizedEntityStatus & entity_status);

EntityBase(const EntityBase &) = delete;

Expand Down Expand Up @@ -295,7 +292,6 @@ class EntityBase

CanonicalizedEntityStatus status_before_update_;

std::shared_ptr<hdmap_utils::HdMapUtils> hdmap_utils_ptr_;
std::shared_ptr<traffic_simulator::TrafficLightsBase> traffic_lights_;

double stand_still_duration_ = 0.0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@
#include <traffic_simulator/entity/misc_object_entity.hpp>
#include <traffic_simulator/entity/pedestrian_entity.hpp>
#include <traffic_simulator/entity/vehicle_entity.hpp>
#include <traffic_simulator/hdmap_utils/hdmap_utils.hpp>
#include <traffic_simulator/traffic_lights/configurable_rate_updater.hpp>
#include <traffic_simulator/traffic_lights/traffic_light_marker_publisher.hpp>
#include <traffic_simulator/traffic_lights/traffic_light_publisher.hpp>
Expand Down Expand Up @@ -92,8 +91,6 @@ class EntityManager
using MarkerArray = visualization_msgs::msg::MarkerArray;
const rclcpp::Publisher<MarkerArray>::SharedPtr lanelet_marker_pub_ptr_;

const std::shared_ptr<hdmap_utils::HdMapUtils> hdmap_utils_ptr_;

MarkerArray markers_raw_;

std::shared_ptr<traffic_simulator::TrafficLights> traffic_lights_ptr_;
Expand All @@ -110,24 +107,6 @@ class EntityManager
traffic_lights_ptr_ = traffic_lights_ptr;
}

template <typename Node>
auto getOrigin(Node & node) const
{
geographic_msgs::msg::GeoPoint origin;
{
if (!node.has_parameter("origin_latitude")) {
node.declare_parameter("origin_latitude", 0.0);
}
if (!node.has_parameter("origin_longitude")) {
node.declare_parameter("origin_longitude", 0.0);
}
node.get_parameter("origin_latitude", origin.latitude);
node.get_parameter("origin_longitude", origin.longitude);
}

return origin;
}

template <class NodeT, class AllocatorT = std::allocator<void>>
explicit EntityManager(
NodeT && node, const Configuration & configuration,
Expand All @@ -145,11 +124,9 @@ class EntityManager
lanelet_marker_pub_ptr_(rclcpp::create_publisher<MarkerArray>(
node, "lanelet/marker", LaneletMarkerQoS(),
rclcpp::PublisherOptionsWithAllocator<AllocatorT>())),
hdmap_utils_ptr_(std::make_shared<hdmap_utils::HdMapUtils>(
configuration.lanelet2_map_path(), getOrigin(*node))),
markers_raw_(hdmap_utils_ptr_->generateMarker())
markers_raw_(lanelet_map::visualizationMarker())
{
updateHdmapMarker();
updateLaneletMarker();
}

~EntityManager() = default;
Expand Down Expand Up @@ -182,8 +159,6 @@ class EntityManager

auto getEgoEntity(const std::string & name) const -> const entity::EgoEntity &;

auto getHdmapUtils() -> const std::shared_ptr<hdmap_utils::HdMapUtils> &;

auto getNumberOfEgo() const -> std::size_t;

auto getObstacle(const std::string & name)
Expand Down Expand Up @@ -305,8 +280,7 @@ class EntityManager

if (const auto [iter, success] = entities_.emplace(
name, std::make_unique<Entity>(
name, makeEntityStatus(), hdmap_utils_ptr_, parameters,
std::forward<decltype(xs)>(xs)...));
name, makeEntityStatus(), parameters, std::forward<decltype(xs)>(xs)...));
success) {
// FIXME: this ignores V2I traffic lights
iter->second->setTrafficLights(traffic_lights_ptr_->getConventionalTrafficLights());
Expand All @@ -331,7 +305,7 @@ class EntityManager

void update(const double current_time, const double step_time);

void updateHdmapMarker();
void updateLaneletMarker();

auto startNpcLogic(const double current_time) -> void;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class MiscObjectEntity : public EntityBase
public:
explicit MiscObjectEntity(
const std::string & name, const CanonicalizedEntityStatus &,
const std::shared_ptr<hdmap_utils::HdMapUtils> &,
const traffic_simulator_msgs::msg::MiscObjectParameters &);

void onUpdate(double, double) override;
Expand Down
Loading
Loading