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

Feature/simple sensor simulator/custom noise #1200

Merged
merged 20 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
3aaa748
Lipsticks
yamacir-kit Feb 27, 2024
8f0c1c0
Move the DetectedObject construction to a new free function
yamacir-kit Feb 27, 2024
f5642a2
Split ROS message type object construction into some free functions
yamacir-kit Feb 27, 2024
6ff4898
Add type U for ground truth to the template parameter of DetectionSensor
yamacir-kit Feb 27, 2024
640f90b
Move the process of applying noise to a new structure `DefaultNoise`
yamacir-kit Feb 29, 2024
d738fc8
Rename variables to appropriate for the current class content
yamacir-kit Feb 29, 2024
9d9dd53
Add new struct `CustomNoiseApplicator`
yamacir-kit Feb 29, 2024
3997537
Simplify complex and inefficient function `filterObjectsBySensorRange`
yamacir-kit Feb 29, 2024
7eb9ae5
Update `DefaultNoiseApplicator` to hold reference to Ego entity's status
yamacir-kit Feb 29, 2024
33e4dd7
Rename function argument `detected_object` to `detected_objects`
yamacir-kit Feb 29, 2024
d936a20
Replace the word `TheEntity` with `EgoEntity`
yamacir-kit Feb 29, 2024
fc83e5b
Remove the upper limit `300.0` of the detection sensor range
yamacir-kit Mar 1, 2024
203ac0a
Merge remote-tracking branch 'origin/master' into feature/simple_sens…
yamacir-kit Mar 1, 2024
ff45d0b
Merge remote-tracking branch 'origin/master' into feature/simple_sens…
yamacir-kit Mar 19, 2024
5632aa2
Merge remote-tracking branch 'origin/master' into feature/simple_sens…
yamacir-kit Mar 25, 2024
61465e9
Merge remote-tracking branch 'origin/master' into feature/simple_sens…
yamacir-kit Mar 25, 2024
f36b14b
Merge remote-tracking branch 'origin/master' into feature/simple_sens…
yamacir-kit Mar 26, 2024
059679e
Merge branch 'master' into feature/simple_sensor_simulator/custom_noise
yamacir-kit Mar 27, 2024
a80bc4a
Merge branch 'master' into feature/simple_sensor_simulator/custom_noise
yamacir-kit Mar 27, 2024
3cd57db
Merge branch 'master' into feature/simple_sensor_simulator/custom_noise
yamacir-kit Mar 28, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,12 @@ class DetectionSensorBase
{
}

auto isWithinRange(
const geometry_msgs::Point & point1, const geometry_msgs::Point & point2,
const double range) const -> bool;
auto isEgoEntityStatusToWhichThisSensorIsAttached(
const traffic_simulator_msgs::EntityStatus &) const -> bool;

auto filterObjectsBySensorRange(
const std::vector<traffic_simulator_msgs::EntityStatus> &, const std::vector<std::string> &,
const double) const -> std::vector<std::string>;

auto getEntityPose(const std::vector<traffic_simulator_msgs::EntityStatus> &, const std::string &)
const -> geometry_msgs::Pose;

auto getDetectedObjects(const std::vector<traffic_simulator_msgs::EntityStatus> &) const
-> std::vector<std::string>;

auto getSensorPose(const std::vector<traffic_simulator_msgs::EntityStatus> &) const
-> geometry_msgs::Pose;
auto findEgoEntityStatusToWhichThisSensorIsAttached(
const std::vector<traffic_simulator_msgs::EntityStatus> &) const
-> std::vector<traffic_simulator_msgs::EntityStatus>::const_iterator;

public:
virtual ~DetectionSensorBase() = default;
Expand All @@ -67,27 +57,30 @@ class DetectionSensorBase
const std::vector<std::string> & lidar_detected_entities) = 0;
};

template <typename T>
template <typename T, typename U = autoware_auto_perception_msgs::msg::TrackedObjects>
class DetectionSensor : public DetectionSensorBase
{
const typename rclcpp::Publisher<T>::SharedPtr publisher_ptr_;
const typename rclcpp::Publisher<T>::SharedPtr detected_objects_publisher;

const typename rclcpp::Publisher<U>::SharedPtr ground_truth_objects_publisher;

typename rclcpp::PublisherBase::SharedPtr ground_truth_publisher_base_ptr_;
std::default_random_engine random_engine_;

std::mt19937 random_engine_;
std::queue<std::pair<autoware_auto_perception_msgs::msg::DetectedObjects, double>>
detected_objects_queue;

auto applyPositionNoise(typename T::_objects_type::value_type) ->
typename T::_objects_type::value_type;
std::queue<std::pair<autoware_auto_perception_msgs::msg::TrackedObjects, double>>
ground_truth_objects_queue;

public:
explicit DetectionSensor(
const double current_simulation_time,
const simulation_api_schema::DetectionSensorConfiguration & configuration,
const typename rclcpp::Publisher<T>::SharedPtr & publisher,
const typename rclcpp::PublisherBase::SharedPtr & ground_truth_publisher = nullptr)
const typename rclcpp::Publisher<U>::SharedPtr & ground_truth_publisher = nullptr)
: DetectionSensorBase(current_simulation_time, configuration),
publisher_ptr_(publisher),
ground_truth_publisher_base_ptr_(ground_truth_publisher),
detected_objects_publisher(publisher),
ground_truth_objects_publisher(ground_truth_publisher),
random_engine_(configuration.random_seed())
{
}
Expand Down
Loading
Loading