Skip to content

Feedback system

Dataflow for the functioning of the Augmented Carpentry's feedback system. ><


The LayerFeedback.h module handles the computation of all essential data required to deliver visual guidance to the user during the fabrication process. To compute feedback, information is primarily retrieved from two preceding layers:

  1. LayerModel.h: Contains the execution model and the geometries associated with the currently active hole or cut (via AC_FF_COMP macro).
  2. LayerToolhead.h: Provides similar information, but specific to the current toolhead attached to the tool (via AC_FF_TOOL macro).

The LayerFeedback::OnFrameStart() from the LayerFeedback.h simply activates the feedback set based on the correct toolhead based on the current fabrication element.

Toolhead Hole Cut
Chainsaw
Circualr Saw
Drill meshes

Once the correct feedback is indetified, we have all the geometries of the joint or hole we are working on, as well as the geometries of the toolhead attached to the tool, we can compute all the relevant computations to build the feedback set: starting distance, depth, orientation, etc. In the layer LayerFeedback.h not only we calculate these values but we generate all the necessary GOs to visualize them in the AR scene.

FabFeedback interface

Feedback is categorized by similar operations:

Each feedback category inherits from an interface class (AIAC/Feedback/FabFeedback.h), which provides top-level control functions such as Update(), Activate(), and Deactivate().

src/AIAC/Feedback/FabFeedback.h
#pragma once

#include "AIAC/Config.h"

#define AC_FF_COMP AIAC_APP.GetLayer<LayerModel>()->GetACInfoModel().GetTimberInfo().GetCurrentComponent()
#define AC_FF_TOOL AIAC_APP.GetLayer<LayerToolhead>()->ACInfoToolheadManager->GetActiveToolhead()

namespace AIAC {
    class FabFeedback {
    public:
        FabFeedback() {
            this->m_ScaleFactor = AIAC::Config::Get<float>(AIAC::Config::SEC_AIAC, AIAC::Config::SCALE_FACTOR, 1.0f);
        };
        ~FabFeedback() = default;

        virtual void Update() {};
        virtual void Activate() {};
        virtual void Deactivate() {};

    protected:
        float m_ScaleFactor = 0.0f;
    };
}

Tip

The Update() function is called at each frame to update the feedback data, while Activate() and Deactivate() are used to enable/disable the feedback visualization.

FeedbackVisualizer widgets

Each tool's visual guidance might consists of multiple visual cues, most of which are built on the template FeedbackVisualizer.h. All the feedback values are computed but also visualized as GOs, and stored inside (m_AllPrimitives). This is convinient as we can easily toggle the visibility of the feedback by calling the Activate()/Deactivate() functions.

src/AIAC/Feedback/FeedbackVisualizer.h
#ifndef AC_FEEDBACKVISUALIZER_H
#define AC_FEEDBACKVISUALIZER_H

#include "vector"
#include "memory"
#include "AIAC/GOSys/GOPrimitive.h"
#include "AIAC/Config.h"

namespace AIAC{
    class FeedbackVisualizer {
    public:
        FeedbackVisualizer() = default;
        ~FeedbackVisualizer() = default;

        inline virtual void Activate() {
            for (auto &p : m_AllPrimitives) {
                p->SetVisibility(true);
            }
        }

        inline virtual void Deactivate() {
            for (auto &p : m_AllPrimitives) {
                p->SetVisibility(false);
            }
        }

        // ...

    protected:
        std::vector<std::shared_ptr<GOPrimitive>> m_AllPrimitives;
    };

}

Example

As an example, the circular saw feedback has several VisualFeedback classes that inherit from FeedbackVisualizer to manage the visualization of the feedback. In the case of the circular saw, we have the following VisualFeedback classes:

VisualFeedback class Description
class CutCircularSawDepthVisualizer it visualizes the height of the blade in relation to the lap joint
class CutCircularSawPositionStartVisualizer it visualizes the starting position of the cut as a text in millimeters and as a green line for graphical correction
class CutCircularOrientationVisualizer it visualizes the correct orientation of the cut as a text in millimeters and as a green line for graphical correction
class CircularSawCutPlaneVisualizer : public CutPlaneVisualizer in this case it still inherits from FeedbackVisualizer the CutPlaneVisualizer, but since it is employed also by other tools (e.g. chainsaw), the sub-class already presents some common parameters and visual cues for the plane corresponding to the blade
class CircularSawCutBladeThicknessVisualizer it visualizes the thickness of the blade as two red lines

All the VisualFeedback are not active all the time at the same time during a fabrication. Depending on which scenario is detected, they are activated (visible) or deactivated (not visible).

Here's an example of the CutCircularSawFeedback class in action for a typical circular saw cutting sequence:

This composite system allows for a flexible and modular feedback system that can be easily extended with new feedback types and visualizations.