-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add new discrete landmark and bearing sensor models to the beluga lib…
…rary (#268) - Adds a slightly polished version of the landmark and bearing sensor models created during last week's hackaton. - Both have been extended to both 2D and 3D particle states (since it was trivial). - Tests have been improved. - A residual bug in the bearing model was found and fixed. - Minor refactoring to avoid crowding the `sensors.hpp` file with interfaces. Signed-off-by: Gerardo Puga <[email protected]>
- Loading branch information
Showing
17 changed files
with
1,395 additions
and
46 deletions.
There are no files selected for viewing
69 changes: 69 additions & 0 deletions
69
beluga/include/beluga/interfaces/bearing_sensor_model_interface.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Copyright 2022-2023 Ekumen, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef BELUGA_INTERFACES_BEARING_SENSOR_MODEL_INTERFACE_HPP | ||
#define BELUGA_INTERFACES_BEARING_SENSOR_MODEL_INTERFACE_HPP | ||
|
||
// standard library | ||
#include <cstdint> | ||
#include <vector> | ||
|
||
// project | ||
#include <beluga/types/landmark_detection_types.hpp> | ||
|
||
/** | ||
* \file | ||
* \brief Includes the interface for bearing sensor models. | ||
*/ | ||
|
||
namespace beluga { | ||
|
||
/// Pure abstract class representing the bearing sensor model interface. | ||
/** | ||
* \tparam Map Bearing landmarks representation type. | ||
*/ | ||
template <class Map> | ||
struct BearingSensorModelInterface { | ||
/// Measurement type of the sensor: vector of landmark detections | ||
using measurement_type = std::vector<LandmarkBearingDetection>; | ||
|
||
/// Virtual destructor. | ||
virtual ~BearingSensorModelInterface() = default; | ||
|
||
/// Update the sensor model with the measured points. | ||
/** | ||
* This method updates the sensor model with the information | ||
* it needs to compute the weight of each particle. | ||
* The weight of each particle is calculated by subsequent calls to | ||
* the `importance_weight()` method provided by the same mixin | ||
* component. | ||
* | ||
* \param points The discrete sensor detections. | ||
*/ | ||
virtual void update_sensor(measurement_type&& points) = 0; | ||
|
||
/// Update the sensor model with a new map. | ||
/** | ||
* This method updates the sensor model with a new map, | ||
* i.e. a representation of the environment, that it needs | ||
* to compute the weight of each particle. | ||
* | ||
* \param map The range finder map. | ||
*/ | ||
virtual void update_map(Map&& map) = 0; | ||
}; | ||
|
||
} // namespace beluga | ||
|
||
#endif |
69 changes: 69 additions & 0 deletions
69
beluga/include/beluga/interfaces/landmark_sensor_model_interface.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
// Copyright 2022-2023 Ekumen, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef BELUGA_INTERFACES_LANDMARK_SENSOR_MODEL_INTERFACE_HPP | ||
#define BELUGA_INTERFACES_LANDMARK_SENSOR_MODEL_INTERFACE_HPP | ||
|
||
// standard library | ||
#include <cstdint> | ||
#include <vector> | ||
|
||
// project | ||
#include <beluga/types/landmark_detection_types.hpp> | ||
|
||
/** | ||
* \file | ||
* \brief Includes the interface for generic landmark sensor models. | ||
*/ | ||
|
||
namespace beluga { | ||
|
||
/// Pure abstract class representing a generic landmark sensor model. | ||
/** | ||
* \tparam Landmark information representation type. | ||
*/ | ||
template <class Map> | ||
struct LandmarkSensorModelInterface { | ||
/// Measurement type of the sensor, detection position in robot frame | ||
using measurement_type = std::vector<LandmarkPositionDetection>; | ||
|
||
/// Virtual destructor. | ||
virtual ~LandmarkSensorModelInterface() = default; | ||
|
||
/// Update the sensor model with the measured points. | ||
/** | ||
* This method updates the sensor model with the information | ||
* it needs to compute the weight of each particle. | ||
* The weight of each particle is calculated by subsequent calls to | ||
* the `importance_weight()` method provided by the same mixin | ||
* component. | ||
* | ||
* \param points The discrete sensor detections in the reference frame of the particle. | ||
*/ | ||
virtual void update_sensor(measurement_type&& points) = 0; | ||
|
||
/// Update the sensor model with a new map. | ||
/** | ||
* This method updates the sensor model with a new map, | ||
* i.e. a representation of the environment, that it needs | ||
* to compute the weight of each particle. | ||
* | ||
* \param map The range finder map. | ||
*/ | ||
virtual void update_map(Map&& map) = 0; | ||
}; | ||
|
||
} // namespace beluga | ||
|
||
#endif |
64 changes: 64 additions & 0 deletions
64
beluga/include/beluga/interfaces/laser_sensor_model_interface_2d.hpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
// Copyright 2022-2023 Ekumen, Inc. | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
#ifndef BELUGA_INTERFACES_LASER_SENSOR_MODEL_INTERFACE_2D_HPP | ||
#define BELUGA_INTERFACES_LASER_SENSOR_MODEL_INTERFACE_2D_HPP | ||
|
||
#include <vector> | ||
|
||
/** | ||
* \file | ||
* \brief Includes the interface for laser sensor models. | ||
*/ | ||
|
||
namespace beluga { | ||
|
||
/// Pure abstract class representing the laser sensor model interface. | ||
/** | ||
* \tparam Map Environment representation type. | ||
*/ | ||
template <class Map> | ||
struct LaserSensorModelInterface2d { | ||
/// Measurement type of the sensor: a point cloud for the range finder. | ||
using measurement_type = std::vector<std::pair<double, double>>; | ||
|
||
/// Virtual destructor. | ||
virtual ~LaserSensorModelInterface2d() = default; | ||
|
||
/// Update the sensor model with the measured points. | ||
/** | ||
* This method updates the sensor model with the information | ||
* it needs to compute the weight of each particle. | ||
* The weight of each particle is calculated by subsequent calls to | ||
* the `importance_weight()` method provided by the same mixin | ||
* component. | ||
* | ||
* \param points The range finder points in the reference frame of the particle. | ||
*/ | ||
virtual void update_sensor(measurement_type&& points) = 0; | ||
|
||
/// Update the sensor model with a new map. | ||
/** | ||
* This method updates the sensor model with a new map, | ||
* i.e. a representation of the environment, that it needs | ||
* to compute the weight of each particle. | ||
* | ||
* \param map The range finder map. | ||
*/ | ||
virtual void update_map(Map&& map) = 0; | ||
}; | ||
|
||
} // namespace beluga | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.