Skip to content

Commit

Permalink
simulink library pics updated
Browse files Browse the repository at this point in the history
  • Loading branch information
kvasios committed Mar 5, 2024
1 parent d3bf609 commit 36edc28
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 90 deletions.
Binary file modified source/franka_matlab/_static/apply_control.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 modified source/franka_matlab/_static/block_parameters_apply_control.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/franka_matlab/_static/franka_matlab_toolbox_examples.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 modified source/franka_matlab/_static/get_duration.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 modified source/franka_matlab/_static/get_gripper_state.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 modified source/franka_matlab/_static/get_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 modified source/franka_matlab/_static/get_robot_state.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified source/franka_matlab/_static/workspace_parameters.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
62 changes: 21 additions & 41 deletions source/franka_matlab/getting_started.rst
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ You can navigate through the examples by typing:

.. code-block:: shell
>> uiopen(fullfile(franka_matlab_installation_path_get(),'examples','franka_matlab_toolbox_examples.slx'),1);
>> franka_matlab_toolbox_examples();
.. figure:: _static/franka_matlab_toolbox_examples.png
:align: center
Expand All @@ -22,38 +22,35 @@ You can navigate through the examples by typing:
Initialization
--------------

After opening, double clicking on any of the simulink models a set of parameters will be loaded automatically in the
workspace.
After opening, double clicking on any of the simulink models the robot settings will be loaded automatically in the
workspace, in the form of the object `frs`.

.. hint::

The Simulink models are delivered in R2019a version. They will convert automatically to your Matlab version
The Simulink models are delivered in R2021a version. They will convert automatically to your Matlab version
when you try to save the model.

.. figure:: _static/workspace_parameters.png
:align: center
:figclass: align-center

Working space after loading a Simulink demo.
The Franka Robot Settings object.

The robot_ip is set to 172.16.0.2 by default after loading the demos. Make sure that the robot_ip parameters matches your
setup, either by modifying it in the `demos/demos_common_config.m` matlab script file or from the cmd line after the
simulink demo is loaded, like:
The robot_ip is set to 172.16.0.2. Make sure that the robot_ip, as well as all the other parameters matches your
setup for your intended purposes.

.. code-block:: shell
>> robot_ip = <your robot ip string>
>> frs.robot_ip = <your robot ip string>
At this point we can start the building & deployment of the Simulink model.
You can modify the default settings for the FrankaRobotSettings with

Execution
---------
.. code-block:: shell
.. hint::
>> edit FrankaRobotSettings.m
The current workflow presented is utilizing the "Run on Custom Hardware" Simulink App, present in Matlab versions
:math:`\geq` R2020a. In case of Matlab 2019a you can build the model normaly by using the "Build Model" button.
You then need to run the executable from a terminal as described bellow.
Execution
---------

Let's start by selecting the `Run on custom hardware` App from the Apps pane in Simulink.

Expand All @@ -63,13 +60,10 @@ Let's start by selecting the `Run on custom hardware` App from the Apps pane in

"Run on custom hardware" Simulink App.

.. note::

The Franka Simulink Library has been tested with the Generic Real-Time Target (grt.tlc) as well as with the Embedded Coder Target (ert.tlc) in the context of the NVIDIA's Jetson Nano Hardware support package for Simulink.

.. important::

Before executing make sure that the brakes of the robot are disengaged and that the robot is in execution mode!
Before executing make sure that the brakes of the robot are disengaged, the FCI mode is activated
in Desk and that the robot is in execution mode(user button is released)!

You can then select from the Hardware tab either `Monitor & Tune` in case monitoring through the external mode is
desired or `Build, Deploy & Start` for just executing the application without monitoring.
Expand All @@ -80,18 +74,15 @@ desired or `Build, Deploy & Start` for just executing the application without mo

Hardware Simulink App.

.. hint::

As a reminder, in case of a robot with system version 4.2.0 or greater, the FCI control mode needs to be explicitly enabled through Desk --> Sidebar menu --> Activate FCI.

.. caution::

The robot will move! Make sure that you are monitoring the situation, ready to take action if necessary!

Alternatively you can run the executable, which is located in the current working space, manually.
Alternatively you can run the auto-generated executable located in the current working space manually from a terminal:

In case of Linux:


.. code-block:: shell
$ ./<simulink_model_name>
Expand All @@ -104,24 +95,13 @@ or in case of Windows:
Automatic error recovery
------------------------

.. figure:: _static/simulink_view_diagnostics.png
:align: center
:figclass: align-center

View error and other diagnostic messages in Simulink during the build, deployment and execution phases.

.. figure:: _static/terminal_error_message.png
:align: center
:figclass: align-center

Error message displayed in terminal in case of manual execution.

If the robot encounters an error state and transitions to reflex mode, you may attempt to recover by executing the `franka_automatic_error_recovery` command in Matlab.
If the robot encounters an error state and transitions to reflex mode,
you may attempt a recovery by executing the automatic error recovery command in Matlab.

