Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
5e17639
add multi thread for relocalisation without compiling
915604903T Oct 31, 2022
1330f8d
fixed bugs in collaborativeComponent
915604903T Oct 31, 2022
fb2e385
fixed bug
915604903T Oct 31, 2022
c13b695
fixed bug
915604903T Oct 31, 2022
0a8e711
build success for multi thread
Fvoiretryzig Oct 31, 2022
aa8a165
print candidate usecount
915604903T Nov 1, 2022
bec3d7e
add reset for candidate pointer
Fvoiretryzig Nov 1, 2022
b7d82ed
change queue to list
915604903T Nov 1, 2022
4d167cf
inspect some memory part
Fvoiretryzig Nov 1, 2022
d704a82
debug for multi thread
Fvoiretryzig Nov 14, 2022
73b1687
parallelCandidate debug
Fvoiretryzig Nov 15, 2022
39eacfc
change relocaliser number
Fvoiretryzig Nov 21, 2022
aacf2ad
evaluate time cost in relocaliser
Fvoiretryzig Nov 21, 2022
028d43d
change args
Fvoiretryzig Nov 23, 2022
fae124d
bind cpu core for relocalisation thread
915604903T Nov 23, 2022
827ed9b
add output info
Fvoiretryzig Nov 23, 2022
d93b768
merge two branch
915604903T Nov 23, 2022
cd6d99a
fix cout mask bug
Fvoiretryzig Jan 8, 2023
d512588
renew relocalise
915604903T Feb 2, 2023
a7888eb
successful build
Fvoiretryzig Feb 2, 2023
adca38d
rm unused file
Fvoiretryzig Feb 2, 2023
88bfcd9
fixed calib file location
Fvoiretryzig Feb 2, 2023
fa00c74
begin debug
Fvoiretryzig Feb 2, 2023
f018024
remove result
Fvoiretryzig Feb 2, 2023
4b782d3
begin to add pose cnt in tracker
Fvoiretryzig Feb 3, 2023
16f5654
read pose from file to update tracjectory
915604903T Feb 3, 2023
bc82084
change to const function
Fvoiretryzig Feb 3, 2023
aaea66d
reconstruct tracker controller
915604903T Feb 3, 2023
f49fe22
pass compile
Fvoiretryzig Feb 3, 2023
d14b689
modify application.cpp, only deals with relocalisation
915604903T Feb 4, 2023
ef1f193
pass compile
Fvoiretryzig Feb 4, 2023
31a3d93
begin to debug function
Fvoiretryzig Feb 4, 2023
9810e62
change randomforest directory and global pose save content
915604903T Feb 8, 2023
2b76b68
modify modelFilename
Fvoiretryzig Feb 8, 2023
b231a95
modify modelFilename
915604903T Feb 8, 2023
2b2cfd1
pass compile
Fvoiretryzig Feb 8, 2023
e172152
Merge branch 'relocalise' of https://github.com/915604903T/reconstruc…
915604903T Feb 8, 2023
d920bf5
remove some debug info
Fvoiretryzig Feb 9, 2023
a6a74c3
add timeout for relocalise
Fvoiretryzig Feb 9, 2023
1c10797
Merge branch 'relocalise' of https://github.com/915604903T/reconstruc…
915604903T Feb 10, 2023
ef936dd
change relocalise time
Fvoiretryzig Feb 15, 2023
5eeabba
modify the parameter of verified candidate and timeout time
Fvoiretryzig Feb 15, 2023
7e600a4
Merge branch 'relocalise' of https://github.com/915604903T/reconstruc…
915604903T Feb 16, 2023
2fa0ef7
change mesh save name
915604903T Feb 19, 2023
21dae94
fixed compile bug
Fvoiretryzig Feb 20, 2023
abf85ff
fixed compile bug
915604903T Feb 20, 2023
ca6683d
debugging
Fvoiretryzig Feb 20, 2023
64b0445
resolve Conflict
Fvoiretryzig Feb 20, 2023
e41b864
Merge branch 'relocalise' of https://github.com/915604903T/reconstruc…
Fvoiretryzig Feb 20, 2023
4a3a32c
if global pose not exist, do not generate mesh
915604903T Feb 20, 2023
94e94b9
change to const
915604903T Feb 20, 2023
51569c4
add merge ply file in python
Fvoiretryzig Feb 21, 2023
ddbe7d2
add merge ply file in python
915604903T Feb 21, 2023
24f1bbf
move merge ply to this part
Fvoiretryzig Feb 21, 2023
7615563
fixed conflict
Fvoiretryzig Feb 21, 2023
fe6b325
modify execlp to execvp
Fvoiretryzig Feb 21, 2023
5d4715d
add ssim
915604903T Mar 6, 2023
b568cf3
add ssim
915604903T Mar 6, 2023
a400333
debugging
915604903T Mar 6, 2023
90d0313
debug
Fvoiretryzig Mar 6, 2023
f2b34b9
fix
Fvoiretryzig Mar 6, 2023
9dae979
modify match algorithm
Fvoiretryzig Mar 6, 2023
b6b07c3
remove pic save part
Fvoiretryzig Mar 7, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ libraries/setup/boost_1_58_0/
libraries/tbb43_20150611oss/
libraries/vicon/
libraries/*.log
modules/infinitam/
*.tags
tags
tests/mike/
Expand Down
73 changes: 73 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{
"files.associations": {
"xstring": "cpp",
"memory": "cpp",
"*.tpp": "cpp",
"*.tcu": "cpp",
"algorithm": "cpp",
"atomic": "cpp",
"bit": "cpp",
"cctype": "cpp",
"clocale": "cpp",
"cmath": "cpp",
"compare": "cpp",
"concepts": "cpp",
"cstddef": "cpp",
"cstdint": "cpp",
"cstdio": "cpp",
"cstdlib": "cpp",
"cstring": "cpp",
"ctime": "cpp",
"cwchar": "cpp",
"deque": "cpp",
"exception": "cpp",
"fstream": "cpp",
"functional": "cpp",
"initializer_list": "cpp",
"iomanip": "cpp",
"ios": "cpp",
"iosfwd": "cpp",
"iostream": "cpp",
"istream": "cpp",
"iterator": "cpp",
"limits": "cpp",
"list": "cpp",
"map": "cpp",
"new": "cpp",
"numeric": "cpp",
"ostream": "cpp",
"queue": "cpp",
"set": "cpp",
"sstream": "cpp",
"stdexcept": "cpp",
"streambuf": "cpp",
"string": "cpp",
"system_error": "cpp",
"tuple": "cpp",
"type_traits": "cpp",
"typeinfo": "cpp",
"unordered_map": "cpp",
"utility": "cpp",
"vector": "cpp",
"xfacet": "cpp",
"xhash": "cpp",
"xiosbase": "cpp",
"xlocale": "cpp",
"xlocinfo": "cpp",
"xlocmon": "cpp",
"xlocnum": "cpp",
"xloctime": "cpp",
"xmemory": "cpp",
"xstddef": "cpp",
"xtr1common": "cpp",
"xtree": "cpp",
"xutility": "cpp",
"ratio": "cpp",
"stop_token": "cpp",
"thread": "cpp",
"condition_variable": "cpp",
"cstdarg": "cpp",
"mutex": "cpp",
"unordered_set": "cpp"
}
}
67 changes: 59 additions & 8 deletions apps/spaintgui/Application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

#include "Application.h"
using namespace tvginput;
#include <time.h>
#include <sys/types.h>
#include <sys/wait.h>
#include <stdio.h>
#include <unistd.h>

#include <fstream>
#include <stdexcept>
Expand Down Expand Up @@ -51,13 +56,14 @@ using namespace tvgutil;

//#################### CONSTRUCTORS ####################

Application::Application(const MultiScenePipeline_Ptr& pipeline, bool renderFiducials)
Application::Application(const MultiScenePipeline_Ptr& pipeline, const std::map<std::string, std::string> &sceneID2Name, bool renderFiducials)
: m_activeSubwindowIndex(0),
m_batchModeEnabled(false),
m_commandManager(10),
m_pauseBetweenFrames(true),
m_paused(true),
m_pipeline(pipeline),
m_sceneID2Name(sceneID2Name),
m_renderFiducials(renderFiducials),
m_saveModelsOnExit(false),
m_usePoseMirroring(true),
Expand All @@ -84,8 +90,16 @@ Application::Application(const MultiScenePipeline_Ptr& pipeline, bool renderFidu

bool Application::run()
{
time_t start, end;
double cost = 0;
time(&start);
for(int i=0;;i++)
{
{
time(&end);
cost = difftime(end, start);
if (cost>30.0) {
break;
}
// Check to see if the user wants to quit the application, and quit if necessary. Note that if we
// are running in batch mode, we quit directly, rather than saving a mesh of the scene on exit.
bool eventQuit = !process_events();
Expand All @@ -98,7 +112,6 @@ bool Application::run()

// Take action as relevant based on the current input state.
process_input();

// If the application is unpaused, process a new frame.
if(!m_paused)
{
Expand All @@ -118,8 +131,9 @@ bool Application::run()
break;
}
}

usleep(100000);
// Render the scene.
/*
m_renderer->render(m_fracWindowPos, m_renderFiducials);

// If we're running a mapping server and we want to render any scene images requested by remote clients, do so.
Expand All @@ -135,13 +149,14 @@ bool Application::run()

// If desired, pause at the end of each frame for debugging purposes.
if(m_pauseBetweenFrames) m_paused = true;
*/
}

