Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MCAP logging error: Message: invalid magic bytes in Footer: 0xD0FF0B0000000000 #46

Open
scastro-bdai opened this issue Feb 27, 2025 · 3 comments

Comments

@scastro-bdai
Copy link

scastro-bdai commented Feb 27, 2025

Hi @facontidavide!

I've been trying to get started with this tool and I'm probably doing something wrong with the MCAPSink.

So first of all, I was running into the chunking issue explained in #20 -- since I was only trying to log a single scalar double value over time, I wasn't seeing anything coming up on file until I logged a ton of data.

Next up, when I finally get a file that's partially full, I try to load it into PlotJuggler and get this error:

 Message: invalid magic bytes in Footer: 0xD0FF0B0000000000

Is there some special way to make sure the file/buffer are closed properly? Or something missing? Here is my code:

(in the constructor)

  mcap_sink_ = std::make_shared<DataTamer::MCAPSink>("ruckig_traj_executor_log.mcap");
  log_channel_ = DataTamer::LogChannel::create("trajectory");
  log_channel_->addDataSink(mcap_sink_);

  log_channel_->registerValue("joint_1", &joint_value_);

in some subscriber callback

  joint_value_ += 1.0;
  if (!log_channel_->takeSnapshot()) {
    RCLCPP_INFO_STREAM(get_node()->get_logger(), "LOGGING FAILED!");
  } else {
    RCLCPP_INFO_STREAM(get_node()->get_logger(), "LOGGING SUCCEEDED!");
  }

Confirming the "LOGGING SUCCEEDED" printout is happening.

Any ideas? Thanks!

@jlack1987
Copy link

I could be wrong, but I have also had similar issues and it seems like issues like that are due to the mcap writer not properly destructing and getting to finish writing the file.

@facontidavide
Copy link
Collaborator

yes, that is the problem... i need to find a way to make this less fragile to crashes

@scastro-bdai
Copy link
Author

Yep -- ok, confirming that for whatever reason, this code is not properly destroying the object containing the MCAPSink. I blame the use of pluginlib in this whole mess :)

If I manually reset() the shared pointer to the sink during execution, the file reads correctly in PlotJuggler.

Not sure if you'd like to leave this open or closed, but I defer to you -- thanks, guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants