Skip to content

Commit

Permalink
Merge pull request #186 from robotology/addPeriodThread
Browse files Browse the repository at this point in the history
TelemetryDeviceDumper: add log_period parameter
  • Loading branch information
Nicogene authored Dec 5, 2023
2 parents 6f17680 + 04f10ff commit cd2cbbd
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/telemetryDeviceDumper/TelemetryDeviceDumper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ using namespace robometry;
using namespace yarp::os;
using namespace yarp::dev;

constexpr double period_thread{ 0.010 };
constexpr double log_thread_default{ 0.010 };


void convertVectorFromDegreesToRadians(std::vector<double>& inVec) {
Expand Down Expand Up @@ -58,7 +58,7 @@ bool getUsedDOFsList(yarp::os::Searchable& config, std::vector<std::string>& use
}

// For now also the period is harcoded, it can be configured
TelemetryDeviceDumper::TelemetryDeviceDumper() : yarp::os::PeriodicThread(period_thread) {
TelemetryDeviceDumper::TelemetryDeviceDumper() : yarp::os::PeriodicThread(log_thread_default) {
// TODO
}

Expand Down Expand Up @@ -185,6 +185,10 @@ bool TelemetryDeviceDumper::loadSettingsFromConfig(yarp::os::Searchable& config)

}

if (prop.check("log_period") && prop.find("log_period").isFloat64()) {
this->setPeriod(prop.find("log_period").asFloat64());
}

std::string auto_save = "auto_save";
if (prop.check(auto_save.c_str()) && prop.find(auto_save.c_str()).isBool()) {
m_bufferConfig.auto_save = prop.find(auto_save.c_str()).asBool();
Expand Down
1 change: 1 addition & 0 deletions src/telemetryDeviceDumper/TelemetryDeviceDumper.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ struct TelemetryDeviceDumperSettings {
* | `n_samples` | size_t | - | - | Yes | The max number of samples contained in the circular buffer/s |
* | `save_periodically` | bool | - | false | No(but it has to be set to true if `auto_save` is set to false) | The flag for enabling the periodic save thread. |
* | `save_period` | double | seconds | - | Yes(if `save_periodically` is set to true) | The period in seconds of the save thread |
* | `log_period` | double | seconds | 0.010 | No | The period in seconds of the logging thread. |
* | `data_threshold` | size_t | - | 0 | No | The save thread saves to a file if there are at least `data_threshold` samples |
* | `auto_save` | bool | - | false | No(but it has to be set to true if `save_periodically` is set to false) | the flag for enabling the save in the destructor of the `robometry::BufferManager` |
* | `yarp_robot_name` | string | - | "" | No | Name of the robot used during the experiment. |
Expand Down

0 comments on commit cd2cbbd

Please sign in to comment.