This commit is contained in:
gfuse
2021-09-22 11:02:53 +02:00
parent 26eefcd9bc
commit cf451572bf
6 changed files with 888 additions and 68084 deletions
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+15 -3
View File
@@ -122,15 +122,24 @@ public:
delete filter_; delete filter_;
}; };
void UpdateIMU(double x/*in imu frame*/,double y/*in imu frame*/,double theta/*in imu frame*/,const ros::Time& time) { void UpdateIMU(double x/*in imu frame*/,double y/*in imu frame*/,double theta/*in imu frame*/,const ros::Time& time) {
if(!start_)return;
if(abs(x)<1.0)x=pow(x,3);//picked up from your code if(abs(x)<1.0)x=pow(x,3);//picked up from your code
if(abs(y)<1.0)y=pow(y,3);//picked up from your code if(abs(y)<1.0)y=pow(y,3);//picked up from your code
/* ++imu_syn_count_;
if(imu_syn_[imu_syn_count_ % 7]){
imu_syn_[imu_syn_count_ % 7]=false;
}else{
return;
}*/
if(imu_syn_count_>50)imu_syn_count_=0;
boost::unique_lock<boost::mutex> lock(ekf_mut_); boost::unique_lock<boost::mutex> lock(ekf_mut_);
filter_->correct(x,y,theta,1e-9*time.toNSec()); filter_->correct(x,y,theta,1e-9*time.toNSec());
}; };
//IMU frame y front, x right, z up -> left hands (theta counts from y) //IMU frame y front, x right, z up -> left hands (theta counts from y)
void UpdateCmd(double x/*in imu frame*/,double y/*in imu frame*/,double theta/*in imu frame*/,const ros::Time& time) { void UpdateCmd(double x/*in imu frame*/,double y/*in imu frame*/,double theta/*in imu frame*/,const ros::Time& time) {
if(!start_)return; cam_syn_[cmd_syn_count_ % 7]=true;
imu_syn_[cmd_syn_count_ % 7]=true;
++cmd_syn_count_;
if(cmd_syn_count_>50)cmd_syn_count_=0;
boost::unique_lock<boost::mutex> lock(ekf_mut_); boost::unique_lock<boost::mutex> lock(ekf_mut_);
filter_->predict(x,y,theta,1e-9*time.toNSec()); filter_->predict(x,y,theta,1e-9*time.toNSec());
}; };
@@ -153,7 +162,10 @@ public:
filter_->cov_(2,0),filter_->cov_(2,1),filter_->cov_(2,2); filter_->cov_(2,0),filter_->cov_(2,1),filter_->cov_(2,2);
return std::pair<Eigen::Matrix<double,3,3>,vio::SE2_5>(cov,vio::SE2_5(filter_->state_(0),filter_->state_(1),-1.0*(filter_->state_(2)))); return std::pair<Eigen::Matrix<double,3,3>,vio::SE2_5>(cov,vio::SE2_5(filter_->state_(0),filter_->state_(1),-1.0*(filter_->state_(2))));
} }
bool start_=false; size_t cmd_syn_count_=0;
size_t imu_syn_count_=2;
bool cam_syn_[7]={false,false,false,false,false,false,false};
bool imu_syn_[7]={false,false,false,false,false,false,false};
private: private:
Base* filter_= nullptr; Base* filter_= nullptr;
boost::mutex ekf_mut_; boost::mutex ekf_mut_;
+1 -1
View File
@@ -13,4 +13,4 @@ svo:
ACC_noise: 0.5 #acc white noise in continuous in EKF ACC_noise: 0.5 #acc white noise in continuous in EKF
GYO_noise: 0.5 #gyro white noise in continuous in EKF GYO_noise: 0.5 #gyro white noise in continuous in EKF
svo_ekf: 0.05 #Svo noise that will be devided by number of Reprojected points after opmization in EKF svo_ekf: 0.05 #Svo noise that will be devided by number of Reprojected points after opmization in EKF
Cmd_Cov: 0.5 #control vector noise in EKF Cmd_Cov: 0.1 #control vector noise in EKF
+1 -1
View File
@@ -99,6 +99,7 @@ FrameHandlerMono::~FrameHandlerMono()
void FrameHandlerMono::addImage(const cv::Mat& img, const double timestamp,const ros::Time& time) void FrameHandlerMono::addImage(const cv::Mat& img, const double timestamp,const ros::Time& time)
{ {
if(!startFrameProcessingCommon(timestamp)){ if(!startFrameProcessingCommon(timestamp)){
return; return;
} }
@@ -130,7 +131,6 @@ void FrameHandlerMono::addImage(const cv::Mat& img, const double timestamp,const
FrameHandlerMono::UpdateResult FrameHandlerMono::processFirstFrame() FrameHandlerMono::UpdateResult FrameHandlerMono::processFirstFrame()
{ {
ukfPtr_.start_=true;
if(klt_homography_init_->addFirstFrame(new_frame_) == initialization::FAILURE){ if(klt_homography_init_->addFirstFrame(new_frame_) == initialization::FAILURE){
return RESULT_NO_KEYFRAME; return RESULT_NO_KEYFRAME;
} }
+8 -1
View File
@@ -48,7 +48,6 @@ public:
vo_->depthFilter()->startThread(); vo_->depthFilter()->startThread();
vo_->reset(); vo_->reset();
} }
imu_the_=new boost::thread(&VioNode::imu_th,this); imu_the_=new boost::thread(&VioNode::imu_th,this);
++trace_id_; ++trace_id_;
res.ret=0; res.ret=0;
@@ -79,6 +78,7 @@ public:
}; };
private: private:
double* imu_; double* imu_;
size_t cam_syn_=2;
ros::Time imu_time_; ros::Time imu_time_;
int width; int width;
int height; int height;
@@ -116,6 +116,13 @@ VioNode::~VioNode()
void VioNode::imgCb(const sensor_msgs::ImageConstPtr& msg) void VioNode::imgCb(const sensor_msgs::ImageConstPtr& msg)
{ {
/* ++cam_syn_;
if(vo_->ukfPtr_.cam_syn_[cam_syn_ % 3]){
vo_->ukfPtr_.cam_syn_[cam_syn_ % 3]=false;
}else{
return;
}
if(cam_syn_>50)cam_syn_=0;*/
if(!start_)return; if(!start_)return;
try { try {
cv::Mat img=cv_bridge::toCvShare(msg, "mono8")->image; cv::Mat img=cv_bridge::toCvShare(msg, "mono8")->image;