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

AC Recorder #38

Merged
merged 18 commits into from
May 27, 2024
Merged

AC Recorder #38

merged 18 commits into from
May 27, 2024

Conversation

9and3
Copy link
Collaborator

@9and3 9and3 commented May 3, 2024

Description 🤖

This is the PR for the development of the AC Recorder. The objective is to record the 3d fabrication in AC by logging all the informations so that it can be replayed later on Grasshopper.

Here's the features to track and record:

  • position of the timber
  • position of all the cuts and holes (acim in time?)
  • the trajectory of camera
  • trajectory of tool head
  • type of tool head
  • model of tool head (needs to be cached)
  • I might miss some ..

Type of feature/changes 🌲

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • This change requires a documentation update

@9and3 9and3 added the enhancement New feature or request label May 3, 2024
@9and3
Copy link
Collaborator Author

9and3 commented May 3, 2024

Hello @Petingo, as a general approach for the implementation I would start by creating a new space in the code base and work on a brand new layer:

    AIAC::ApplicationSpecification appSpec;
    appSpec.Name = "augmented_carpentry";  // かくちょう_だいく
    appSpec.WinWidth = 800;
    appSpec.WinHeight = 480;
    appSpec.IsResizable = false;
    appSpec.VSync = true;
    appSpec.WindowBackColor = ImVec4(1.00f, 1.00f, 1.00f, 1.00f);

    std::unique_ptr<AIAC::Application> acApp_ptr = std::unique_ptr<AIAC::Application>(new AIAC::Application(appSpec));

    acApp_ptr->GetWindow()->Init();

    acApp_ptr->GetGORegistry()->Init();

    acApp_ptr->PushLayer<AIAC::LayerCamera>();
    acApp_ptr->PushLayer<AIAC::LayerCameraCalib>();
    acApp_ptr->PushLayer<AIAC::LayerSlam>();
    acApp_ptr->PushLayer<AIAC::LayerModel>();
    acApp_ptr->PushLayer<AIAC::LayerToolhead>();
    acApp_ptr->PushLayer<AIAC::LayerFeedback>();
    acApp_ptr->PushLayer<AIAC::LayerUI>();
    acApp_ptr->PushLayer<AIAC::LayerUtils>();
    acApp_ptr->PushLayer<AIAC::LayerRecorder>();    // <------------- here the new layer

    acApp_ptr->GetRenderer()->Init();

    acApp_ptr->GetEventBus()->Init();
    acApp_ptr->Run();

    return 0;

Let's keep the discussion here for the development of this feature! ⭐

@Petingo
Copy link
Collaborator

Petingo commented May 3, 2024

Here's my draft about the overall design:

Content in Log File

TSlam

  • Frame ID
  • Timestamp
  • 1 / 0 indicating if the frame is tracked
  • If the frame is tracked
    • Translation Vector + Quaternion = 7 floating point number
    • Number of valid Marker ( + ID of the marker seen in the frame, so that we can highlight the marker that is seen in the frame when visualizing?)

TTool

Only record whenever there is an event

  • Frame ID
  • (Timestamp - optional, I guess it’s better to just use frame ID to align with them timestamp recorded in TSlam’s log)
  • Event type
    • Change the type of tool ← initialization step can also be this
    • Manual adjustment
    • Refinement
  • Position and Rotation can follow the form of TSlam

@9and3
Copy link
Collaborator Author

9and3 commented May 5, 2024

Hello @Petingo thanks for the draft!

Here are my general feedback:

  • we are missing the .acim model, it evolution (joint fabricated, which joint is active etc) should be tracked too.
  • I still have doubts about splitting the log in two. Wouldn't be better to have everything in one?
  • the event-based tracking of the ttool is a nice idea but maybe a bit too cumbersome. I would reccomend to record only frames when TSlam is valid andin any case print the: a) type of tool, b) pose (as you suggest for TSlam)
  • we should also log the general information such as the http of the zenodo doi (to later redownload the meshes of the tool heads) and the initial pose of the tools.

On a separate note the UI should also be integrated as a floating window maybe (since we will use it very often).

Let me know what you think! ✋

@9and3 9and3 requested a review from a team May 5, 2024 18:22
@Petingo
Copy link
Collaborator

Petingo commented May 6, 2024

Hey @9and3,
Thanks for the feedback.

  • I totally forgot .acim. I'll look into how to log its information.
  • The main purpose of separating the file is to simplify the parser (later when generating the animation). Perhaps it's not needed.
  • I suggest only logging the change for TTool since it can dramatically reduce the file size. Given that it'll be a very long sequence, I believe it will be better to log in this way.
  • We should have a header block for all the other information.

I'll be in the lab on Wednesday. Hopefully, we can finalize the spec and start the implementation.

@9and3
Copy link
Collaborator Author

9and3 commented May 6, 2024

  • I suggest only logging the change for TTool since it can dramatically reduce the file size. Given that it'll be a very long sequence, I believe it will be better to log in this way.

Sounds good. It will just require to be well thought "when" to fire the event (e.g. when the pose is saved + change of tools as you mentioned before)

I'll be in the lab on Wednesday. Hopefully, we can finalize the spec and start the implementation.

👍

/**
* @brief log header information to the file
*/
void m_LogHeader();
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

@Petingo , why the hungarian notation m_, it's not needed right?

Copy link
Collaborator

Choose a reason for hiding this comment

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

You're right. I forgot the naming convension. Updated in 2e66de1

src/utils/utils.h Outdated Show resolved Hide resolved
@9and3
Copy link
Collaborator Author

9and3 commented May 22, 2024

After practical test here's the todos:

  • containerize the .ply scan model, the .acim and the TTool's files (config) into one folder than zipped with a custom extension e.g.: .AClog
  • add legend at the top of the log
  • make button bigger

@Petingo
Copy link
Collaborator

Petingo commented May 24, 2024

I think it's ready to merge now!

@9and3
Copy link
Collaborator Author

9and3 commented May 27, 2024

LGTM @Petingo ! Did you also patched the bug in #43 by any chance?

@Petingo
Copy link
Collaborator

Petingo commented May 27, 2024

LGTM @Petingo ! Did you also patched the bug in #43 by any chance?

Not yet, should we merge after fixing it?

@9and3
Copy link
Collaborator Author

9and3 commented May 27, 2024

Not yet, should we merge after fixing it?

No it's ok we can merge this, we'll open another PR for #43

@9and3 9and3 merged commit fe0ecfd into main May 27, 2024
2 checks passed
Petingo added a commit that referenced this pull request May 30, 2024
* FIRST COMMIT

* FEATURE: Init log recorder

* FEATURE: SLAM pos logger

* Feat: Add Ttool & Log Recording

* WIP: ACIM Log, done init

* Feat: Done ACIM log

* Refactor: naming of function & improved the structure in util

* Refactor: rename MatrixUtils.h

* Feat: Add TTool Zenodo version, update ACIM trans matrix

* Feat: log filename & acim trans mat fix

* Feat: Done Log recorder

* Feat: bigger button, copy dep files, add legends

* WIP: Compress the folder, has bug now

* Fix: bug in zip file's path is resolved

* Refactor: update legend format

* Fix: change the ttool pose matrix

---------

Co-authored-by: Andrea Settimi <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants