data_tamer icon indicating copy to clipboard operation
data_tamer copied to clipboard

takeSnapShot not working

Open chinjo1296 opened this issue 10 months ago • 0 comments

Hello,

I am trying to implement the basic example using structures and not the custom data type one. My code has the following structure:

struct Robot {
    std::shared_ptr<DataTamer::MCAPSink> mcap_sink;
    std::shared_ptr<DataTamer::LogChannel> channel;
    DataTamer::RegistrationID id1;
    int count{0};
}

The above code is in a Robot.h file. The implementation file looks like this

Robot::Robot()
{
    mcap_sink = std::make_shared<DataTamer::MCAPSink>(robotId + "_diagnostics_log.mcap");
    channel = DataTamer::LogChannel::create("diagnostics_channel");
    channel->addDataSink(mcap_sink);
    id1 = channel->registerValue("count", &this->count);
}

I have a mqtt callback function where I have added the takeSnapShot() function

void Robot::updateData(nlohmann::json data)
{
    channel->takeSnapshot();
    count++;
}

Please let me know what I am doing wrong because when I copy the example code in my constructor it works but doesn't work like this

chinjo1296 avatar Dec 31 '24 11:12 chinjo1296