You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+33Lines changed: 33 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -14,6 +14,9 @@ This section describes the MATLAB API for AutoDRIVE, which can be used to develo
14
14
15
15
## SETUP
16
16
17
+
> [!NOTE]
18
+
> Please skip this setup if you have already installed the [`autodrive_simulink_api`](autodrive_simulink_api).
19
+
17
20
1. Install the Java library:
18
21
- 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:
19
22
```MATLAB
@@ -40,3 +43,33 @@ This section describes the MATLAB API for AutoDRIVE, which can be used to develo
40
43
delete(autodrive)
41
44
clear autodrive
42
45
```
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` → `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