// If desired, save a mesh of the scene before the application terminates.
if(m_saveMeshOnExit) save_mesh();

// If desired, save a model of each scene before the application terminates.
if(m_saveModelsOnExit) save_models();
// if(m_saveModelsOnExit) save_models();

return true;
}
Expand Down Expand Up @@ -959,16 +974,23 @@ void Application::save_mesh() const
const std::vector<std::string> sceneIDs = model->get_scene_ids();

// Determine the (base) filename to use for the mesh, based on either the experiment tag (if specified) or the current timestamp (otherwise).
std::string meshBaseName = settings->get_first_value<std::string>("experimentTag", "spaint-" + TimeUtil::get_iso_timestamp());
// std::string meshBaseName = settings->get_first_value<std::string>("experimentTag", "spaint-" + TimeUtil::get_iso_timestamp());

// Determine the directory into which to save the meshes, and make sure that it exists.
/*
boost::filesystem::path dir = find_subdir_from_executable("meshes");
if(sceneIDs.size() > 1) dir = dir / meshBaseName;
boost::filesystem::create_directories(dir);
*/
if (!(model->get_collaborative_pose_optimiser()->isSuccess())) {
return;
}

// Mesh each scene independently.
std::vector<std::string> mergeFilesName;
std::vector<std::string> filesRootName;
for(size_t sceneIdx = 0; sceneIdx < sceneIDs.size(); ++sceneIdx)
{
{
const std::string& sceneID = sceneIDs[sceneIdx];
std::cout << "Meshing " << sceneID << " scene.\n";
SpaintVoxelScene_CPtr scene = model->get_slam_state(sceneID)->get_voxel_scene();
Expand Down Expand Up @@ -1011,6 +1033,7 @@ void Application::save_mesh() const

// Next, transform each triangle using the relative transform determined above.
const Matrix4f transform = *relativeTransform;
std::cout << "transform:\n" << transform << "\n";
Triangle *trianglesData = triangles->GetData(MEMORYDEVICE_CPU);
for(size_t triangleIdx = 0; triangleIdx < mesh->noTotalTriangles; ++triangleIdx)
{
Expand All @@ -1024,10 +1047,37 @@ void Application::save_mesh() const
}

// Save the mesh to disk.
const boost::filesystem::path meshPath = dir / (meshBaseName + "_" + sceneID + ".ply");
// const boost::filesystem::path meshPath = dir / (meshBaseName + "_" + sceneID + ".ply");
auto sceneName = m_sceneID2Name.find(sceneID);
const boost::filesystem::path meshPath = sceneName->second + "-" + TimeUtil::get_iso_timestamp() + ".ply";
mergeFilesName.push_back(meshPath.string());
std::cout << "Saving mesh to: " << meshPath << '\n';
mesh->WritePLY(meshPath.string().c_str());
}
std::string worldScene = m_sceneID2Name.find("World")->second;
std::string localScene = m_sceneID2Name.find("Local1")->second;
std::string outputFile = worldScene + "-" + localScene + ".ply";
pid_t pid = fork();
if (pid < 0) {
printf("error create merge program\n");
exit(0);
}
if (pid == 0) {
std::cout << "fork python program " << mergeFilesName[0] << " " << mergeFilesName[1] << "\n";
char *argv[] = {"python3","mergeMesh.py",
"--file1", const_cast<char*>(mergeFilesName[0].c_str()),
"--file2",const_cast<char*>(mergeFilesName[1].c_str()),
"--pose", "worldPose.txt",
"--output", const_cast<char*>(outputFile.c_str()),
NULL};
execvp("python3", argv);
std::cout << "after execlp python program\n";
}else {
std::cout << "this is origin program\n";
int status;
waitpid(pid, &status, 0);
std::cout << "after waitpid\n";
}
}

