Skip to content

Commit

Permalink
Prepare library for Cognex (#134)
Browse files Browse the repository at this point in the history
* wip

* Create draft PR for #125

* Cognex dataman readear, very first release ready to test with the hardware

* update packages

* wip

* wip

* reader working inside the templates simple

* VAR_IN_OUT => REF_TO

* Changed to Var_IN_OUT

* wip

* VAR_IN_OUT

* changed to VAR_INPUT and REF_TO

* some error messages added

* AxoComponent_Status inside components.abstractions

* AxoComponent_status inside components.abstractions

* AxoTextList added

* merged with dev CgnReader removed from template.simple

* some PLC code cleanup

* some .NET code cleanup

* AxoDataman rdy2 review

* cleanup and refactoring

* refactoring reference input variables

* cognex vision-some styling modification

* axunit-llvm target added

* AxoTextList warning level and error level defined by attributes inside the PLC code

* AxoTextList docu added

* Continous reading mechanism added for AxoDatamanReader

* dataman reader some bug fixed

* Excessive ResultData size checked

* AxoDataman documentation added

* optimalization of the signals updated on visu

* update packages

---------

Co-authored-by: Lukas Kytka <lukas.kytka@mts.sk>
Co-authored-by: TomKovac <TomKovac@users.noreply.github.com>
Co-authored-by: Tomas Kovac <tomas.kovac@mts.sk>
Co-authored-by: Peter Kurhajec <61538034+PTKu@users.noreply.github.com>
  • Loading branch information
5 people authored Aug 8, 2023
1 parent e634060 commit b0fb0ee
Show file tree
Hide file tree
Showing 101 changed files with 3,143 additions and 297 deletions.
1 change: 1 addition & 0 deletions cake/ApaxCmd.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ public static void ApaxClean(this BuildContext context, (string folder, string n
RedirectStandardError = false,
Silent = false
}).WaitForExit();
context.Log.Information($"apax clean finished for '{lib.folder} : {lib.name}'");
}

public static void ApaxClean(this BuildContext context, (string folder, string name, string targetIp, string targetPlatform) app)
Expand Down
2 changes: 2 additions & 0 deletions cake/BuildContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ public BuildContext(ICakeContext context, BuildParameters buildParameters)
("core", "axopen.core"),
("data", "axopen.data"),
("probers", "axopen.probers"),
("components.abstractions", "axopen.components.abstractions"),
("components.cognex.vision", "axopen.cognex.vision"),
};

public IEnumerable<(string folder, string name, string targetIp, string targetPlatform)> Integrations { get; } = new[]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# AXOpenCognexVision

The `AXOpenCognexVision` library controls and operates the vision devices from the manufacturer `Cognex`.


## AxoDataman

`AxoDataman` provides the essential control and operation of all code-reader of the `Dataman` family.

### Implementation
The `AxoDataman` is designed to be used as a member of the `AxoContext` or `AxoObject`.
Therefore its instance must be initialized with the proper `AxoContext` or `AxoObject` before any use.
Also, the hardware signals must be assigned first before calling any method of this instance.
To accomplish this, call the `Run` method cyclically with the proper variables (i.e. inside the `Main` method of the relevant `AxoContext`) as in the example below:

**Example of the initialization and hardware signal assignement**
[!code-smalltalk[](../../../../src/integrations/ctrl/src/Examples/AXOpen.Cognex.Vision/AxoCognexVisionDatamanExample.st?name=HWIO_Assignement)]

There are three public methods to operate the `AxoDataman`:

`Restore` - restores the state of the `AxoDataman` to the initial state and resets all the internal variables.

`ClearResultData` - resets the data read and confirms the data received from the device.
**Example of using ClearResultData method**
[!code-smalltalk[](../../../../src/integrations/ctrl/src/Examples/AXOpen.Cognex.Vision/AxoCognexVisionDatamanExample.st?name=ClearResultData)]

