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 <cstdlib> // for getenv
|
||||
#include <ros/package.h>
|
||||
#include <vikit/params_helper.h>
|
||||
#ifdef SVO_USE_ROS
|
||||
#include <vikit/params_helper.h>
|
||||
#endif
|
||||
|
||||
namespace svo {
|
||||
namespace test_utils {
|
||||
|
||||
std::string getDatasetDir()
|
||||
{
|
||||
std::string dataset_dir(ros::package::getPath("svo")+"/test/data");
|
||||
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)
|
||||
dataset_dir = std::string(env_dir);
|
||||
return dataset_dir;
|
||||
#else
|
||||
return std::string(env_dir);
|
||||
#endif
|
||||
}
|
||||
|
||||
std::string getTraceDir()
|
||||
{
|
||||
#ifdef SVO_USE_ROS
|
||||
std::string default_dir(ros::package::getPath("svo")+"/test/results");
|
||||
return vk::getParam<std::string>("svo/trace_dir", default_dir);
|
||||
#else
|
||||
return "/tmp";
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace test_utils
|
||||
|
||||
Reference in New Issue
Block a user