void Application::save_models() const
Expand Down Expand Up @@ -1170,3 +1220,4 @@ void Application::toggle_recording(const std::string& type, boost::optional<tvgu
std::cout << "[spaint] Started saving " << type << " to " << pathGenerator->get_base_dir() << "...\n";
}
}

10 changes: 9 additions & 1 deletion apps/spaintgui/Application.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
#ifndef H_SPAINTGUI_APPLICATION
#define H_SPAINTGUI_APPLICATION

#include <map>

#include <tvgutil/boost/WrappedAsio.h>
#include <boost/function.hpp>

Expand Down Expand Up @@ -105,6 +107,9 @@ class Application
/** The stream of commands being sent from the voice command server. */
boost::asio::ip::tcp::iostream m_voiceCommandStream;

/** scene name and scene ID map*/
std::map<std::string, std::string> m_sceneID2Name;

//#################### CONSTRUCTORS ####################
public:
/**
Expand All @@ -113,7 +118,9 @@ class Application
* \param pipeline The multi-scene pipeline that the application should use.
* \param renderFiducials Whether or not to render the fiducials (if any) that have been detected in the 3D scene.
*/
Application(const MultiScenePipeline_Ptr& pipeline, bool renderFiducials = false);
Application(const MultiScenePipeline_Ptr& pipeline,
const std::map<std::string, std::string> &sceneID2Name,
bool renderFiducials = false);

//#################### PUBLIC MEMBER FUNCTIONS ####################
public:
Expand Down Expand Up @@ -356,3 +363,4 @@ class Application
};

#endif

Loading