`Read` - triggers the reading sequence and waits for results.
**Example of using Read method**
[!code-smalltalk[](../../../../src/integrations/ctrl/src/Examples/AXOpen.Cognex.Vision/AxoCognexVisionDatamanExample.st?name=Read)]

7 changes: 7 additions & 0 deletions docfx/articles/components/AXOPENCOGNEVISION/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# AXOpenCognexVision

The `AXOpenCognexVision` library controls and operates the vision devices from the manufacturer `Cognex`.

# VERSIONS
[!INCLUDE [V_6_0_0_0](AXOPENCOGNEVISION_V_6_0_0_0.md)]

9 changes: 9 additions & 0 deletions docfx/articles/components/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#**AXOpen.Components**

**AXOpen.Components** is a group of libraries providing control of the individual types of devices grouped by the
manufacturer and the function group.

# General rules and conventions
[!INCLUDE [Conventions](../guidelines/components.md)]
[!INCLUDE [AXOPENCOGNEVISION](AXOPENCOGNEVISION/README.md)]

35 changes: 35 additions & 0 deletions docfx/articles/core/AXOTEXTLIST.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# AxoTextList

AxoTextList provides displaying the string value from the list defined in the extended class inside the `.NET` twin based on the numerical value read out from the PLC.
Moreover, the display form could also change the background colour with the numerical value change. To achieve this, the attributes `WarningLevel` and `ErrorLevel` need to be declared as in the following example.
[!code-smalltalk[](../../../src/integrations/ctrl/src/Examples/AxoTextList/AxoTextListExample.st?name=AxoTextListWithLevelsDefined)]
The final text displayed in the UI application will be `static prefix`+[`text value from text list`(Id)](for example `Description : ` + [TextList(Id)]).
The static prefix is optional. Use the following example to display the same text list without static prefix and with different levels.
[!code-smalltalk[](../../../src/integrations/ctrl/src/Examples/AxoTextList/AxoTextListExample.st?name=AxoTextListWithoutPrefix)]
If the `WarningLevel` is greater than 0 and the `ErrorLevel` is greater than the `WarningLevel`, all items with the `Id` lower than the `WarningLevel` are displayed with the `Primary` background, all items with the `Id` greater or equal to the `WarningLevel` and lower then the `ErrorLevel` are displayed with the `Warning` background and all the rest are displayed with the `Danger` background. The final colours depend on the style used.
If the attributes `WarningLevel` and `ErrorLevel` are not declared as in the following example, all items are displayed with the `Primary` background.
[!code-smalltalk[](../../../src/integrations/ctrl/src/Examples/AxoTextList/AxoTextListExample.st?name=AxoTextListWithoutLevelsDefined)]

For each `AxoTextList`, there must be a defined property, named exactly as in the `Attributes` inside the examples above. It must be defined in the extended class that the particular `AxoTextList` is a member of.
This property must return a string value from the dictionary defined in the same class based on the numerical value of the `Id` variable.

Declaration of the dictionary:
[!code-csharp[](../../../src/integrations/src/AXOpen.Integrations/AxoTextListExample/AxoTextListExampleContext.cs?name=DeclarationOfTheDictionary)]

Filling the items of the dictionary:
[!code-csharp[](../../../src/integrations/src/AXOpen.Integrations/AxoTextListExample/AxoTextListExampleContext.cs?name=FillingTheItemsOfTheDictionary)]

Returning the string item from the dictionary:
[!code-csharp[](../../../src/integrations/src/AXOpen.Integrations/AxoTextListExample/AxoTextListExampleContext.cs?name=ReturningTheItemBasedOnId)]

Complete example for two different `AxoTextList`:
[!code-csharp[](../../../src/integrations/src/AXOpen.Integrations/AxoTextListExample/AxoTextListExampleContext.cs?range=1-71)]

**How to visualize `AxoTextList`**

On the UI side, to visualize the `AxoTextList`, use the `RenderableContentControl` and set its Context according to the placement of the instance of the `AxoTextList`.
[!code-csharp[](../../../src/integrations/src/AXOpen.Integrations.Blazor/Pages/AxoTextList/AxoTextListExample.razor?name=UI)]

