Added General/debug parameter

This commit is contained in:
matlabbe 2017-03-27 13:56:53 -04:00
parent f722087bf5
commit 6337d4efb6
4 changed files with 24 additions and 2 deletions

View File

@ -325,8 +325,7 @@ int main(int argc, char* argv[])
if(strcmp(argv[i], "-debug") == 0 ||
strcmp(argv[i], "--debug") == 0)
{
ULogger::setPrintWhere(true);
ULogger::setLevel(ULogger::kDebug);
customParameters.insert(find_object::Settings::kGeneral_debug(), true);
continue;
}
if(strcmp(argv[i], "-log-time") == 0 ||

View File

@ -284,6 +284,7 @@ class FINDOBJECT_EXP Settings
PARAMETER(General, sendNoObjDetectedEvents, bool, true, "When there are no objects detected, send an empty object detection event.");
PARAMETER(General, autoPauseOnDetection, bool, false, "Auto pause the camera when an object is detected.");
PARAMETER(General, autoScreenshotPath, QString, "", "Path to a directory to save screenshot of the current camera view when there is a detection.");
PARAMETER(General, debug, bool, false, "Show debug logs on terminal.");
PARAMETER(Homography, homographyComputed, bool, true, "Compute homography? On ROS, this is required to publish objects detected.");
PARAMETER(Homography, method, QString, "1:LMEDS;RANSAC;RHO", "Type of the robust estimation algorithm: least-median algorithm or RANSAC algorithm.");

View File

@ -54,6 +54,17 @@ FindObject::FindObject(bool keepImagesInRAM, QObject * parent) :
{
qRegisterMetaType<find_object::DetectionInfo>("find_object::DetectionInfo");
UASSERT(detector_ != 0 && extractor_ != 0);
if(Settings::getGeneral_debug())
{
ULogger::setPrintWhere(true);
ULogger::setLevel(ULogger::kDebug);
}
else
{
ULogger::setPrintWhere(false);
ULogger::setLevel(ULogger::kInfo);
}
}
FindObject::~FindObject() {

View File

@ -1647,6 +1647,17 @@ void MainWindow::notifyParametersChanged(const QStringList & paramChanged)
ui_->actionCamera_from_video_file->setChecked(!Settings::getCamera_5mediaPath().isEmpty() && !UDirectory::exists(Settings::getCamera_5mediaPath().toStdString()) && !Settings::getCamera_6useTcpCamera());
ui_->actionCamera_from_directory_of_images->setChecked(!Settings::getCamera_5mediaPath().isEmpty() && UDirectory::exists(Settings::getCamera_5mediaPath().toStdString()) && !Settings::getCamera_6useTcpCamera());
ui_->actionCamera_from_TCP_IP->setChecked(Settings::getCamera_6useTcpCamera());
if(Settings::getGeneral_debug())
{
ULogger::setPrintWhere(true);
ULogger::setLevel(ULogger::kDebug);
}
else
{
ULogger::setPrintWhere(false);
ULogger::setLevel(ULogger::kInfo);
}
}
} // namespace find_object