Skip to content

multiple (moving) Reference frame displayed - #1

Open
alfatave wants to merge 2 commits into
MADS-NET:mainfrom
alfatave:main
Open

multiple (moving) Reference frame displayed#1
alfatave wants to merge 2 commits into
MADS-NET:mainfrom
alfatave:main

Conversation

@alfatave

Copy link
Copy Markdown

No description provided.

alfatave added 2 commits May 19, 2026 16:04
Enable visualization of 3D coordinate systems by parsing 4x4 homogeneous matrices from specified JSON keypaths. Extracts origin and axis vectors, logging them as colored arrows to Rerun. Supports flat [16] and nested [[4],[4],[4],[4]] array formats.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds support for visualizing multiple moving reference frames in Rerun by interpreting configured JSON keypaths as 4×4 homogeneous transformation matrices and logging them as 3D axis arrows.

Changes:

  • Introduces a new _hmat_keypaths configuration list and loads it from plugin params.
  • Adds per-sample parsing of 4×4 (or flat[16]) matrices and logs X/Y/Z axis arrows at the matrix translation.
  • Adds a scaling parameter (h_scale, used with a default) to control axis arrow length.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/rerunner.cpp
for (const auto &keypath : _hmat_keypaths) {
json::json_pointer ptr(dot_to_pointer(keypath));
const auto &mat = data[ptr];
cout << mat.dump(2);
Comment thread src/rerunner.cpp
Comment on lines +258 to +271
_rec->log("frame/" + keypath,
rerun::Arrows3D::from_vectors({
rerun::Vector3D{(float)m[0]*ax_len, (float)m[4]*ax_len, (float)m[8]*ax_len}, // X
rerun::Vector3D{(float)m[1]*ax_len, (float)m[5]*ax_len, (float)m[9]*ax_len}, // Y
rerun::Vector3D{(float)m[2]*ax_len, (float)m[6]*ax_len, (float)m[10]*ax_len}, // Z
})
.with_origins({origin, origin, origin})
.with_colors({
rerun::Color(255, 40, 40), // X = red
rerun::Color( 40, 220, 40), // Y = green
rerun::Color( 40, 40, 255), // Z = blue
})
.with_labels({"X", "Y", "Z"})
);
Comment thread src/rerunner.cpp
Comment on lines +422 to +440
// In set_params, add a new param:
//_params["hmat_keypaths"] = json::array(); // list of keypaths to 4x4 matrices

// Load in set_params:
_hmat_keypaths.clear();
if (_params.contains("hmat_keypaths") && _params["hmat_keypaths"].is_array()) {
std::cout << "\ntrovato hmat " << _params["hmat_keypaths"].size() << "\n";
for (const auto &path : _params["hmat_keypaths"])
{
std::cout << "\nvaluto\n";
if (path.is_string()){
cout << "\naggiunto\n";
_hmat_keypaths.push_back(path.get<std::string>());
cout << "\naggiunto\n";
}else{
cout << "\nnon aggiunto\n";
}
}
}
@pbosetti

pbosetti commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Before merging, the feature needs to be documented in the README.md.
Also, the last row, last column element of the HTM is the scaling factor, so there is no need for a dedicated parameter, and one can dynamically and individually scale each HTM that way.

@pbosetti

Copy link
Copy Markdown
Contributor

Additionally, it makes little sense to pass via JSON 4x4 matrices when only 7 values (angles, position and scale) are used independently. Better and simpler to use a predefined schema.

@pbosetti

pbosetti commented Jun 16, 2026

Copy link
Copy Markdown
Contributor

Also consider Copilot comments, specifically regarding debug print (in Italian!) that ought to be removed

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

Successfully merging this pull request may close these issues.

3 participants