Skip to content
Snippets Groups Projects
Commit f3d536a1 authored by jvallve's avatar jvallve
Browse files

No commit message

No commit message
parent f67818f7
No related branches found
No related tags found
No related merge requests found
...@@ -97,7 +97,7 @@ void CaptureLaser2D::establishConstraints() ...@@ -97,7 +97,7 @@ void CaptureLaser2D::establishConstraints()
for (auto feature_it = getFeatureListPtr()->begin(); feature_it != getFeatureListPtr()->end(); feature_it++ ) for (auto feature_it = getFeatureListPtr()->begin(); feature_it != getFeatureListPtr()->end(); feature_it++ )
{ {
double max_distance_matching2 = 0.5; //TODO: max_distance_matching depending on localization and landmarks uncertainty double max_distance_matching2 = 0.5; //TODO: max_distance_matching depending on localization and landmarks uncertainty
double max_theta_matching = 0.2; //TODO: max_theta_matching depending on localization and landmarks uncertainty double max_theta_matching = M_PI / 8; //TODO: max_theta_matching depending on localization and landmarks uncertainty
//Find the closest landmark to the feature //Find the closest landmark to the feature
LandmarkCorner2D* correspondent_landmark = nullptr; LandmarkCorner2D* correspondent_landmark = nullptr;
...@@ -127,18 +127,18 @@ void CaptureLaser2D::establishConstraints() ...@@ -127,18 +127,18 @@ void CaptureLaser2D::establishConstraints()
{ {
if (theta_distance < max_theta_matching) if (theta_distance < max_theta_matching)
{ {
//std::cout << "Position & orientation near landmark found: " << (*landmark_it)->nodeId() << std::endl; // std::cout << "Position & orientation near landmark found: " << (*landmark_it)->nodeId() << std::endl;
//std::cout << "global position:" << landmark_position.transpose() << " orientation:" << landmark_orientation << std::endl; // std::cout << "global position:" << landmark_position.transpose() << " orientation:" << landmark_orientation << std::endl;
correspondent_landmark = (LandmarkCorner2D*)(*landmark_it); correspondent_landmark = (LandmarkCorner2D*)(*landmark_it);
min_distance2 = distance2; min_distance2 = distance2;
} }
else else
{ {
// std::cout << "Feature: " << (*feature_it)->nodeId() << std::endl; std::cout << "Feature: " << (*feature_it)->nodeId() << std::endl;
// std::cout << "global position:" << feature_global_position.transpose() << " orientation:" << feature_global_orientation << std::endl; std::cout << "global position:" << feature_global_position.transpose() << " orientation:" << feature_global_orientation << std::endl;
// std::cout << "Landmark with near position but wrong orientation: " << (*landmark_it)->nodeId() << std::endl; std::cout << "Landmark with near position but wrong orientation: " << (*landmark_it)->nodeId() << std::endl;
// std::cout << "global position:" << landmark_position.transpose() << " orientation:" << landmark_orientation << std::endl; std::cout << "global position:" << landmark_position.transpose() << " orientation:" << landmark_orientation << std::endl;
} }
} }
} }
......
...@@ -112,6 +112,7 @@ class WolfManager ...@@ -112,6 +112,7 @@ class WolfManager
SensorBase* sensor_prior_; SensorBase* sensor_prior_;
unsigned int window_size_; unsigned int window_size_;
FrameBaseIter first_window_frame_; FrameBaseIter first_window_frame_;
CaptureRelative* last_capture_relative_;
public: public:
WolfManager(SensorBase* _sensor_prior, const bool _complex_angle, const unsigned int& _state_length, const Eigen::VectorXs& _init_frame, const unsigned int& _w_size=10) : WolfManager(SensorBase* _sensor_prior, const bool _complex_angle, const unsigned int& _state_length, const Eigen::VectorXs& _init_frame, const unsigned int& _w_size=10) :
...@@ -151,6 +152,7 @@ class WolfManager ...@@ -151,6 +152,7 @@ class WolfManager
sensor_prior_, sensor_prior_,
Eigen::Vector2s::Zero(), Eigen::Vector2s::Zero(),
Eigen::Matrix2s::Zero())); Eigen::Matrix2s::Zero()));
last_capture_relative_ = (CaptureRelative*)(problem_->getTrajectoryPtr()->getFrameListPtr()->back()->getCaptureListPtr()->front());
} }
void addCapture(CaptureBase* _capture) void addCapture(CaptureBase* _capture)
...@@ -171,21 +173,22 @@ class WolfManager ...@@ -171,21 +173,22 @@ class WolfManager
if (new_capture->getSensorPtr() == sensor_prior_) if (new_capture->getSensorPtr() == sensor_prior_)
{ {
// FIND PREVIOUS RELATIVE CAPTURE // FIND PREVIOUS RELATIVE CAPTURE
CaptureRelative* previous_relative_capture = nullptr; // CaptureRelative* previous_relative_capture = nullptr;
for (auto capture_it = problem_->getTrajectoryPtr()->getFrameListPtr()->back()->getCaptureListPtr()->begin(); capture_it != problem_->getTrajectoryPtr()->getFrameListPtr()->back()->getCaptureListPtr()->end(); capture_it++) // for (auto capture_it = problem_->getTrajectoryPtr()->getFrameListPtr()->back()->getCaptureListPtr()->begin(); capture_it != problem_->getTrajectoryPtr()->getFrameListPtr()->back()->getCaptureListPtr()->end(); capture_it++)
{ // {
//std::cout << "capture: " << (*capture_it)->nodeId() << std::endl; // //std::cout << "capture: " << (*capture_it)->nodeId() << std::endl;
if ((*capture_it)->getSensorPtr() == sensor_prior_) // if ((*capture_it)->getSensorPtr() == sensor_prior_)
{ // {
previous_relative_capture = (CaptureRelative*)(*capture_it); // previous_relative_capture = (CaptureRelative*)(*capture_it);
break; // break;
} // }
} // }
// INTEGRATING ODOMETRY CAPTURE & COMPUTING PRIOR // INTEGRATING ODOMETRY CAPTURE & COMPUTING PRIOR
//std::cout << "integrating captures " << previous_relative_capture->nodeId() << " " << new_capture->nodeId() << std::endl; //std::cout << "integrating captures " << previous_relative_capture->nodeId() << " " << new_capture->nodeId() << std::endl;
previous_relative_capture->integrateCapture((CaptureRelative*)(new_capture)); // previous_relative_capture->integrateCapture((CaptureRelative*)(new_capture));
Eigen::VectorXs prior = previous_relative_capture->computePrior(); // Eigen::VectorXs prior = previous_relative_capture->computePrior();
last_capture_relative_->integrateCapture((CaptureRelative*)(new_capture));
// NEW KEY FRAME (if enough time from last frame) // NEW KEY FRAME (if enough time from last frame)
//std::cout << "new TimeStamp - last Frame TimeStamp = " << new_capture->getTimeStamp().get() - problem_->getTrajectoryPtr()->getFrameListPtr()->back()->getTimeStamp().get() << std::endl; //std::cout << "new TimeStamp - last Frame TimeStamp = " << new_capture->getTimeStamp().get() - problem_->getTrajectoryPtr()->getFrameListPtr()->back()->getTimeStamp().get() << std::endl;
...@@ -196,7 +199,7 @@ class WolfManager ...@@ -196,7 +199,7 @@ class WolfManager
// NEW FRAME // NEW FRAME
//std::cout << "new frame" << std::endl; //std::cout << "new frame" << std::endl;
createFrame(prior, new_capture->getTimeStamp()); createFrame(last_capture_relative_->computePrior(), new_capture->getTimeStamp());
// COMPUTE PREVIOUS FRAME CAPTURES // COMPUTE PREVIOUS FRAME CAPTURES
//std::cout << "compute prev frame" << std::endl; //std::cout << "compute prev frame" << std::endl;
...@@ -237,7 +240,7 @@ class WolfManager ...@@ -237,7 +240,7 @@ class WolfManager
Eigen::VectorXs getVehiclePose() Eigen::VectorXs getVehiclePose()
{ {
return Eigen::Map<Eigen::VectorXs>(problem_->getTrajectoryPtr()->getFrameListPtr()->back()->getPPtr()->getPtr(), use_complex_angles_ ? 4 : 3); return last_capture_relative_->computePrior();
} }
WolfProblem* getProblemPtr() WolfProblem* getProblemPtr()
......
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