-
Notifications
You must be signed in to change notification settings - Fork 1
Home
- Define your HW user interface in FreeCAD Define your frontpanel widgets by grouping freecad-objects together by selecting them and clicking on the appropriate menu-icon. In most cases the last selection click defines the movement/rotation axis of the widget. Give the widget(its actually a FreeCAD group object) a unique name(=label), because you will refer to it from your external application code. It is usually a good idea to put all the widgets into an own "part" object, so moving them will not cause any problem.
- Display:
Select a rectangle shaped plane or a thin box as a display and then click on the Display icon. After that you can set the desired resolution as a parameter.
- Touch Surface:
Select 2 Perpendicular edges that cross in one point and then click on the touch-surface icon. The first edge will be the X axis, the second will be the y-axis of the touch rectangle. Now choose the resolution parameters and you are good to go.
- Pushbutton:
Select the objects that should act as the moving-down part of the button. The last surface determines the linear movement normal vector. You have the possibility to change the push-depth, and also rotation movement, that should be caused by the press. (However if you would like to have rotation movement, better create the widget with the Rotary Pushbutton icon). If you need a switch-like behaviour, you can also choose it in the parameters.
- Rotary Pushbutton:
Results in the same widget as the Pushbutton, it only differs in the creation mode. Here the last selected thing must be a surface that defines the rotation axis. Dont be afraid, you can also define additional translation movement.
- Rotary Encoder:
Select the objects you would like to rotate when "turning the knob", the last selection should be a surface, that defines the rotation axis, wich goes through the center of mass of that surface. You can add pushbutton functionality to the encoder. In simulation mode the press is achieved by pressing the Cntrl key while hovering over the encoder with the mouse pinter.
- Rotary Potentiometer:
Object selection goes the same way as in the case of the Rotary Encoder, but here you have to limit the rotation in positive and negative directions.
- Linear Potentiometer:
Simply select the objects that you would like to act as a slider and push the menuitem with the linear potentiometer sign on it. You should set the boundary values in both negative and positive directions.
- LED-s:
Select the objects you want to act as a LED and press the Create LED icon
--> Final thought on widgets: The widgets save their "initial position" at creation time. Start and end distances/Angles refer to that position, and all the widgets return to that position when the document gets (re-)loaded.
-
You write your application code(in any language) FreeCAD runs a GRPC-server when hitting the green play button, our external application has to play the grpc client part, that is constatntly polling the server for widget values or it can send requests to set for example display pixel values or LED-colors. First you will need generated grpc client code for your choosen application language. Please refer to the grpc homepage to see how to create that. If your choice is python, then everything is fine, code has already been generated based on the protos/FPSimulation.proto-file by the "make"-call you have executed while doing the installation steps( hopefully :) ) It is a good thing to checkout the protos/FPSimulation.proto file, because it contains the client request calls and structures you will use to communicate with the FreeCAD grpc-server. The cool stuff about that is, you can run it from another mashine if u want, you can craft your own Arduino-lib MOCKS(that will do the grpc client stuff) to link against your Arduino-code (or u wait until I do it, because that was my original intention with this project)
-
Start simulation mode in freecad and launch application