diff --git a/.gitignore b/.gitignore index de3f382f..fe0cf02a 100644 --- a/.gitignore +++ b/.gitignore @@ -5,4 +5,4 @@ build* *.autosave slprj* *.zip -*_ert_rtw \ No newline at end of file +*_ert_rtw diff --git a/ft_sensor/README.md b/ft_sensor/README.md index d420c270..80217158 100644 --- a/ft_sensor/README.md +++ b/ft_sensor/README.md @@ -1,7 +1,7 @@ # 1. Introduction This folder contains the Simulink model for the Force-Torque sensor firmware. - + The model is used for code generation. @@ -16,6 +16,7 @@ The model is used for code generation. # 3. The model The model implements the conversion from ADC raw values to Force-Torque values in the Strain2 sensor. +The calculations inside the model are performed in single-precision (4 bytes). ## 3.1. Input ADC raw values are an array of 6 values, 16 bit each, type: **unsigned**. @@ -26,9 +27,11 @@ The output is back-compatible with the current YARP implementation. ## 3.3. Parameters - Conversion matrix dimensions 6x6, 16 bit each, type: **integer**. -- Offset dimensions 6x1, 16 bit each, type: **unsigned**. +- Offset dimensions 6x1, 16 bit each, type: **integer**. # 4. Code generation + +## 4.1. Base operations In order to generate the C++ code, open the `Embedded Coder` application on Simulink tab.

@@ -41,10 +44,39 @@ Set the correct parameters in `C/C++ Settings --> Code generation settings --> S Finally, use the `Generate code` button. +## 4.2. Advanced operations settings + +### 4.2.1. Matrix calculation for rows +This setting in essential for the correct code generation for matrix multiplication. +In the firmware memory at the moment the matrix is stored as a raws array. + +Select the following options: + +From *c++CODE->Settings* + + + + +From *Code Generation->Interface*, select `Row-major` in **array layout** + + + +From *Math and data Types->Interface*, select `Use algorithms optimized ...` + + + +### 4.2.2. Disable optimization for cast problems +Select the following options: + +From *c++CODE->Settings* +From *Code Generation->Optimization*, select `Minimum (debugging)` in **Level** + + + # 5. Note ## 5.1. Public parameters -The parameters needs to have public access. -To specify that, click on the `Code Interface` button of tha App and then the `Model parameters` option. +The parameters need to have public access. +To specify that, click on the `Code Interface` button of the App and then the `Model parameters` option. diff --git a/ft_sensor/adc2ft.sldd b/ft_sensor/adc2ft.sldd index b33237cb..dfaf54f4 100644 Binary files a/ft_sensor/adc2ft.sldd and b/ft_sensor/adc2ft.sldd differ diff --git a/ft_sensor/assets/conf-01.png b/ft_sensor/assets/conf-01.png new file mode 100644 index 00000000..ebad193f Binary files /dev/null and b/ft_sensor/assets/conf-01.png differ diff --git a/ft_sensor/assets/conf-02.png b/ft_sensor/assets/conf-02.png new file mode 100644 index 00000000..deb9c391 Binary files /dev/null and b/ft_sensor/assets/conf-02.png differ diff --git a/ft_sensor/assets/conf-03.png b/ft_sensor/assets/conf-03.png new file mode 100644 index 00000000..79597cc4 Binary files /dev/null and b/ft_sensor/assets/conf-03.png differ diff --git a/ft_sensor/assets/model.png b/ft_sensor/assets/model.png new file mode 100644 index 00000000..d21b5d1b Binary files /dev/null and b/ft_sensor/assets/model.png differ diff --git a/ft_sensor/assets/model001.png b/ft_sensor/assets/model001.png deleted file mode 100644 index 0c06460d..00000000 Binary files a/ft_sensor/assets/model001.png and /dev/null differ diff --git a/ft_sensor/assets/optimization.png b/ft_sensor/assets/optimization.png new file mode 100644 index 00000000..98040671 Binary files /dev/null and b/ft_sensor/assets/optimization.png differ