Commit aac67f15 authored by mederic_fourmy's avatar mederic_fourmy
Browse files

Rename FeatureApriltag -> FeatureApriltagPose

parent 6fb1121f
......@@ -104,7 +104,7 @@ SET(HDRS_FACTOR
include/${PROJECT_NAME}/factor/factor_apriltag_proj.h
)
SET(HDRS_FEATURE
include/${PROJECT_NAME}/feature/feature_apriltag.h
include/${PROJECT_NAME}/feature/feature_apriltag_pose.h
include/${PROJECT_NAME}/feature/feature_apriltag_proj.h
)
SET(HDRS_LANDMARK
......@@ -117,7 +117,7 @@ include/${PROJECT_NAME}/processor/ippe.h
# ============ SOURCES ============
SET(SRCS_FEATURE
src/feature/feature_apriltag.cpp
src/feature/feature_apriltag_pose.cpp
src/feature/feature_apriltag_proj.cpp
)
SET(SRCS_LANDMARK
......
......@@ -34,7 +34,7 @@
#include "core/sensor/sensor_camera.h"
#include "core/processor/processor_tracker_landmark_apriltag.h"
#include "core/capture/capture_image.h"
#include "core/feature/feature_apriltag.h"
#include "core/feature/feature_apriltag_pose.h"
// opencv
#include <opencv2/imgproc/imgproc.hpp>
......@@ -179,7 +179,7 @@ int main(int argc, char *argv[])
auto img = std::static_pointer_cast<CaptureImage>(cap);
for (FeatureBasePtr f : img->getFeatureList())
{
FeatureApriltagPtr fa = std::static_pointer_cast<FeatureApriltag>(f);
FeatureApriltagPosePtr fa = std::static_pointer_cast<FeatureApriltagPose>(f);
draw_apriltag(img->getImage(), fa->getTagCorners(), 1);
}
cv::imshow( img->getName(), img->getImage() ); // display original image.
......
......@@ -36,15 +36,15 @@
namespace wolf {
WOLF_PTR_TYPEDEFS(FeatureApriltag);
WOLF_PTR_TYPEDEFS(FeatureApriltagPose);
//class FeatureApriltag
class FeatureApriltag : public FeatureBase
//class FeatureApriltagPose
class FeatureApriltagPose : public FeatureBase
{
public:
FeatureApriltag(const Eigen::Vector7d & _measurement,
FeatureApriltagPose(const Eigen::Vector7d & _measurement,
const Eigen::Matrix6d & _meas_covariance,
const int _tag_id,
const Vector8d & _corners_vec,
......@@ -52,7 +52,7 @@ class FeatureApriltag : public FeatureBase
double _rep_error2,
bool _use_rotation,
UncertaintyType _uncertainty_type = UNCERTAINTY_IS_INFO);
~FeatureApriltag() override;
~FeatureApriltagPose() override;
/** \brief Returns tag id
*
......
......@@ -23,7 +23,7 @@
#define _PROCESSOR_TRACKER_LANDMARK_APRILTAG_H_
// Wolf apriltag includes
#include "apriltag/feature/feature_apriltag.h"
#include "apriltag/feature/feature_apriltag_pose.h"
#include "apriltag/landmark/landmark_apriltag.h"
#include "apriltag/factor/factor_apriltag_proj.h"
......
......@@ -19,11 +19,11 @@
// along with this program. If not, see <http://www.gnu.org/licenses/>.
//
//--------LICENSE_END--------
#include "apriltag/feature/feature_apriltag.h"
#include "apriltag/feature/feature_apriltag_pose.h"
namespace wolf {
FeatureApriltag::FeatureApriltag(const Eigen::Vector7d & _measurement,
FeatureApriltagPose::FeatureApriltagPose(const Eigen::Vector7d & _measurement,
const Eigen::Matrix6d & _meas_uncertainty,
const int _tag_id,
const Vector8d & _corners_vec,
......@@ -31,7 +31,7 @@ FeatureApriltag::FeatureApriltag(const Eigen::Vector7d & _measurement,
double _rep_error2,
bool _use_rotation,
UncertaintyType _uncertainty_type) :
FeatureBase("FeatureApriltag", _measurement, _meas_uncertainty, _uncertainty_type),
FeatureBase("FeatureApriltagPose", _measurement, _meas_uncertainty, _uncertainty_type),
tag_id_ (_tag_id),
tag_corners_(4),
rep_error1_(_rep_error1),
......@@ -47,32 +47,32 @@ FeatureApriltag::FeatureApriltag(const Eigen::Vector7d & _measurement,
}
}
FeatureApriltag::~FeatureApriltag()
FeatureApriltagPose::~FeatureApriltagPose()
{
//
}
double FeatureApriltag::getTagId() const
double FeatureApriltagPose::getTagId() const
{
return tag_id_;
}
const std::vector<cv::Point2d>& FeatureApriltag::getTagCorners() const
const std::vector<cv::Point2d>& FeatureApriltagPose::getTagCorners() const
{
return tag_corners_;
}
double FeatureApriltag::getRepError1() const
double FeatureApriltagPose::getRepError1() const
{
return rep_error1_;
}
double FeatureApriltag::getRepError2() const
double FeatureApriltagPose::getRepError2() const
{
return rep_error2_;
}
bool FeatureApriltag::getUserotation() const
bool FeatureApriltagPose::getUserotation() const
{
return use_rotation_;
}
......
......@@ -182,7 +182,7 @@ void ProcessorTrackerLandmarkApriltag::preProcess()
// add to detected features list
detections_incoming_.push_back(std::make_shared<FeatureApriltag>(pose,
detections_incoming_.push_back(std::make_shared<FeatureApriltagPose>(pose,
info,
tag_id,
corners_vec,
......@@ -253,7 +253,7 @@ void ProcessorTrackerLandmarkApriltag::postProcess()
FactorBasePtr ProcessorTrackerLandmarkApriltag::emplaceFactor(FeatureBasePtr _feature_ptr,
LandmarkBasePtr _landmark_ptr)
{
auto feat_pose = std::dynamic_pointer_cast<FeatureApriltag>(_feature_ptr);
auto feat_pose = std::dynamic_pointer_cast<FeatureApriltagPose>(_feature_ptr);
if (feat_pose)
{
return FactorBase::emplace<FactorRelativePose3dWithExtrinsics>(_feature_ptr,
......@@ -314,7 +314,7 @@ LandmarkBasePtr ProcessorTrackerLandmarkApriltag::emplaceLandmark(FeatureBasePtr
Vector7d w_pose_t;
w_pose_t << pos, quat_tmp.coeffs();
FeatureApriltagPtr feat_april = std::static_pointer_cast<FeatureApriltag>(_feature_ptr);
FeatureApriltagPosePtr feat_april = std::static_pointer_cast<FeatureApriltagPose>(_feature_ptr);
int tag_id = feat_april->getTagId();
return LandmarkBase::emplace<LandmarkApriltag>(getProblem()->getMap(), w_pose_t, tag_id, getTagWidth(tag_id));
......@@ -334,7 +334,7 @@ unsigned int ProcessorTrackerLandmarkApriltag::detectNewFeatures(const int& _max
bool feature_already_found(false);
auto feature_april = std::static_pointer_cast<FeatureApriltag>(feature_in_image);
auto feature_april = std::static_pointer_cast<FeatureApriltagPose>(feature_in_image);
//Loop over the landmark to find is one is associated to feature_in_image
for(auto it = landmark_list.begin(); it != landmark_list.end(); ++it){
......@@ -348,7 +348,7 @@ unsigned int ProcessorTrackerLandmarkApriltag::detectNewFeatures(const int& _max
{
for (FeatureBasePtrList::iterator it=_features_out.begin(); it != _features_out.end(); ++it)
{
if (std::static_pointer_cast<FeatureApriltag>(*it)->getTagId() == feature_april->getTagId())
if (std::static_pointer_cast<FeatureApriltagPose>(*it)->getTagId() == feature_april->getTagId())
{
//we have a detection with the same id as the currently processed one. We remove the previous feature from the list for now
_features_out.erase(it);
......@@ -409,7 +409,7 @@ unsigned int ProcessorTrackerLandmarkApriltag::findLandmarks(const LandmarkBaseP
{
for (auto feature_in_image : detections_incoming_)
{
int tag_id(std::static_pointer_cast<FeatureApriltag>(feature_in_image)->getTagId());
int tag_id(std::static_pointer_cast<FeatureApriltagPose>(feature_in_image)->getTagId());
for (auto landmark_in_ptr : _landmarks_in)
{
......
......@@ -8,7 +8,7 @@ add_subdirectory(gtest)
# #
###########################################################
wolf_add_gtest(gtest_feature_apriltag gtest_feature_apriltag.cpp)
wolf_add_gtest(gtest_feature_apriltag gtest_feature_apriltag_pose.cpp)
wolf_add_gtest(gtest_feature_apriltag_proj gtest_feature_apriltag_proj.cpp)
......
......@@ -20,7 +20,7 @@
//
//--------LICENSE_END--------
/**
* \file gtest_feature_apriltag.cpp
* \file gtest_feature_apriltag_pose.cpp
*
* Created on: Dec 22, 2018
* \author: jsola
......@@ -29,7 +29,7 @@
#include <core/utils/utils_gtest.h>
#include "apriltag/feature/feature_apriltag.h"
#include "apriltag/feature/feature_apriltag_pose.h"
using namespace wolf;
......@@ -63,21 +63,21 @@ class FeatureApriltag_test : public testing::Test
TEST_F(FeatureApriltag_test, type)
{
FeatureApriltagPtr f = std::make_shared<FeatureApriltag>(pose, cov, tag_id, corners_vec, rep_error1, rep_error2, use_rotation);
FeatureApriltagPosePtr f = std::make_shared<FeatureApriltagPose>(pose, cov, tag_id, corners_vec, rep_error1, rep_error2, use_rotation);
ASSERT_EQ(f->getType(), "FeatureApriltag");
ASSERT_EQ(f->getType(), "FeatureApriltagPose");
}
TEST_F(FeatureApriltag_test, getTagId)
{
FeatureApriltagPtr f = std::make_shared<FeatureApriltag>(pose, cov, tag_id, corners_vec, rep_error1, rep_error2, use_rotation);
FeatureApriltagPosePtr f = std::make_shared<FeatureApriltagPose>(pose, cov, tag_id, corners_vec, rep_error1, rep_error2, use_rotation);
ASSERT_EQ(f->getTagId(), 1);
}
TEST_F(FeatureApriltag_test, getCorners)
{
FeatureApriltagPtr f = std::make_shared<FeatureApriltag>(pose, cov, tag_id, corners_vec, rep_error1, rep_error2, use_rotation);
FeatureApriltagPosePtr f = std::make_shared<FeatureApriltagPose>(pose, cov, tag_id, corners_vec, rep_error1, rep_error2, use_rotation);
ASSERT_EQ(f->getTagCorners().size(), 4);
......@@ -93,7 +93,7 @@ TEST_F(FeatureApriltag_test, getCorners)
TEST_F(FeatureApriltag_test, getRepErrors)
{
FeatureApriltagPtr f = std::make_shared<FeatureApriltag>(pose, cov, tag_id, corners_vec, rep_error1, rep_error2, use_rotation);
FeatureApriltagPosePtr f = std::make_shared<FeatureApriltagPose>(pose, cov, tag_id, corners_vec, rep_error1, rep_error2, use_rotation);
double err1 = f->getRepError1();
double err2 = f->getRepError2();
......
......@@ -27,7 +27,7 @@
#include "core/processor/factory_processor.h"
#include "apriltag/processor/processor_tracker_landmark_apriltag.h"
#include "apriltag/feature/feature_apriltag.h"
#include "apriltag/feature/feature_apriltag_pose.h"
#include "apriltag/landmark/landmark_apriltag.h"
#include "apriltag/internal/config.h"
using namespace Eigen;
......@@ -204,11 +204,11 @@ TEST(ProcessorTrackerLandmarkApriltag, Constructor)
// for (int i=0; i < min_features_for_keyframe; i++){
// det.id = i;
// FeatureBase::emplace<FeatureApriltag>(Ca, (Vector7d()<<0,0,0,0,0,0,1).finished(), Matrix6d::Identity(), i, det, rep_error1, rep_error2, use_rotation);
// FeatureBase::emplace<FeatureApriltag>(Cc, (Vector7d()<<0,0,0,0,0,0,1).finished(), Matrix6d::Identity(), i, det, rep_error1, rep_error2, use_rotation);
// FeatureBase::emplace<FeatureApriltagPose>(Ca, (Vector7d()<<0,0,0,0,0,0,1).finished(), Matrix6d::Identity(), i, det, rep_error1, rep_error2, use_rotation);
// FeatureBase::emplace<FeatureApriltagPose>(Cc, (Vector7d()<<0,0,0,0,0,0,1).finished(), Matrix6d::Identity(), i, det, rep_error1, rep_error2, use_rotation);
// if (i != min_features_for_keyframe-1){
// FeatureBase::emplace<FeatureApriltag>(Cd, (Vector7d()<<0,0,0,0,0,0,1).finished(), Matrix6d::Identity(), i, det, rep_error1, rep_error2, use_rotation);
// FeatureBase::emplace<FeatureApriltag>(Ce, (Vector7d()<<0,0,0,0,0,0,1).finished(), Matrix6d::Identity(), i, det, rep_error1, rep_error2, use_rotation);
// FeatureBase::emplace<FeatureApriltagPose>(Cd, (Vector7d()<<0,0,0,0,0,0,1).finished(), Matrix6d::Identity(), i, det, rep_error1, rep_error2, use_rotation);
// FeatureBase::emplace<FeatureApriltagPose>(Ce, (Vector7d()<<0,0,0,0,0,0,1).finished(), Matrix6d::Identity(), i, det, rep_error1, rep_error2, use_rotation);
// }
// }
......@@ -248,9 +248,9 @@ TEST_F(ProcessorTrackerLandmarkApriltag_class, detectNewFeaturesDuplicated)
// feature 0
tag_id_ = 0;
auto f0 = std::make_shared<FeatureApriltag>(pose_default_, cov_pose_, tag_id_, corners_vec_, rep_error1, rep_error2, use_rotation);
auto f0 = std::make_shared<FeatureApriltagPose>(pose_default_, cov_pose_, tag_id_, corners_vec_, rep_error1, rep_error2, use_rotation);
// feature 1 (with same id of feature 0)
auto f1 = std::make_shared<FeatureApriltag>(pose_default_, cov_pose_, tag_id_, corners_vec_, rep_error1, rep_error2, use_rotation);
auto f1 = std::make_shared<FeatureApriltagPose>(pose_default_, cov_pose_, tag_id_, corners_vec_, rep_error1, rep_error2, use_rotation);
features_in.push_back(f0);
features_in.push_back(f1);
......@@ -270,13 +270,13 @@ TEST_F(ProcessorTrackerLandmarkApriltag_class, detectNewFeatures)
// feature 0
tag_id_ = 0;
auto f0 = std::make_shared<FeatureApriltag>(pose_default_, cov_pose_, tag_id_, corners_vec_, rep_error1, rep_error2, use_rotation);
auto f0 = std::make_shared<FeatureApriltagPose>(pose_default_, cov_pose_, tag_id_, corners_vec_, rep_error1, rep_error2, use_rotation);
// feature 1
tag_id_ = 1;
auto f1 = std::make_shared<FeatureApriltag>(pose_default_, cov_pose_, tag_id_, corners_vec_, rep_error1, rep_error2, use_rotation);
auto f1 = std::make_shared<FeatureApriltagPose>(pose_default_, cov_pose_, tag_id_, corners_vec_, rep_error1, rep_error2, use_rotation);
// feature 2
tag_id_ = 2;
auto f2 = std::make_shared<FeatureApriltag>(pose_default_, cov_pose_, tag_id_, corners_vec_, rep_error1, rep_error2, use_rotation);
auto f2 = std::make_shared<FeatureApriltagPose>(pose_default_, cov_pose_, tag_id_, corners_vec_, rep_error1, rep_error2, use_rotation);
//we add different features in the list
features_in.push_back(f0);
......@@ -303,13 +303,13 @@ TEST_F(ProcessorTrackerLandmarkApriltag_class, detectNewFeatures)
WOLF_INFO("detecting....");
prc_apr->detectNewFeatures(2, C1, features_out);
ASSERT_EQ(features_out.size(), 1);
ASSERT_EQ(std::static_pointer_cast<FeatureApriltag>(features_out.front())->getTagId(), 2);
ASSERT_EQ(std::static_pointer_cast<FeatureApriltagPose>(features_out.front())->getTagId(), 2);
}
TEST_F(ProcessorTrackerLandmarkApriltag_class, emplaceLandmark)
{
Vector7d pose_landmark((Vector7d()<<1,2,3,1,0,0,0).finished());
auto f1 = std::make_shared<FeatureApriltag>(pose_landmark, cov_pose_, tag_id_, corners_vec_, rep_error1, rep_error2, use_rotation);
auto f1 = std::make_shared<FeatureApriltagPose>(pose_landmark, cov_pose_, tag_id_, corners_vec_, rep_error1, rep_error2, use_rotation);
LandmarkBasePtr lmk = prc_apr->emplaceLandmark(f1);
LandmarkApriltagPtr lmk_april = std::static_pointer_cast<LandmarkApriltag>(lmk);
......@@ -322,7 +322,7 @@ TEST_F(ProcessorTrackerLandmarkApriltag_class, emplaceLandmark)
TEST_F(ProcessorTrackerLandmarkApriltag_class, emplaceFactor)
{
auto f1 = FeatureBase::emplace<FeatureApriltag>(C1, pose_default_, cov_pose_, tag_id_, corners_vec_, rep_error1, rep_error2, use_rotation);
auto f1 = FeatureBase::emplace<FeatureApriltagPose>(C1, pose_default_, cov_pose_, tag_id_, corners_vec_, rep_error1, rep_error2, use_rotation);
LandmarkBasePtr lmk = prc_apr->emplaceLandmark(f1);
LandmarkApriltagPtr lmk_april = std::static_pointer_cast<LandmarkApriltag>(lmk);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment