15 #ifndef SIMPLE_SENSOR_SIMULATOR__SENSOR_SIMULATION__OCCUPANCY_GRID__OCCUPANCY_GRID_SENSOR_HPP_
16 #define SIMPLE_SENSOR_SIMULATOR__SENSOR_SIMULATION__OCCUPANCY_GRID__OCCUPANCY_GRID_SENSOR_HPP_
18 #include <simulation_api_schema.pb.h>
21 #include <nav_msgs/msg/occupancy_grid.hpp>
22 #include <rclcpp/rclcpp.hpp>
42 const double current_simulation_time,
43 const simulation_api_schema::OccupancyGridSensorConfiguration & configuration)
55 const double current_simulation_time,
const std::vector<traffic_simulator_msgs::EntityStatus> &,
56 const rclcpp::Time & current_ros_time,
57 const std::vector<std::string> & lidar_detected_entities) = 0;
65 const std::vector<traffic_simulator_msgs::EntityStatus> & status,
66 const std::vector<std::string> & lidar_detected_entities)
const;
75 const std::vector<traffic_simulator_msgs::EntityStatus> &)
const;
84 const typename rclcpp::Publisher<T>::SharedPtr publisher_ptr_;
90 auto getOccupancyGrid(
91 const std::vector<traffic_simulator_msgs::EntityStatus> &,
const rclcpp::Time &,
92 const std::vector<std::string> &) -> T;
96 const double current_simulation_time,
97 const simulation_api_schema::OccupancyGridSensorConfiguration & configuration,
98 const typename rclcpp::Publisher<T>::SharedPtr & publisher_ptr)
100 publisher_ptr_(publisher_ptr),
101 builder_(configuration.resolution(), configuration.height(), configuration.width())
106 const double current_simulation_time,
107 const std::vector<traffic_simulator_msgs::EntityStatus> & entities,
108 const rclcpp::Time & current_ros_time,
const std::vector<std::string> & lidar_detected_entities)
115 publisher_ptr_->publish(
116 getOccupancyGrid(entities, current_ros_time, lidar_detected_entities));
127 auto OccupancyGridSensor<nav_msgs::msg::OccupancyGrid>::getOccupancyGrid(
128 const std::vector<traffic_simulator_msgs::EntityStatus> & status,
const rclcpp::Time & stamp,
129 const std::vector<std::string> & lidar_detected_entities) -> nav_msgs::msg::OccupancyGrid;
grid
Definition: occupancy_grid_builder.hpp:30
Base class of occupancy grid sensor simulator.
Definition: occupancy_grid_sensor.hpp:33
geometry_msgs::Pose getSensorPose(const std::vector< traffic_simulator_msgs::EntityStatus > &) const
Extract sensor pose from entity statuses.
Definition: occupancy_grid_sensor.cpp:28
std::vector< std::string > detected_objects_
Definition: occupancy_grid_sensor.hpp:39
virtual void update(const double current_simulation_time, const std::vector< traffic_simulator_msgs::EntityStatus > &, const rclcpp::Time ¤t_ros_time, const std::vector< std::string > &lidar_detected_entities)=0
Update sensor status.
virtual ~OccupancyGridSensorBase()=default
OccupancyGridSensorBase(const double current_simulation_time, const simulation_api_schema::OccupancyGridSensorConfiguration &configuration)
Definition: occupancy_grid_sensor.hpp:41
simulation_api_schema::OccupancyGridSensorConfiguration configuration_
Definition: occupancy_grid_sensor.hpp:37
double previous_simulation_time_
Definition: occupancy_grid_sensor.hpp:35
const std::vector< std::string > getDetectedObjects(const std::vector< traffic_simulator_msgs::EntityStatus > &status, const std::vector< std::string > &lidar_detected_entities) const
List all objects in range of sensor sight.
Definition: occupancy_grid_sensor.cpp:41
occupancy grid sensor implementation
Definition: occupancy_grid_sensor.hpp:83
auto update(const double current_simulation_time, const std::vector< traffic_simulator_msgs::EntityStatus > &entities, const rclcpp::Time ¤t_ros_time, const std::vector< std::string > &lidar_detected_entities) -> void override
Update sensor status.
Definition: occupancy_grid_sensor.hpp:105
OccupancyGridSensor(const double current_simulation_time, const simulation_api_schema::OccupancyGridSensorConfiguration &configuration, const typename rclcpp::Publisher< T >::SharedPtr &publisher_ptr)
Definition: occupancy_grid_sensor.hpp:95
Definition: constants.hpp:19