Skip to content

Commit 37f49c3

Browse files
committed
Add Simulink API documentation to README
Added Simulink API section with setup and usage instructions.
1 parent 7c4bc05 commit 37f49c3

File tree

1 file changed

+33
-0
lines changed

1 file changed

+33
-0
lines changed

README.md

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@ This section describes the MATLAB API for AutoDRIVE, which can be used to develo
1414

1515
## SETUP
1616

17+
> [!NOTE]
18+
> Please skip this setup if you have already installed the [`autodrive_simulink_api`](autodrive_simulink_api).
19+
1720
1. Install the Java library:
1821
- Place the [`WebSocket-1.0.0.jar`](autodrive_matlab_api/lib/target/WebSocket-1.0.0.jar) file on the static Java class path in MATLAB by editing the `javaclasspath.txt` file (create the file if it does not exist). Run the following in MATLAB Command Window:
1922
```MATLAB
@@ -40,3 +43,33 @@ This section describes the MATLAB API for AutoDRIVE, which can be used to develo
4043
delete(autodrive)
4144
clear autodrive
4245
```
46+
47+
# Simulink API
48+
49+
<p align="justify">
50+
This section describes the Simulink API for AutoDRIVE, which can be used to develop modular as well as end-to-end autonomous driving algorithms and integrate them within a model-based systems engineering (MBSE) toolchain.
51+
</p>
52+
53+
## SETUP
54+
55+
> [!NOTE]
56+
> Please skip this setup if you have already installed the [`autodrive_matlab_api`](autodrive_matlab_api).
57+
58+
1. Install the Java library:
59+
- Place the [`WebSocket-1.0.0.jar`](autodrive_simulink_api/lib/target/WebSocket-1.0.0.jar) file on the static Java class path in MATLAB by editing the `javaclasspath.txt` file (create the file if it does not exist). Run the following in MATLAB Command Window:
60+
```MATLAB
61+
edit(fullfile(prefdir,'javaclasspath.txt'))
62+
```
63+
For example, if the location of the `jar` file is `C:\AutoDRIVE-MathWorks\autodrive_simulink_api\lib\target\WebSocket-1.0.0.jar`, then open the static class path file with the above command and add the full path to it. Make sure that there are no other lines with a `WebSocket-*` entry. You can refer to [MATLAB's Documentation](https://www.mathworks.com/help/matlab/matlab_external/static-path-of-java-class-path.html) for more information on the static Java class path.
64+
65+
After having done this, **restart MATLAB** and check that the path was read by MATLAB properly by running the `javaclasspath` command. The newly added path should appear at the bottom of the list, before the `DYNAMIC JAVA PATH` entries. Note that seeing the entry here does not mean that MATLAB necessarily found the `jar` file properly. You must make sure that the actual `jar` file is indeed available at this location.
66+
- **[OPTIONAL]** To build the `jar` file yourself, it is recommended to use [Apache Maven](https://maven.apache.org/download.cgi) (tested with version 3.8.1) with [Java Development Kit](https://www.oracle.com/java/technologies/downloads/?er=221886#java8) (tested with version 8u411). Maven will automatically take care of downloading the [`Java-WebSocket`](https://github.com/TooTallNate/Java-WebSocket) library and neatly package everything into a single file (an "uber jar") based on the [`pom.xml`](autodrive_simulink_api/lib/pom.xml). Once the `mvn` command is on your path, simply `cd` to the `lib` directory and execute the `mvn package` command.
67+
2. Add the `autodrive_simulink_api` directory to MATLAB path by right-clicking on it from MATLAB's file explorer and selecting `Add to Path` &rarr; `Selected Folders and Subfolders`.
68+
69+
## USAGE
70+
71+
Run the vehicle-specific `example` file:
72+
- [`example_roboracer.slx`](autodrive_simulink_api/example_roboracer.slx) for [RoboRacer (formerly F1Tenth)](https://roboracer.ai)
73+
74+
> [!NOTE]
75+
> The AutoDRIVE Simulink API, which is implemented as a Level-2 MATLAB S-Function, will automatically take care of creating a WebSocket server instance upon running the Simulink model and will ensure a graceful exit upon termination by stopping the server instance, deleting it, and clearing it from the memory.

0 commit comments

Comments
 (0)