.. code-block:: shell
>> franka_automatic_error_recovery(<robot ip string>);
>> fr = FrankaRobot(<robot ip as string>);
>> fr.automatic_error_recovery();
In case the command fails and the robot remains in the erroneous state try using the guiding mode to manually bring
back the robot to a valid configuration.
Expand Down
42 changes: 15 additions & 27 deletions source/franka_matlab/installation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,46 +61,34 @@ You can then install the 64bit versions of eigen3 and poco packages:
vcpkg install eigen3:x64-windows
vcpkg install poco[netssl]:x64-windows
You can now install libfranka in Windows:

After restarting the x64 Native Tools Command Prompt for VS 2017 do:

.. code-block:: winbatch
cd C:\Users\{user name}
git clone --recursive https://github.com/frankaemika/libfranka
cd libfranka
mkdir build
cmake -DCMAKE_BUILD_TYPE=Release -DBUILD_TESTS=OFF -DCMAKE_TOOLCHAIN_FILE=C:\Users\{user name}\vcpkg\scripts\buildsystems\vcpkg.cmake -G Ninja ..
ninja
.. important::
Make sure that you add the libfranka\\build folder also added in the PATH environment variable as well!
This is a necessary requirement for generating and building code with the Franka Matlab Toolbox.

Franka Matlab Toolbox Add-On Installation & License Management
--------------------------------------------------------------

For installing the Franka Matlab Toolbox, start by either double clicking on the franka_matlab.mltbx that you've received or by drag-and-dropping it to the current Matlab Command Window.

After the Franka Matlab Toolbox has been added as an Add-On the license number needs to be installed as well.
For installing the Franka Matlab Toolbox either drag-and-drop the franka_matlab.mltbx
to the current Matlab Command Window or you can use the Matlab Add-On manager.

For receiving the license number please contact Franka Emika and provide your Matlab license number.
After this process is complete simply follow the instructions in the Getting Started guided
which should have been opened after the Franka Matlab Toolbox Add-on installation.

You can find you license number by simply typing in Matlab:
In short you will need to generate a unique identifier for you PC by executing:

.. code-block:: shell
license;
franka_matlab_toolbox_uid_gen();
For installing the license you can type:
Please then send this unique identifier to Franka Robotics for receiving a License Number for
the Franka Matlab Toolbox.

You can then proceed with the final installation step, by executing:

.. code-block:: shell
franka_matlab_toolbox_install('your license number');
franka_matlab_toolbox_install('franka matlab toolbox license number as a string',['fr3' or 'gen1']);
That's it the Franka Matlab Toolbox should be ready.

In case a removal of the Franka Matlab Toolbox is desired, we recommend starting by uninstalling the current license first with:
Get a glimpse of what the capabilities of the Toolbox are by navigating through the examples provided with the Toolbox:

.. code-block:: shell
franka_matlab_toolbox_uninstall();
franka_matlab_toolbox_examples();
27 changes: 5 additions & 22 deletions source/franka_matlab/simulink_library.rst
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ on the desired control mode that is selected from the drop-down list `Control Mo
.. figure:: _static/block_parameters_apply_control.png
:align: center
:figclass: align-center
:width: 530px

Apply Control Simulink Block Settings.

Expand All @@ -33,42 +34,24 @@ on the desired control mode that is selected from the drop-down list `Control Mo
Namely the robot will move to the desirable configuration and only then the main execution of the Simulink model
will take place. You can define that in the `Initial Configuration` section of the block settings.

Get Initial Robot State
Get Robot State
-----------------------

.. figure:: _static/get_robot_state_init.png
.. figure:: _static/get_robot_state.png
:align: center
:figclass: align-center

Get initial robot state Simulink Block.

This Simulink block will only capture and deliver the initial robot state values which are present during the
initial execution step.
Get Robot State Simulink Block.

You can write the signals that you wish to capture in free text form in the `Parameters` section.
For the set of available signals --> `Robot State Attributes <https://frankaemika.github.io/libfranka/structfranka_1_1RobotState.html>`_

.. figure:: _static/get_robot_state_init_settings.png
.. figure:: _static/get_robot_state_settings.png
:align: center
:figclass: align-center

Get initial robot state Simulink Block Settings.

Get Current Robot State
-----------------------

.. figure:: _static/get_robot_state.png
:align: center
:figclass: align-center

Get current robot state Simulink Block.

This Simulink block will capture and deliver the current robot state values.

You can write the signals that you wish to capture in free text form in the `Parameters` section.
For the set of available signals -->
`Robot State Attributes <https://frankaemika.github.io/libfranka/structfranka_1_1RobotState.html>`_

Get Duration(Sample Time)
-------------------------

Expand Down

0 comments on commit 36edc28

Please sign in to comment.