Skip to content
Snippets Groups Projects
Commit 5af8c397 authored by Joan Vallvé Navarro's avatar Joan Vallvé Navarro
Browse files

capture_landmark_external added field type

parent e1960086
No related branches found
No related tags found
3 merge requests!476spdlog version upgrade,!473Rerefactor,!472Merge ProcessorLandmarkExternal
...@@ -21,41 +21,50 @@ ...@@ -21,41 +21,50 @@
//--------LICENSE_END-------- //--------LICENSE_END--------
#pragma once #pragma once
//Wolf includes // Wolf includes
#include "core/capture/capture_base.h" #include "core/capture/capture_base.h"
namespace wolf { namespace wolf
{
struct LandmarkDetection struct LandmarkDetection
{ {
int id; // id of landmark int id; // id of landmark
int type; // type of landmark
Eigen::VectorXd measure; // either pose or position Eigen::VectorXd measure; // either pose or position
Eigen::MatrixXd covariance; // covariance of the measure Eigen::MatrixXd covariance; // covariance of the measure
double quality; // [0, 1] quality of the detection double quality; // [0, 1] quality of the detection
}; };
WOLF_PTR_TYPEDEFS(CaptureLandmarksExternal); WOLF_PTR_TYPEDEFS(CaptureLandmarksExternal);
//class CaptureLandmarksExternal // class CaptureLandmarksExternal
class CaptureLandmarksExternal : public CaptureBase class CaptureLandmarksExternal : public CaptureBase
{ {
protected: protected:
std::vector<LandmarkDetection> detections_; std::vector<LandmarkDetection> detections_;
public:
CaptureLandmarksExternal(const TimeStamp& _ts, public:
SensorBasePtr _sensor_ptr, CaptureLandmarksExternal(const TimeStamp& _ts,
const std::vector<int>& _ids = {}, SensorBasePtr _sensor_ptr,
const std::vector<Eigen::VectorXd>& _detections = {}, const std::vector<int>& _ids = {},
const std::vector<Eigen::MatrixXd>& _covs = {}, const std::vector<int>& _types = {},
const std::vector<double>& _qualities = {}); const std::vector<Eigen::VectorXd>& _detections = {},
const std::vector<Eigen::MatrixXd>& _covs = {},
const std::vector<double>& _qualities = {});
~CaptureLandmarksExternal() override; ~CaptureLandmarksExternal() override;
std::vector<LandmarkDetection> getDetections() const {return detections_;}; std::vector<LandmarkDetection> getDetections() const
{
return detections_;
};
void addDetection(const int& _id, const Eigen::VectorXd& _detection, const Eigen::MatrixXd& _cov, const double& quality); void addDetection(const int& _id,
const int& _type,
const Eigen::VectorXd& _detection,
const Eigen::MatrixXd& _cov,
const double& quality);
}; };
} //namespace wolf } // namespace wolf
...@@ -26,6 +26,7 @@ namespace wolf{ ...@@ -26,6 +26,7 @@ namespace wolf{
CaptureLandmarksExternal::CaptureLandmarksExternal(const TimeStamp& _ts, CaptureLandmarksExternal::CaptureLandmarksExternal(const TimeStamp& _ts,
SensorBasePtr _sensor_ptr, SensorBasePtr _sensor_ptr,
const std::vector<int>& _ids, const std::vector<int>& _ids,
const std::vector<int>& _types,
const std::vector<Eigen::VectorXd>& _detections, const std::vector<Eigen::VectorXd>& _detections,
const std::vector<Eigen::MatrixXd>& _covs, const std::vector<Eigen::MatrixXd>& _covs,
const std::vector<double>& _qualities) : const std::vector<double>& _qualities) :
...@@ -37,7 +38,7 @@ CaptureLandmarksExternal::CaptureLandmarksExternal(const TimeStamp& _ts, ...@@ -37,7 +38,7 @@ CaptureLandmarksExternal::CaptureLandmarksExternal(const TimeStamp& _ts,
throw std::runtime_error("CaptureLandmarksExternal constructor: '_ids', '_detections', '_covs', '_qualities' should have the same size."); throw std::runtime_error("CaptureLandmarksExternal constructor: '_ids', '_detections', '_covs', '_qualities' should have the same size.");
for (auto i = 0; i < _detections.size(); i++) for (auto i = 0; i < _detections.size(); i++)
addDetection(_ids.at(i), _detections.at(i), _covs.at(i), _qualities.at(i)); addDetection(_ids.at(i), _types.at(i), _detections.at(i), _covs.at(i), _qualities.at(i));
} }
CaptureLandmarksExternal::~CaptureLandmarksExternal() CaptureLandmarksExternal::~CaptureLandmarksExternal()
...@@ -45,9 +46,9 @@ CaptureLandmarksExternal::~CaptureLandmarksExternal() ...@@ -45,9 +46,9 @@ CaptureLandmarksExternal::~CaptureLandmarksExternal()
// //
} }
void CaptureLandmarksExternal::addDetection(const int& _id, const Eigen::VectorXd& _detection, const Eigen::MatrixXd& _cov, const double& _quality) void CaptureLandmarksExternal::addDetection(const int& _id, const int& _type, const Eigen::VectorXd& _detection, const Eigen::MatrixXd& _cov, const double& _quality)
{ {
detections_.push_back(LandmarkDetection{_id, _detection, _cov, _quality}); detections_.push_back(LandmarkDetection{_id, _type, _detection, _cov, _quality});
} }
} // namespace wolf } // namespace wolf
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