|
|
The primary supported language to create your own RTIS software to run on the eRTIS devices is **Python**. There is one primary Python module available called [RTIS Dev](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home) that can be used to make your own scripts to perform both the recording and processing aspects.
|
|
|
|
|
|
This tutorial will go into how to setup a Integrated Development Environment (IDE) with PyCharm to make usage of build-in features to make the programming user friendly and quick to develop, test and run from your own computer.
|
|
|
|
|
|
Once you have setup a workflow (using this tutorial) for developing Python you can get started using [RTIS Dev](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home) and make your own RTIS scripts!
|
|
|
|
|
|
Outside of the [RTIS Dev](https://cosysgit.uantwerpen.be/rtis-software/rtisdev/-/wikis/home) module, many other Python modules are already installed on each eRTIS device. Here is a short list of popular packages that are available by default on each eRTIS device:
|
|
|
- [NumPy](https://numpy.org/doc/stable/)
|
|
|
- [SciPy](https://www.scipy.org/docs.html)
|
|
|
- [TensorFlow 2](https://www.tensorflow.org/api_docs)
|
|
|
- [Matplotlib](https://matplotlib.org/stable/contents.html)
|
|
|
- [pandas](https://pandas.pydata.org/docs/user_guide/index.html)
|
|
|
- [TensorRT](https://docs.nvidia.com/deeplearning/tensorrt/developer-guide/index.html)
|
|
|
- [OpenCV](https://docs.opencv.org/4.5.2/d6/d00/tutorial_py_root.html)
|
|
|
|
|
|
## Pycharm IDE
|
|
|
PyCharm is a (free) IDE that is very popular amongst Python developers. One of the main benefits why it is useful for developing for eRTIS devices is that it can be set up in a way to write, debug and run your code on your own computer while being connected to the eRTIS device. In other words, this allows you to do remote development from your own computer but run the code on the eRTIS device.
|
|
|
|
|
|
You can get PyCharm [here](https://www.jetbrains.com/pycharm/) for your operating system.
|
|
|
**Do note that you need the Professional edition to make use of the remote coding functionality.** University of Antwerp employees and students of FTI have access to this version for free.
|
|
|
|
|
|
To learn more about the basics of using PyCharm, please see [here](https://www.jetbrains.com/pycharm/learn/). This tutorial will only go into setting up remote coding for eRTIS usage.
|
|
|
|
|
|
## Remote Python Interpreter
|
|
|
The Python interpreter is the program that will compile and execute your Python code. In order to run the scripts you create on the eRTIS device remotely, we need to link PyCharm to the Python interpreter installed on your eRTIS device.
|
|
|
|
|
|
The Python Interpreter selector is located on the status bar. Clicking it gives you both the option to select a interpreter but also to add a new one using the **_Add Interpreter..._** option. This menu is shown in the figure below.
|
|
|
|
|
|
<img src="https://resources.jetbrains.com/help/img/idea/2021.2/py_python_interpreter_widget.png" alt="drawing" width="70%" />
|
|
|
|
|
|
On the menu that opens you should select on the left **_SSH Interpreter_**.
|
|
|
On the right choose the first option to add a _New server configuration_. Fill in the IP address of the eRTIS device together with the username that was given to you by a Cosys-Lab member (default:cosyslab).
|
|
|
For more information on discovering the IP of your eRTIS device see [here](https://cosysgit.uantwerpen.be/rtis-software/ertissoftwareusageguide/-/wikis/Initial-Connection-&-Network-Setup).
|
|
|
|
|
|
<img src="https://resources.jetbrains.com/help/img/idea/2021.2/py_interpreter_ssh_add.png" alt="drawing" width="70%" />
|
|
|
|
|
|
Click **Next** to proceed with the next configuration step.
|
|
|
In the next step fill in the password that was given to you by a Cosys-Lab member and once again press **Next** to go the final step.
|
|
|
|
|
|
<img src="https://resources.jetbrains.com/help/img/idea/2021.2/py_interpreter_ssh_password.png" alt="drawing" width="70%" />
|
|
|
|
|
|
Here you need to set the path to the Python interpreter. Fill in `/usr/bin/python3` here. You can now press **Finish**.
|
|
|
|
|
|
<img src="https://resources.jetbrains.com/help/img/idea/2021.2/py_interpreter_ssh_mappings.png" alt="drawing" width="70%" />
|
|
|
|
|
|
Do note that it is important that after you have added the Python interpreter, that you might need to select it for this project using the widget in the status bar as shown before. It will likely be listed there under it's default name `cosyslab@IP.OF.eRTIS.DEVICE`.
|
|
|
|
|
|
For more information, you can find the official tutorial [here](https://www.jetbrains.com/help/pycharm/configuring-remote-interpreters-via-ssh.html#ssh).
|
|
|
|
|
|
## Remote Deployment
|
|
|
This step will go into how to automatically upload your PyCharm project's code to the eRTIS device so it can be stored locally there. This is necessary to later on also run the code from the eRTIS device.
|
|
|
|
|
|
You can access the Deployment settings from the **Tools | Deployment | Configuration** menu in the top menu bar.
|
|
|
|
|
|
If you already followed this tutorial for adding the [remote Python interpreter](#remote-python-interpreter) you will already see a deployment server added in the list on the left side of the window. If not, you can add a new one with the plus icon on the top left, choose option _SFTP_ where you can fill in a name of your choosing.
|
|
|
|
|
|
Once you have the remote server manually added or selected the one added by the Remote Python Interpreter tutorial(will have the name `cosyslab@IP.OF.eRTIS.DEVICE` by default) you can configure it further on the right. The _Root path_ should be set to `/mnt/data` which points to the available external USB drive connected to each eRTIS device. This is the path to which all your data will be uploaded. Picking the USB drive ensures enough space for your code and data as the internal storage of the eRTIS device is much more limited.
|
|
|
The _Web server URL_ to the IP of the eRTIS device.
|
|
|
|
|
|
In order to later enable automatic deployment, make sure to set this remote server as default by selecting the eRTIS remote server in the list on the left and click the checkmark icon to mark this server as default which should make the name bold afterwards.
|
|
|
|
|
|
<img src="https://i.imgur.com/iDAoxar.png" alt="drawing" width="70%" />
|
|
|
|
|
|
On the **Mapping** tab the _Local path_ should point to the folder you wish to deploy(upload) to the eRTIS device. This is usually the path leading to this project you are making in PyCharm.
|
|
|
|
|
|
The _Deployment path_ is which sub-path of the earlier defined _Root path_ the files from the _Local path_ will be uploaded and deployed. You can choose yourself what folder structure you wish to use. _Web path_ can be left open. You can press **Ok** once finished.
|
|
|
|
|
|
<img src="https://i.imgur.com/TMtXAmQ.png" alt="drawing" width="70%" />
|
|
|
|
|
|
To make sure your deployment configuration is up and running, select **Tools | Deployment | Browse Remote Host** in the main menu, and the Remote Host tool window appears on the right of the PyCharm window.
|
|
|
|
|
|
To make all your coding work constantly up to date on the remote deployed folder, you should enable **automatic upload**. In the main menu, select **Tools | Deployment | Automatic upload**.
|
|
|
|
|
|
For more information, you can find the official tutorial [here](https://www.jetbrains.com/help/pycharm/2021.1/deploying-applications.html).
|
|
|
|
|
|
## Remote Run & Debug
|
|
|
|
|
|
With the [remote Python interpreter](#remote-python-interpreter) and [automatic deployment](#remote-deployment) configured it is now possible to run the code you created from the eRTIS device from PyCharm.
|
|
|
|
|
|
Select **Run | Edit Configurations...** on the top menu bar to open the run configuration panel. On the left you can use the plus icon to add a new _Python_ configuration. The _Script path_ should point to the full remote path of where the Python script is located that you wish to run. So this is the _Root Path_ and _Deployment path_ from earlier combined! The _Python interpreter_ should be set to the earlier configured remote interpreter. The _Working directory_ is best to also be pointed at the path of where the script/PyCharm project is located to avoid any issues. Make sure _Run with Python Console_ is disabled. Press **Ok** once finished.
|
|
|
|
|
|
<img src="https://i.imgur.com/oEt7KDA.png" alt="drawing" width="70%" />
|
|
|
|
|
|
You should now be able to run your script remotely from the eRTIS device using the remotely deployed code using the remote interpreter. This completes this tutorial on being able to work fully remote for developing your Python scripts on an eRTIS device. |
|
|
\ No newline at end of file |