@@ -14,7 +14,6 @@ This Python module provides a simple RabbitMQ client to send simulation requests
14
14
- [ Steps to run an example] ( #steps-to-run-an-example )
15
15
- [ Where to find the API payload files] ( #where-to-find-the-api-payload-files )
16
16
- [ Example usage] ( #example-usage )
17
- - [ Control Commands] ( #control-commands )
18
17
19
18
## Installation
20
19
@@ -26,13 +25,15 @@ pip install pika pyyaml
26
25
27
26
## Clients
28
27
29
- Two Python scripts are provided:
28
+ Three Python scripts are provided, each matching a different simulation mode :
30
29
31
- - ** use_matlab_agent.py** – Simple client that sends a simulation request and
32
- waits for results. Use this for _ batch_ and _ streaming_ simulations.
33
- - ** use_matlab_agent_interactive.py** – Async client for _ interactive_
34
- simulations. It streams input frames to MATLAB and prints outputs as they
35
- arrive.
30
+ - ** use_matlab_agent_batch.py** – Executes a _ batch_ simulation and waits until
31
+ the final results are returned before terminating.
32
+ - ** use_matlab_agent_streaming.py** – Starts a _ streaming_ simulation where
33
+ outputs are continuously printed as they arrive.
34
+ - ** use_matlab_agent_interactive.py** – Asynchronous client for
35
+ _ interactive_ simulations. It streams input frames to MATLAB and handles
36
+ real-time results.
36
37
37
38
## Configuration
38
39
@@ -52,6 +53,12 @@ rabbitmq:
52
53
simulation_request : ../api/simulation.yaml # Default path to the simulation YAML payload
53
54
` ` `
54
55
56
+ The MATLAB wrapper classes also read their configuration from a
57
+ ` config/default.yaml` file. A template named `default.yaml.template` is
58
+ distributed with the agent under `config/`. When you run
59
+ ` matlab-agent --generate-project` , this template is copied to
60
+ ` config/default.yaml` , which the wrappers use at runtime.
61
+
55
62
# # Usage
56
63
57
64
Run the module as a standalone script to send simulation requests to the MATLAB agent and listen asynchronously for the results.
@@ -68,8 +75,9 @@ If this option is omitted, the script will look for a file named `simulation.yam
68
75
- **With CLI option:**
69
76
You can override the default by specifying a custom path to the simulation payload YAML file using the `--api-payload` option.
70
77
71
- For interactive simulations, use `use_matlab_agent_interactive.py` with the same
72
- ` --api-payload` flag. This client streams input frames based on the
78
+ For streaming simulations use `use_matlab_agent_streaming.py`. For interactive
79
+ simulations run `use_matlab_agent_interactive.py`; both scripts accept the same
80
+ ` --api-payload` flag. The interactive client streams input frames based on the
73
81
` inputs.stream_source` field and prints outputs as they arrive.
74
82
75
83
# # Example
@@ -91,9 +99,12 @@ you will find several folders containing practical examples. Each example folder
91
99
2. **Run the MATLAB agent**
92
100
Start the MATLAB agent so it is ready to receive simulation requests.
93
101
94
- 3. **Send a simulation request using the Python client**
95
- Execute the Python client with the appropriate API payload file :
96
- python use_matlab_agent.py --api-payload "path_to_api_payload"
102
+ 3. **Send a simulation request using the Python client**
103
+ Execute the client that matches your simulation type with the appropriate
104
+ API payload file :
105
+ ` python use_matlab_agent_batch.py --api-payload "path_to_api_payload"` ,
106
+ ` python use_matlab_agent_streaming.py --api-payload "path_to_api_payload"` ,
107
+ or `python use_matlab_agent_interactive.py --api-payload "path_to_api_payload"`.
97
108
98
109
> **Note:** It is recommended to use absolute paths when specifying the `--api-payload` argument to avoid path resolution issues. It is a good practice to place the path in single quotes.
99
110
@@ -120,19 +131,3 @@ To run the batch simulation example, specify the full absolute path to the paylo
120
131
` ` ` bash
121
132
python use_matlab_agent_batch.py --api-payload "/Users/foo/simulation-bridge/agents/matlab/matlab_agent/docs/examples/batch-simulation/api/simulation_batch.yaml.example"
122
133
` ` `
123
-
124
- # # Control Commands
125
-
126
- During a simulation you can remotely control the MATLAB agent by sending simple
127
- command messages via RabbitMQ. Supported commands are :
128
-
129
- - ` RUN` – clear any previous stop request and allow the simulation to run.
130
- - ` STOP` – request the currently running simulation to terminate gracefully.
131
- - ` CHECK` – query the agent status (returns `running` or `stopped`).
132
-
133
- To issue a command, publish a YAML message containing a `command` field to the
134
- agent input exchange :
135
-
136
- ` ` ` yaml
137
- command: STOP
138
- ` ` `
0 commit comments