The displayed result should look like this:

![Alt text](~/images/AxoTextListExampleVisu.gif)
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,21 @@
| REVISION | DATE | NOTES |
|----------|-----------|-----------------|
| 0.0 | June 2023 | Initial release |
| 0.1 | August 2023 | Initial release |


This document describes the format and practices for writing components in TcOpen. These are universal rules to observe. Each rule knows exception when there is a reasonable argument behind it.


## General rules

## Library placement

Library must be placed in `src` folder of the repository. The containing folder should be named `components`.[manufacturer].[function_group] (e.g. components.cognex.vision).

### Abstractions

Each component should implement basic contract interface defined in the `AxoAbstractions` library (e.g. `AxoAbbRobot` should implenent `IAxoRobot`, `AxoCongexReader` should impement `IAxoReader`)
Each component should implement basic contract interface defined in the `AxoAbstractions` library (e.g. `AxoAbbRobot` should implenent `IAxoRobot`, `AxoCognexReader` should impement `IAxoReader`)

### I/O variables

Expand Down
10 changes: 10 additions & 0 deletions docfx/articles/toc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@
href: ~/articles/core/AXODIALOG.md
- name: AxoAlertDialog
href: ~/articles/core/AXOALERTDIALOG.md
- name: AxoTestList
href: ~/articles/core/AXOTEXTLIST.md
- name: AXOpen.Data
href: ~/articles/data/README.md
items:
Expand All @@ -39,6 +41,14 @@
items:
- name: AxoMessenger
href: ~/articles/messaging/AXOMESSENGER.md
- name: AXOpen.Components
href: ~/articles/components/README.md
items:
- name: AxoCognexVision
href: ~/articles/components/AXOPENCOGNEVISION/README.md
items:
- name: V_6_0_0_0
href: ~/articles/components/AXOPENCOGNEVISION/AXOPENCOGNEVISION_V_6_0_0_0.md
- name: AXOpen.Logging
href: ~/articles/logging/README.md
items:
Expand Down
Binary file added docfx/images/AxoTextList.PNG
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 4 additions & 1 deletion src/AXOpen-packable-only.slnf
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,17 @@
"projects": [
"abstractions\\src\\AXOpen.Abstractions\\ix_ax_axopen_abstractions.csproj",
"base\\src\\AXOpen.Base.Abstractions\\AXOpen.Base.Abstractions.csproj",
"components.abstractions\\src\\AXOpen.Components.Abstractions\\ix_ax_axopen_components_abstractions.csproj",
"components.cognex.vision\\src\\AXOpen.Cognex.Vision.Blazor\\axopen_cognex_vision_blazor.csproj",
"components.cognex.vision\\src\\AXOpen.Cognex.Vision\\ix_ax_axopen_cognex_vision.csproj",
"core\\src\\AXOpen.Core.Blazor\\axopen_core_blazor.csproj",
"core\\src\\AXOpen.Core\\ix_ax_axopen_core.csproj",
"data\\src\\AXOpen.Data.Blazor\\axopen_data_blazor.csproj",
"data\\src\\AXOpen.Data\\ix_ax_axopen_data.csproj",
"data\\src\\repositories\\InMemory\\AXOpen.Data.InMemory.csproj",
"data\\src\\repositories\\Json\\AXOpen.Data.Json.csproj",
"data\\src\\repositories\\MongoDb\\AXOpen.Data.MongoDb.csproj",
"data\\src\\repositories\\RavenDb\\AXOpen.Data.RavenDb\\AXOpen.Data.RavenDb.csproj",
"data\\src\\repositories\\RavenDb\\AXOpen.Data.RavenDb\\AXOpen.Data.RavenDb.csproj",
"probers\\src\\AXOpen.Probers\\ix_ax_axopen_probers.csproj",
"utils\\src\\AXOpen.Utils\\ix_ax_axopen_utils.csproj"
]
Expand Down
41 changes: 41 additions & 0 deletions src/AXOpen.sln
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,29 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Security.Blazor", "s
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "AXOpen.Security", "security\src\AXOpen.Security\AXOpen.Security.csproj", "{52B6EFDD-8FF9-4FA7-9624-2E7D8EEDD5C1}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "components.abstractions", "components.abstractions", "{7B7AAED6-B6BF-46B5-80FF-0AE11B4D0039}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{5107F409-9BF4-4066-A73D-DABBCBEA096C}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ix_ax_axopen_components_abstractions", "components.abstractions\src\AXOpen.Components.Abstractions\ix_ax_axopen_components_abstractions.csproj", "{863F8789-8441-492F-B5B1-D647B4EE370E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".config", ".config", "{2B02D701-3632-4D58-9B5B-E43D9E556ACB}"
ProjectSection(SolutionItems) = preProject
templates.simple\.config\dotnet-tools.json = templates.simple\.config\dotnet-tools.json
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "components.cognex.vision", "components.cognex.vision", "{31669443-69E7-4D8F-9800-E71887684792}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{7A82F34B-A479-47D4-8FB6-F9A66FE6591A}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tests", "tests", "{E2BFDC17-38C1-43AD-9CB5-4FA440D2DEEA}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ix_ax_axopen_cognex_vision", "components.cognex.vision\src\AXOpen.Cognex.Vision\ix_ax_axopen_cognex_vision.csproj", "{38B11CA7-A8CB-4B95-B123-92D3559CC1D2}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "axopen_cognex_vision_blazor", "components.cognex.vision\src\AXOpen.Cognex.Vision.Blazor\axopen_cognex_vision_blazor.csproj", "{4D4B57A7-55C4-4AE2-8991-250937389412}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "axopen_cognex_vision_tests", "components.cognex.vision\tests\AXOpen.Cognex.Vision.Tests\axopen_cognex_vision_tests.csproj", "{D3094A68-880C-4637-8F90-6034951E141B}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -267,6 +285,22 @@ Global
{52B6EFDD-8FF9-4FA7-9624-2E7D8EEDD5C1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{52B6EFDD-8FF9-4FA7-9624-2E7D8EEDD5C1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{52B6EFDD-8FF9-4FA7-9624-2E7D8EEDD5C1}.Release|Any CPU.Build.0 = Release|Any CPU
{863F8789-8441-492F-B5B1-D647B4EE370E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{863F8789-8441-492F-B5B1-D647B4EE370E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{863F8789-8441-492F-B5B1-D647B4EE370E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{863F8789-8441-492F-B5B1-D647B4EE370E}.Release|Any CPU.Build.0 = Release|Any CPU
{38B11CA7-A8CB-4B95-B123-92D3559CC1D2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{38B11CA7-A8CB-4B95-B123-92D3559CC1D2}.Debug|Any CPU.Build.0 = Debug|Any CPU
{38B11CA7-A8CB-4B95-B123-92D3559CC1D2}.Release|Any CPU.ActiveCfg = Release|Any CPU
{38B11CA7-A8CB-4B95-B123-92D3559CC1D2}.Release|Any CPU.Build.0 = Release|Any CPU
{4D4B57A7-55C4-4AE2-8991-250937389412}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4D4B57A7-55C4-4AE2-8991-250937389412}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4D4B57A7-55C4-4AE2-8991-250937389412}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4D4B57A7-55C4-4AE2-8991-250937389412}.Release|Any CPU.Build.0 = Release|Any CPU
{D3094A68-880C-4637-8F90-6034951E141B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D3094A68-880C-4637-8F90-6034951E141B}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D3094A68-880C-4637-8F90-6034951E141B}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D3094A68-880C-4637-8F90-6034951E141B}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -322,7 +356,14 @@ Global
{1EC46148-A114-4018-92BE-93F1E0273A33} = {FFD509A8-8D3C-4756-9B2E-10A063A246E9}
{7DEF0B7B-0F6C-4829-A1A9-2C0C2720BF3C} = {8017588A-7145-460D-ACEB-402D7005DA33}
{52B6EFDD-8FF9-4FA7-9624-2E7D8EEDD5C1} = {8017588A-7145-460D-ACEB-402D7005DA33}
{5107F409-9BF4-4066-A73D-DABBCBEA096C} = {7B7AAED6-B6BF-46B5-80FF-0AE11B4D0039}
{863F8789-8441-492F-B5B1-D647B4EE370E} = {5107F409-9BF4-4066-A73D-DABBCBEA096C}
{2B02D701-3632-4D58-9B5B-E43D9E556ACB} = {0F11518E-CCE1-4B0E-A56D-66D8968EC717}
{7A82F34B-A479-47D4-8FB6-F9A66FE6591A} = {31669443-69E7-4D8F-9800-E71887684792}
{E2BFDC17-38C1-43AD-9CB5-4FA440D2DEEA} = {31669443-69E7-4D8F-9800-E71887684792}
{38B11CA7-A8CB-4B95-B123-92D3559CC1D2} = {7A82F34B-A479-47D4-8FB6-F9A66FE6591A}
{4D4B57A7-55C4-4AE2-8991-250937389412} = {7A82F34B-A479-47D4-8FB6-F9A66FE6591A}
{D3094A68-880C-4637-8F90-6034951E141B} = {E2BFDC17-38C1-43AD-9CB5-4FA440D2DEEA}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {292B45BE-E9CB-443B-979D-C0AFCD8D5675}
Expand Down
8 changes: 8 additions & 0 deletions src/components.abstractions/ctrl/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
.apax
.env
bin

obj
testresult

*.apax.tgz
1 change: 1 addition & 0 deletions src/components.abstractions/ctrl/AXSharp.config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"OutputProjectFolder":"..\\src\\AXOpen.Components.Abstractions"}
15 changes: 15 additions & 0 deletions src/components.abstractions/ctrl/apax.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: "@ix-ax/axopen.components.abstractions"
version: '0.1.4-alpha.79'
type: lib
targets:
- axunit-llvm
- llvm
files:
- src
devDependencies:
"@ax/sdk": ^4.0.3
scripts:
postbuild:
- dotnet ixc
dependencies:
"@ix-ax/axopen.core": '0.1.4-alpha.79'
11 changes: 11 additions & 0 deletions src/components.abstractions/ctrl/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 17 additions & 0 deletions src/components.abstractions/ctrl/src/AxoComponent_Status.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
USING AXOpen.Core;

NAMESPACE AXOpen.Components.Abstractions
CLASS PUBLIC AxoComponent_Status
VAR PUBLIC
{#ix-attr:[Container(Layout.Stack)]}
{#ix-set:AttributeName = "ActionDescription: |[[1]ActionDescription]|"}
{#ix-attr:[WarningLevel(600)]}
{#ix-attr:[ErrorLevel(700)]}
Action : AXOpen.Core.AxoTextList;
{#ix-set:AttributeName = "ErrorDescription: |[[1]ErrorDescription]|"}
{#ix-attr:[WarningLevel(600)]}
{#ix-attr:[ErrorLevel(700)]}
Error : AXOpen.Core.AxoTextList;
END_VAR
END_CLASS
END_NAMESPACE
7 changes: 7 additions & 0 deletions src/components.abstractions/ctrl/src/IAxoCodeReader.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
USING AXOpen.Core;
NAMESPACE AXOpen.Components.Abstractions
INTERFACE PUBLIC IAxoCodeReader
METHOD ClearResultData : IAxoTaskState END_METHOD
METHOD Read : IAxoTaskState END_METHOD
END_INTERFACE
END_NAMESPACE
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
using System.Runtime.CompilerServices;

[assembly:InternalsVisibleTo("axopen_core_tests")]
Loading

0 comments on commit b0fb0ee

Please sign in to comment.