Skip to content

Feedback

Petingo edited this page Aug 7, 2023 · 11 revisions

The feedback layer provides a real-time visual guide for the carpenter, helping them adjust the position and orientation of the tool. In the LayerFeedback, each pair of component type and tool has a corresponding instance, such as, HoleFeedback (Hole + drill), CutChainSawFeedback (Cut + Chain Saw), and CutCircularSawFeedback (Cut + Circular Saw). When the LayerFeedback starts for each frame, it activates the corresponding instance based on the current component and tool.

For each feedback instance, the main class which inherits class FabFeedback is used to control its (de)activation and update the data for creating the final visual feedback. It may contain one or multiple FeedbackVisualizer for different kinds of feedback (angle, depth, cut plane, etc). The visualizer is responsible for managing the GO primitives.

The main feedback class should have the following structure:

class <Component_type><Tool_type>Feedback : public FabFeedback{
public:
    void Update() override;     // Updating data and performing calculations for the final visual feedback
    void Activate() override;   // Activate visualizer(s) and invoke update()
    void Deactivate() override; // Deactivate all visualizer(s)
}

and for the visualizer:

class <Component_type><Tool_type><Feedback_type>Visualizer : public FeedbackVisualizer {
public:
    Constructor(); // Initialize all the GO Primitives, and add all GOs that need to be
                   // rendered into `m_AllPrimitives`, and call the derived function `Deactivate()`
                   // that disable the visibility of all GOs in `m_AllPrimitives`
}

The class FeedbackVisualizer has a std::vector<std::shared_ptr<GOPrimitive>> and two member functions, Activate() and Deactivate() for switch on/off the rendering of the visual feedback. Also, it has a static function toString() which can be used to output distance in the correct scale and form.

Hole

Cut plane visualizer

Cut plane visualizer shows the red plane that indicates the intersection of the AC Info Model and the surface form by the blade. Unlike other visualizers, it contains its own update function, which takes the surface of the blade as its parameter.

std::vector<glm::vec3> Update(glm::vec3 faceNorm, glm::vec3 facePt);

Cut + Chain Saw

For chain saw, we have three kinds of feedback: Angle, Depth, and Cut plane, each feedback has a corresponding visualizer and would be activated when the condition meets.

After updating the tool's position, it would first separate all faces into 2 categories: parallel or perpendicular, based on the angle between the blade and the face. Then, it chooses the nearest parallel and perpendicular face as the current target face. Note that since we're in 3D space, there are two kinds of perpendicular, x-y and x-z.

Then, the nearest parallel face will be used to update the angle feedback, and the nearest perpendicular will be used for depth feedback, if there are no parallel/perpendicular faces found, angle/depth feedback will not be activated.

Cut + Circular Saw

(The document here is based on the initial version of Ttool, where it only traces the blade instead of the whole tool)

The circular saw is more tricky than a chain saw. Since the blade is a circle, there is no way to define the bottom of the blade only by the tool itself. Also, when adjusting the depth of the blade, one may put the tool on the side of the timber beam, making the target cutting plane (which suppose to be parallel to the blade) also perpendicular. Thus, we have to first determine the bottom of the blade and the reference faces by inspecting the relation between the position/orientation of the blade and the faces.

The mechanism is as follows (Implementation details can be found in updateRefFaces():

look for all parallel faces
look for all perpendicular faces
sort all perpendicular faces by distance  // face center <-> tool

if (found parallel face) {
    reference parallel face      = nearest parallel face
    reference perpendicular face = nearest perpendicular face
} else {
    reference parallel face      = nearest perpendicular face
    reference perpendicular face = 2nd nearest perpendicular face
}

In this way, one can not put the blade too far away from the target cutting face, in the direction of the target bottom face, as shown below.

|--- NOT HERE ---|--- SAFE ZONE ---|

                      ↓ target face  
____________          ______________
            |   cut   |
            |_________|    timber

______________________________

Home

GO system

Layers

Utilities

Clone this wiki locally