Skip to content
This repository has been archived by the owner on Sep 17, 2024. It is now read-only.

Commit

Permalink
dvrk_console_json: added option to use cisstMultiTask state table col…
Browse files Browse the repository at this point in the history
…lectors
  • Loading branch information
adeguet1 committed May 25, 2021
1 parent 0866f79 commit b6ca9e5
Showing 1 changed file with 33 additions and 2 deletions.
35 changes: 33 additions & 2 deletions dvrk_robot/src/dvrk_console_json.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Author(s): Anton Deguet
Created on: 2015-07-18
(C) Copyright 2015-2020 Johns Hopkins University (JHU), All Rights Reserved.
(C) Copyright 2015-2021 Johns Hopkins University (JHU), All Rights Reserved.
--- begin cisst license - do not edit ---
Expand All @@ -26,6 +26,10 @@ no warranty. The complete license can be found in license.txt and
#include <cisstCommon/cmnGetChar.h>
#include <cisstCommon/cmnQt.h>
#include <cisstOSAbstraction/osaGetTime.h>
#include <cisstMultiTask/mtsCollectorFactory.h>
#include <cisstMultiTask/mtsCollectorQtFactory.h>
#include <cisstMultiTask/mtsCollectorQtWidget.h>

#include <sawIntuitiveResearchKit/mtsIntuitiveResearchKitConsole.h>
#include <sawIntuitiveResearchKit/mtsIntuitiveResearchKitConsoleQt.h>

Expand Down Expand Up @@ -79,6 +83,7 @@ int main(int argc, char ** argv)
double publishPeriod = 10.0 * cmn_ms;
double tfPeriod = 20.0 * cmn_ms;
std::list<std::string> jsonIOConfigFiles;
std::string jsonCollectionConfigFile;
std::list<std::string> managerConfig;
std::string qtStyle;

Expand All @@ -101,7 +106,11 @@ int main(int argc, char ** argv)
options.AddOptionNoValue("t", "text-only",
"text only interface, do not create Qt widgets");

options.AddOptionNoValue("c", "calibration-mode",
options.AddOptionOneValue("c", "collection-config",
"json configuration file for data collection using cisstMultiTask state table collector",
cmnCommandLineOptions::OPTIONAL_OPTION, &jsonCollectionConfigFile);

options.AddOptionNoValue("C", "calibration-mode",
"run in calibration mode, doesn't use potentiometers to monitor encoder values and always force re-homing. This mode should only be used when calibrating your potentiometers.");

options.AddOptionMultipleValues("m", "component-manager",
Expand Down Expand Up @@ -162,6 +171,28 @@ int main(int argc, char ** argv)
consoleQt->Connect();
}

// configure data collection if needed
if (options.IsSet("collection-config")) {
// make sure the json config file exists
fileExists("JSON data collection configuration", jsonCollectionConfigFile);

mtsCollectorFactory * collectorFactory = new mtsCollectorFactory("collectors");
collectorFactory->Configure(jsonCollectionConfigFile);
componentManager->AddComponent(collectorFactory);
collectorFactory->Connect();

if (hasQt) {
mtsCollectorQtWidget * collectorQtWidget = new mtsCollectorQtWidget();
consoleQt->addTab(collectorQtWidget, "Collection");

mtsCollectorQtFactory * collectorQtFactory = new mtsCollectorQtFactory("collectorsQt");
collectorQtFactory->SetFactory("collectors");
componentManager->AddComponent(collectorQtFactory);
collectorQtFactory->Connect();
collectorQtFactory->ConnectToWidget(collectorQtWidget);
}
}

// create a console with all dVRK ROS topics
// - publishPeriod is used to control publish rate
// - tfPeriod is used to control tf broadcast rate
Expand Down

0 comments on commit b6ca9e5

Please sign in to comment.