added anchor information generation
This commit is contained in:
@ -62,6 +62,10 @@ struct CAMState {
|
||||
typedef std::map<StateIDType, CAMState, std::less<int>,
|
||||
Eigen::aligned_allocator<
|
||||
std::pair<const StateIDType, CAMState> > > CamStateServer;
|
||||
|
||||
typedef std::map<StateIDType, cv::Mat, std::less<StateIDType>,
|
||||
Eigen::aligned_allocator<
|
||||
std::pair<StateIDType, cv::Mat> > > movingWindow;
|
||||
} // namespace msckf_vio
|
||||
|
||||
#endif // MSCKF_VIO_CAM_STATE_H
|
||||
|
@ -114,6 +114,19 @@ struct Feature {
|
||||
inline bool checkMotion(
|
||||
const CamStateServer& cam_states) const;
|
||||
|
||||
/*
|
||||
* @brief InitializeAnchor generates the NxN patch around the
|
||||
* feature in the Anchor image
|
||||
* @param cam_states: A map containing all recorded images
|
||||
* currently presented in the camera state vector
|
||||
* @return the irradiance of the Anchor NxN Patch
|
||||
* @return True if the Anchor can be estimated
|
||||
*/
|
||||
|
||||
inline bool initializeAnchor(
|
||||
const movingWindow& cam0_moving_window);
|
||||
|
||||
|
||||
/*
|
||||
* @brief InitializePosition Intialize the feature position
|
||||
* based on all current available measurements.
|
||||
@ -145,7 +158,7 @@ struct Feature {
|
||||
std::pair<const StateIDType, Eigen::Vector4d> > > observations;
|
||||
|
||||
// NxN Patch of Anchor Image
|
||||
std::vector<double> patch;
|
||||
std::vector<double> anchorPatch;
|
||||
// 3d postion of the feature in the world frame.
|
||||
Eigen::Vector3d position;
|
||||
|
||||
@ -292,6 +305,29 @@ bool Feature::checkMotion(
|
||||
else return false;
|
||||
}
|
||||
|
||||
bool Feature::initializeAnchor(
|
||||
const movingWindow& cam0_moving_window)
|
||||
{
|
||||
|
||||
int N = 5;
|
||||
int n = (int)(N-1)/2;
|
||||
|
||||
auto anchor = observations.begin();
|
||||
if(cam0_moving_window.find(anchor->first) == cam0_moving_window.end())
|
||||
return false;
|
||||
|
||||
cv::Mat anchorImage = cam0_moving_window.find(anchor->first)->second;
|
||||
auto u = anchor->second(0)*anchorImage.rows/2 + anchorImage.rows/2;
|
||||
auto v = anchor->second(1)*anchorImage.cols/2 + anchorImage.cols/2;
|
||||
int count = 0;
|
||||
|
||||
for(int u_run = (int)u - n; u_run <= (int)u + n; u_run++)
|
||||
for(int v_run = v - n; v_run <= v + n; v_run++)
|
||||
anchorPatch.push_back(anchorImage.at<uint8_t>(u_run,v_run));
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Feature::initializePosition(
|
||||
const CamStateServer& cam_states) {
|
||||
// Organize camera poses and feature observations properly.
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include <sensor_msgs/Imu.h>
|
||||
#include <sensor_msgs/Image.h>
|
||||
#include <nav_msgs/Odometry.h>
|
||||
#include <std_msgs/Float64.h>
|
||||
#include <tf/transform_broadcaster.h>
|
||||
#include <std_srvs/Trigger.h>
|
||||
|
||||
@ -106,13 +107,14 @@ class MsckfVio {
|
||||
void imuCallback(const sensor_msgs::ImuConstPtr& msg);
|
||||
|
||||
/*
|
||||
* @brief featureCallback
|
||||
* Callback function for feature measurements.
|
||||
* @param msg Stereo feature measurements.
|
||||
* @brief imageCallback
|
||||
* Callback function for feature measurements
|
||||
* Triggers measurement update
|
||||
* @param msg
|
||||
* Camera 0 Image
|
||||
* Camera 1 Image
|
||||
* Stereo feature measurements.
|
||||
*/
|
||||
void featureCallback(const CameraMeasurementConstPtr& msg);
|
||||
|
||||
|
||||
void imageCallback (
|
||||
const sensor_msgs::ImageConstPtr& cam0_img,
|
||||
const sensor_msgs::ImageConstPtr& cam1_img,
|
||||
@ -200,14 +202,9 @@ class MsckfVio {
|
||||
std::vector<sensor_msgs::Imu> imu_msg_buffer;
|
||||
|
||||
// Moving Window buffer
|
||||
std::map<StateIDType, cv::Mat, std::less<StateIDType>,
|
||||
Eigen::aligned_allocator<
|
||||
std::pair<StateIDType, cv::Mat> > > cam0_moving_window;
|
||||
movingWindow cam0_moving_window;
|
||||
movingWindow cam1_moving_window;
|
||||
|
||||
std::map<StateIDType, cv::Mat, std::less<StateIDType>,
|
||||
Eigen::aligned_allocator<
|
||||
std::pair<StateIDType, cv::Mat> > > cam1_moving_window;
|
||||
|
||||
// Indicate if the gravity vector is set.
|
||||
bool is_gravity_set;
|
||||
|
||||
|
Reference in New Issue
Block a user