cruise-automation / rosbag.js

ROS bag file reader for JavaScript 👜

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Transform record is polluted with unused fields when loading Example.bag

gkjohnson opened this issue · comments

When loading the example bag in the fixtures folder with the following code:

   const bag = await open('.../example.bag')
    bag.readMessages({ topics: '/tf' }, msg => {
        console.log(JSON.stringify(msg.message, (key, val) => val === undefined ? null : val, 2));
    });

Record is printed out in the following form:

{
  "transforms": [
    {
      "x": null,
      "y": null,
      "z": null,
      "w": null,
      "header": {
        "x": null,
        "y": null,
        "z": null,
        "w": null,
        "seq": 0,
        "stamp": {
          "sec": 1396293888,
          "nsec": 56065082
        },
        "frame_id": "world"
      },
      "child_frame_id": "turtle2",
      "transform": {
        "x": null,
        "y": null,
        "z": null,
        "w": null,
        "translation": {
          "x": 4,
          "y": 9.088889122009277,
          "z": 0,
          "w": null
        },
        "rotation": {
          "x": 0,
          "y": 0,
          "z": 0,
          "w": 1
        }
      }
    }
  ]
}

The same thing happens in the browser, as well:

image

You can see that a lot of the objects in the record definition seem to be inheriting from the Quaternion class unnecessarily, even the translation field.

Good find, thank you! I think I broke this in #20. Fix incoming. You should also feel free to investigate issues you find — we're happy to accept PRs!