Skip to content

Commit

Permalink
finishe migration
Browse files Browse the repository at this point in the history
  • Loading branch information
hangqiu committed Sep 25, 2017
1 parent 052d89e commit aea0e26
Show file tree
Hide file tree
Showing 25 changed files with 314 additions and 379 deletions.
11 changes: 10 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
build/
cmake-build-debug/
.idea/


Slam_latest_Map.bin
Thirdparty/DBoW2/lib/
Thirdparty/g2o/lib/
Thirdparty/g2o/config.h
src/ORB_SLAM2/Vocabulary/ORBvoc.bin
src/ORB_SLAM2/Vocabulary/ORBvoc.txt
CameraTrajectory.txt
FrameInfo.txt
2 changes: 2 additions & 0 deletions .idea/AugmentedVR.iml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions .idea/modules.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ message(${PCL_LIBRARY_DIRS})

SET(SRC_FOLDER src)
#FILE(GLOB_RECURSE SRC_FILES "${SRC_FOLDER}/AugmentedVR/*.cpp" "${SRC_FOLDER}/ORB_SLAM2/src/*.cc" "${SRC_FOLDER}/*.cpp")
FILE(GLOB_RECURSE SRC_FILES "${SRC_FOLDER}/AugmentedVR/*.cpp" "${SRC_FOLDER}/ORB_SLAM2/src/*.cc" "${SRC_FOLDER}/*.cpp")
FILE(GLOB_RECURSE SRC_FILES "${SRC_FOLDER}/AugmentedVR/*.cpp" "${SRC_FOLDER}/ORB_SLAM2/src/*.cc")

#message(${SRC_FILES})

Expand Down
10 changes: 5 additions & 5 deletions CamCalib.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ Camera.k2: 0.0
Camera.p1: 0.0
Camera.p2: 0.0

Camera.width: 672
Camera.height: 376
#Camera.width: 1280
#Camera.height: 720
#Camera.width: 672
#Camera.height: 376
Camera.width: 1280
Camera.height: 720

# Camera frames per second
Camera.fps: 10.0
Expand All @@ -37,7 +37,7 @@ ThDepth: 35
#--------------------------------------------------------------------------------------------

# ORB Extractor: Number of features per image
ORBextractor.nFeatures: 500
ORBextractor.nFeatures: 2000

# ORB Extractor: Scale factor between levels in the scale pyramid
ORBextractor.scaleFactor: 1.2
Expand Down
26 changes: 21 additions & 5 deletions app/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,21 @@ using namespace cv;



VCluster* mV;
std::thread* mvThread;

void run(){

mV->run();
}


void close() {
quit = true;
mvThread->join();
mV->exit();
cout << "System shuts down" << endl;
}
///////////////////////////////////////////////////////////main function////////////////////////////////////////////////////
int main(int argc, char **argv) {

Expand Down Expand Up @@ -121,15 +134,18 @@ int main(int argc, char **argv) {
cout << "Map File: " << mapFile << endl;
}

VCluster* mV = new VCluster(false, mapFile, argc, argv, VPath[0]);
mV = new VCluster(false, mapFile, argc, argv, VPath[0]);

#ifdef EVAL
gettimeofday(&tInit, NULL);
#endif

mV->run();

delete mV;
cout << "AVR shuts down" << endl;
// mV->run();
mvThread = new std::thread(run);
// while(mV->VNode[0]->getFrameSeq()<5);
glutCloseFunc(close);
glutMainLoop();
return 0;
}


17 changes: 14 additions & 3 deletions include/AugmentedVR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ struct ZED_DATA{
cv::Mat FrameRightGray;

cv::Mat pointcloud;
// sl::Mat pointcloud_sl;

cv::Mat PC_noColor;


Expand All @@ -59,6 +61,8 @@ struct STEREO_DATA{
cv::Mat FrameRightGray;

cv::Mat pointcloud;
// sl::Mat pointcloud_sl;

cv::Mat PC_noColor;

cv::Mat CamMotionMat; // Tcw // (4,4,CV_32F) rotation mat and translation mat Tcw (Rcw, tcw) in ORBSLAM
Expand Down Expand Up @@ -108,7 +112,11 @@ class AugmentedVR {

cv::Mat ZED_LRes;
cv::Mat BufferXYZRGBA;
cv::Mat pointcloud;

cv::Mat pointcloud_cv;
// sl::Mat pointcloud_sl;
sl::Mat pointcloud_sl_gpu;

cv::Mat PC_noColor;

cv::Mat initPC;
Expand All @@ -120,7 +128,7 @@ class AugmentedVR {
// vector<cv::Mat> lastpointcloud;
vector<STEREO_DATA> lastStereoData;
// vector<cv::Mat> PCMotionVec;
sl::Mat BufferXYZRGBA_gpu;

cv::Mat depth_mat;


Expand Down Expand Up @@ -169,6 +177,9 @@ class AugmentedVR {
// AugmentedVR(int CamId);
AugmentedVR(int CamId, sl::InitParameters initParam, sl::RuntimeParameters runtimeParam, int ZEDConfidence);
~AugmentedVR();
void exit();


int initZEDCam(int startFrameID);

void initSLAMStereo(string VocFile, string CalibrationFile, bool bReuseMap = false, string mapFile = "default.txt");
Expand Down Expand Up @@ -241,7 +252,7 @@ class AugmentedVR {

void dead_reckoning_onRxDynamicPC();

bool load_NextFrame();
bool loadSlamFrameAsCurrentFrame();

void detectFeature();

Expand Down
17 changes: 11 additions & 6 deletions include/Displayer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,24 @@

class Displayer {

public:
AugmentedVR** VNode;
// PointCloud* mPC;
// Viewer* mPCViewer;

// SDK 2.0 Point cloud viewer
GLViewer mGLViewer;

sl::Mat PC_gpu;
GLViewer* mGLViewer;
std::thread display_callback;
// sl::Mat PC_gpu;

int PCwidth, PCheight; //
CUcontext context;
// CUcontext context;
public:
Displayer(AugmentedVR **VNode);

virtual ~Displayer();
~Displayer();

void exit();

void saveFrame();

Expand All @@ -47,9 +50,11 @@ class Displayer {

void showPC(cv::Mat mat);

void showPC(sl::Mat& mat);

void checkResetPCViewer(int width, int height);

void pushPC_Mat(cv::Mat mat);
void pushPC_Mat(cv::Mat& mat);

void debugPC(cv::Mat DebugPC);

Expand Down
4 changes: 2 additions & 2 deletions include/ObjReceiver.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class ObjReceiver {
public:

ObjReceiver(AugmentedVR *myAVR, const int CamId, string commPath);

~ObjReceiver();

cv::Mat readFrame(int frameSeq);
cv::Mat readTcw(int frameSeq);
Expand All @@ -34,7 +34,7 @@ class ObjReceiver {
cv::Mat readLowPassObjectMotionVec(int frameSeq);


virtual ~ObjReceiver();

};


Expand Down
2 changes: 1 addition & 1 deletion include/ObjSender.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ class ObjSender {
public:
ObjSender(AugmentedVR *myAVR, string commPath);

virtual ~ObjSender();
~ObjSender();

void writeFrame();
void writeTcw();
Expand Down
5 changes: 5 additions & 0 deletions include/VCluster.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,16 @@ class VCluster {
int frameSeqRx;
long timeRx;

std::thread* displayThread;

public://public variables
AugmentedVR** VNode;

public:
VCluster();
VCluster(bool live, const string mapFile, int argc, char** argv, string VPath);
~VCluster();
void exit();

void run();

Expand All @@ -42,6 +45,8 @@ class VCluster {
void PreProcess();

void segmentation();

void initDisplay();
};


Expand Down
12 changes: 8 additions & 4 deletions include/globals.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@


//#define EVAL
#define SIMPLEEVAL
#define PIPELINE
//#define SIMPLEEVAL
//#define PIPELINE

#define PI 3.14159265

Expand Down Expand Up @@ -96,7 +96,11 @@ extern int lengthInFrame;


extern timeval tInit;
#endif //PROJECT_GLOBALS_H

extern bool quit;


cv::Mat slMat2cvMat(sl::Mat& input);
sl::Mat cvMat2slMat(cv::Mat& input);
void cvMat2slMat(cv::Mat& input, sl::Mat& output);

#endif //PROJECT_GLOBALS_H
2 changes: 1 addition & 1 deletion include/pcCodec.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ using namespace std;
using namespace pcl;

class pcCodec {
float* data_cloud;
// float* data_cloud;
std::mutex mutex_input;
int width, height;

Expand Down
8 changes: 0 additions & 8 deletions pre_build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,3 @@ mkdir build
cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
make -j

cd ../../../

echo "Uncompress vocabulary ..."

cd Vocabulary
tar -xf ORBvoc.txt.tar.gz
cd ..
Loading

0 comments on commit aea0e26

Please sign in to comment.