Merge pull request #193 from akirayou/for_pull_eigenalignfix

Eigen alignment fix
This commit is contained in:
supitalp
2017-05-09 16:35:50 +02:00
committed by GitHub
10 changed files with 30 additions and 19 deletions
+1
View File
@@ -30,6 +30,7 @@ IF(DEBUG_OUTPUT)
ENDIF() ENDIF()
# Set build flags, set ARM_ARCHITECTURE environment variable on Odroid # Set build flags, set ARM_ARCHITECTURE environment variable on Odroid
# Set build flags. Set IS_ARM on odroid board as environment variable
SET(CMAKE_CXX_FLAGS "-Wall -D_LINUX -D_REENTRANT -march=native -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unknown-pragmas") SET(CMAKE_CXX_FLAGS "-Wall -D_LINUX -D_REENTRANT -march=native -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unknown-pragmas")
IF(DEFINED ENV{ARM_ARCHITECTURE}) IF(DEFINED ENV{ARM_ARCHITECTURE})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -march=armv7-a") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -march=armv7-a")
+2 -2
View File
@@ -119,7 +119,7 @@ public:
void getSeedsCopy(const FramePtr& frame, std::list<Seed>& seeds); void getSeedsCopy(const FramePtr& frame, std::list<Seed>& seeds);
/// Return a reference to the seeds. This is NOT THREAD SAFE! /// Return a reference to the seeds. This is NOT THREAD SAFE!
std::list<Seed, aligned_allocator<Seed> >& getSeeds() { return seeds_; } std::list<Seed>& getSeeds() { return seeds_; }
/// Bayes update of the seed, x is the measurement, tau2 the measurement uncertainty /// Bayes update of the seed, x is the measurement, tau2 the measurement uncertainty
static void updateSeed( static void updateSeed(
@@ -137,7 +137,7 @@ public:
protected: protected:
feature_detection::DetectorPtr feature_detector_; feature_detection::DetectorPtr feature_detector_;
callback_t seed_converged_cb_; callback_t seed_converged_cb_;
std::list<Seed, aligned_allocator<Seed> > seeds_; std::list<Seed> seeds_;
boost::mutex seeds_mut_; boost::mutex seeds_mut_;
bool seeds_updating_halt_; //!< Set this value to true when seeds updating should be interrupted. bool seeds_updating_halt_; //!< Set this value to true when seeds updating should be interrupted.
boost::thread* thread_; boost::thread* thread_;
+6
View File
@@ -29,6 +29,12 @@
#include <sophus/se3.h> #include <sophus/se3.h>
#include <vikit/performance_monitor.h> #include <vikit/performance_monitor.h>
#include <boost/shared_ptr.hpp> #include <boost/shared_ptr.hpp>
#include<Eigen/StdVector>
#ifndef RPG_SVO_VIKIT_IS_VECTOR_SPECIALIZED //Guard for rpg_vikit
#define RPG_SVO_VIKIT_IS_VECTOR_SPECIALIZED
EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Eigen::Vector3d)
EIGEN_DEFINE_STL_VECTOR_SPECIALIZATION(Eigen::Vector2d)
#endif
#ifdef SVO_USE_ROS #ifdef SVO_USE_ROS
#include <ros/console.h> #include <ros/console.h>
+1 -1
View File
@@ -72,7 +72,7 @@ private:
Vector2d px; //!< projected 2D pixel location. Vector2d px; //!< projected 2D pixel location.
Candidate(Point* pt, Vector2d& px) : pt(pt), px(px) {} Candidate(Point* pt, Vector2d& px) : pt(pt), px(px) {}
}; };
typedef std::list<Candidate, aligned_allocator<Candidate> > Cell; typedef std::list<Candidate > Cell;
typedef std::vector<Cell*> CandidateGrid; typedef std::vector<Cell*> CandidateGrid;
/// The grid stores a set of candidate matches. For every grid cell we try to find one match. /// The grid stores a set of candidate matches. For every grid cell we try to find one match.
+2 -2
View File
@@ -135,7 +135,7 @@ void DepthFilter::removeKeyframe(FramePtr frame)
{ {
seeds_updating_halt_ = true; seeds_updating_halt_ = true;
lock_t lock(seeds_mut_); lock_t lock(seeds_mut_);
list<Seed>::iterator it=seeds_.begin(); std::list<Seed>::iterator it=seeds_.begin();
size_t n_removed = 0; size_t n_removed = 0;
while(it!=seeds_.end()) while(it!=seeds_.end())
{ {
@@ -200,7 +200,7 @@ void DepthFilter::updateSeeds(FramePtr frame)
// for all the seeds in every frame! // for all the seeds in every frame!
size_t n_updates=0, n_failed_matches=0, n_seeds = seeds_.size(); size_t n_updates=0, n_failed_matches=0, n_seeds = seeds_.size();
lock_t lock(seeds_mut_); lock_t lock(seeds_mut_);
list<Seed>::iterator it=seeds_.begin(); std::list<Seed>::iterator it=seeds_.begin();
const double focal_length = frame->cam_->errorMultiplier2(); const double focal_length = frame->cam_->errorMultiplier2();
double px_noise = 1.0; double px_noise = 1.0;
-1
View File
@@ -84,7 +84,6 @@ void FrameHandlerMono::addImage(const cv::Mat& img, const double timestamp)
// set last frame // set last frame
last_frame_ = new_frame_; last_frame_ = new_frame_;
new_frame_.reset(); new_frame_.reset();
// finish processing // finish processing
finishFrameProcessingCommon(last_frame_->id_, res, last_frame_->nObs()); finishFrameProcessingCommon(last_frame_->id_, res, last_frame_->nObs());
} }
+2 -2
View File
@@ -177,8 +177,8 @@ void computeHomography(
vector<Vector3d>& xyz_in_cur, vector<Vector3d>& xyz_in_cur,
SE3& T_cur_from_ref) SE3& T_cur_from_ref)
{ {
vector<Vector2d, aligned_allocator<Vector2d> > uv_ref(f_ref.size()); vector<Vector2d > uv_ref(f_ref.size());
vector<Vector2d, aligned_allocator<Vector2d> > uv_cur(f_cur.size()); vector<Vector2d > uv_cur(f_cur.size());
for(size_t i=0, i_max=f_ref.size(); i<i_max; ++i) for(size_t i=0, i_max=f_ref.size(); i<i_max; ++i)
{ {
uv_ref[i] = vk::project2d(f_ref[i]); uv_ref[i] = vk::project2d(f_ref[i]);
+8 -1
View File
@@ -5,12 +5,19 @@ SET(CMAKE_BUILD_TYPE Release) # Release, RelWithDebInfo
SET(CMAKE_VERBOSE_MAKEFILE OFF) SET(CMAKE_VERBOSE_MAKEFILE OFF)
SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/CMakeModules/") SET(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${PROJECT_SOURCE_DIR}/CMakeModules/")
# Set build flags. Set IS_ARM on odroid board as environment variable
SET(CMAKE_CXX_FLAGS "-Wall -D_LINUX -D_REENTRANT -march=native -Wno-unused-variable -Wno-unused-but-set-variable -Wno-unknown-pragmas")
IF(DEFINED ENV{ARM_ARCHITECTURE})
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mfpu=neon -march=armv7-a")
ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mmmx -msse -msse -msse2 -msse3 -mssse3")
ENDIF()
IF(CMAKE_COMPILER_IS_GNUCC) IF(CMAKE_COMPILER_IS_GNUCC)
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x")
ELSE() ELSE()
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")
ENDIF() ENDIF()
SET(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS} -O3 -fsee -fomit-frame-pointer -fno-signed-zeros -fno-math-errno -funroll-loops")
# Add catkin and required ROS packages # Add catkin and required ROS packages
FIND_PACKAGE(catkin REQUIRED COMPONENTS FIND_PACKAGE(catkin REQUIRED COMPONENTS
+8 -9
View File
@@ -134,26 +134,25 @@ void Visualizer::publishMinimal(
cv::Point2f((*it)->px[0]+3*(*it)->grad[1], (*it)->px[1]-3*(*it)->grad[0]), cv::Point2f((*it)->px[0]+3*(*it)->grad[1], (*it)->px[1]-3*(*it)->grad[0]),
cv::Point2f((*it)->px[0]-3*(*it)->grad[1], (*it)->px[1]+3*(*it)->grad[0]), cv::Point2f((*it)->px[0]-3*(*it)->grad[1], (*it)->px[1]+3*(*it)->grad[0]),
cv::Scalar(255,0,255), 2); cv::Scalar(255,0,255), 2);
else else//point size 5x5
cv::rectangle(img_rgb, cv::rectangle(img_rgb,
cv::Point2f((*it)->px[0]-2, (*it)->px[1]-2), cv::Point2f((*it)->px[0]-2, (*it)->px[1]-2),
cv::Point2f((*it)->px[0]+2, (*it)->px[1]+2), cv::Point2f((*it)->px[0]+2, (*it)->px[1]+2),
cv::Scalar(0,255,0), CV_FILLED); cv::Scalar(0,255,0), CV_FILLED);
} }
} }
if(img_pub_level_ == 1) else if(img_pub_level_ == 1){//point size 3x3
for(Features::iterator it=frame->fts_.begin(); it!=frame->fts_.end(); ++it) for(Features::iterator it=frame->fts_.begin(); it!=frame->fts_.end(); ++it)
cv::rectangle(img_rgb, cv::rectangle(img_rgb,
cv::Point2f((*it)->px[0]/scale-1, (*it)->px[1]/scale-1), cv::Point2f((*it)->px[0]/scale-1, (*it)->px[1]/scale-1),
cv::Point2f((*it)->px[0]/scale+1, (*it)->px[1]/scale+1), cv::Point2f((*it)->px[0]/scale+1, (*it)->px[1]/scale+1),
cv::Scalar(0,255,0), CV_FILLED); cv::Scalar(0,255,0), CV_FILLED);
else }else{ //point size 1x1
for(Features::iterator it=frame->fts_.begin(); it!=frame->fts_.end(); ++it) for(Features::iterator it=frame->fts_.begin(); it!=frame->fts_.end(); ++it){
cv::rectangle(img_rgb, cv::Vec3b &p= img_rgb.at<cv::Vec3b>((*it)->px[1]/scale, (*it)->px[0]/scale);
cv::Point2f((*it)->px[0]/scale, (*it)->px[1]/scale), p[0]=0;p[1]=255;p[2]=0;
cv::Point2f((*it)->px[0]/scale, (*it)->px[1]/scale), }
cv::Scalar(0,255,0), CV_FILLED); }
cv_bridge::CvImage img_msg; cv_bridge::CvImage img_msg;
img_msg.header = header_msg; img_msg.header = header_msg;
img_msg.image = img_rgb; img_msg.image = img_rgb;
-1
View File
@@ -13,7 +13,6 @@
// //
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>. // along with this program. If not, see <http://www.gnu.org/licenses/>.
#include <ros/package.h> #include <ros/package.h>
#include <string> #include <string>
#include <svo/frame_handler_mono.h> #include <svo/frame_handler_mono.h>