Skip to content

Commit

Permalink
FT working model (#2)
Browse files Browse the repository at this point in the history
  • Loading branch information
triccyx authored Apr 14, 2021
1 parent 99ab66f commit cf53336
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 5 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ build*
*.autosave
slprj*
*.zip
*_ert_rtw
*_ert_rtw
40 changes: 36 additions & 4 deletions ft_sensor/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# 1. Introduction
This folder contains the Simulink model for the Force-Torque sensor firmware.

<img src="assets/model001.png" width="600px">
<img src="assets/model.png" width="600px">

The model is used for code generation.

Expand All @@ -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**.
Expand All @@ -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.

<br><br>
Expand All @@ -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*

<img src="assets/conf-02.png" width="600px">


From *Code Generation->Interface*, select `Row-major` in **array layout**

<img src="assets/conf-01.png" width="600px">

From *Math and data Types->Interface*, select `Use algorithms optimized ...`

<img src="assets/conf-03.png" width="600px">

### 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**

<img src="assets/optimization.png" width="600px">

# 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.

<img src="assets/public-parameters.png" width="600px">
Binary file modified ft_sensor/adc2ft.sldd
Binary file not shown.
Binary file added ft_sensor/assets/conf-01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ft_sensor/assets/conf-02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ft_sensor/assets/conf-03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added ft_sensor/assets/model.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed ft_sensor/assets/model001.png
Binary file not shown.
Binary file added ft_sensor/assets/optimization.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit cf53336

Please sign in to comment.