use environment variable for plain cmake projects to locate dataset folder
This commit is contained in:
+12
-2
@@ -20,24 +20,34 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <cstdlib> // for getenv
|
#include <cstdlib> // for getenv
|
||||||
#include <ros/package.h>
|
#include <ros/package.h>
|
||||||
#include <vikit/params_helper.h>
|
#ifdef SVO_USE_ROS
|
||||||
|
#include <vikit/params_helper.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
namespace svo {
|
namespace svo {
|
||||||
namespace test_utils {
|
namespace test_utils {
|
||||||
|
|
||||||
std::string getDatasetDir()
|
std::string getDatasetDir()
|
||||||
{
|
{
|
||||||
std::string dataset_dir(ros::package::getPath("svo")+"/test/data");
|
|
||||||
const char* env_dir = std::getenv("SVO_DATASET_DIR");
|
const char* env_dir = std::getenv("SVO_DATASET_DIR");
|
||||||
|
#ifdef SVO_USE_ROS
|
||||||
|
std::string dataset_dir(ros::package::getPath("svo")+"/test/data");
|
||||||
if(env_dir != NULL)
|
if(env_dir != NULL)
|
||||||
dataset_dir = std::string(env_dir);
|
dataset_dir = std::string(env_dir);
|
||||||
return dataset_dir;
|
return dataset_dir;
|
||||||
|
#else
|
||||||
|
return std::string(env_dir);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
std::string getTraceDir()
|
std::string getTraceDir()
|
||||||
{
|
{
|
||||||
|
#ifdef SVO_USE_ROS
|
||||||
std::string default_dir(ros::package::getPath("svo")+"/test/results");
|
std::string default_dir(ros::package::getPath("svo")+"/test/results");
|
||||||
return vk::getParam<std::string>("svo/trace_dir", default_dir);
|
return vk::getParam<std::string>("svo/trace_dir", default_dir);
|
||||||
|
#else
|
||||||
|
return "/tmp";
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace test_utils
|
} // namespace test_utils
|
||||||
|
|||||||
Reference in New Issue
Block a user