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
{{ message }}
Repository navigation
Commit b0b2b06
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/python-ros2.mdx
+9-2Lines changed: 9 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,7 +22,7 @@ In ROS2, functionality is organised in **nodes** which exchange data by publishi
22
22
23
23
OpEn can generate ready-to-use ROS2 packages directly from a parametric optimizer. The generated package exposes the optimizer as a ROS2 node, includes the required message definitions, and provides the files needed to build, configure, and launch it inside a ROS2 workspace.
24
24
25
-
The input and output messages are the same as in the [ROS1 package documentation](./python-ros#messages).
25
+
The input message matches the [ROS1 package documentation](./python-ros#messages). The ROS2 output message additionally includes `error_code` and `error_message` fields so that invalid requests and solver failures can be reported with more detail.
26
26
27
27
## Configuration Parameters
28
28
@@ -180,6 +180,8 @@ solution:
180
180
inner_iterations: 41
181
181
outer_iterations: 6
182
182
status: 0
183
+
error_code: 0
184
+
error_message: ''
183
185
cost: 1.1656771801253916
184
186
norm_fpr: 2.1973496274068953e-05
185
187
penalty: 150000.0
@@ -198,11 +200,14 @@ solve_time_ms: 0.2175
198
200
uint8 STATUS_NOT_CONVERGED_OUT_OF_TIME=2
199
201
uint8 STATUS_NOT_CONVERGED_COST=3
200
202
uint8 STATUS_NOT_CONVERGED_FINITE_COMPUTATION=4
203
+
uint8 STATUS_INVALID_REQUEST=5
201
204
202
205
float64[] solution # solution
203
206
uint8 inner_iterations # number of inner iterations
204
207
uint16 outer_iterations # number of outer iterations
205
-
uint8 status # status code
208
+
uint8 status # coarse status code
209
+
int32 error_code # detailed error code (0 on success)
210
+
string error_message # detailed error message (empty on success)
206
211
float64 cost # cost value at solution
207
212
float64 norm_fpr # norm of FPR of last inner problem
208
213
float64 penalty # penalty value
@@ -213,6 +218,8 @@ solve_time_ms: 0.2175
213
218
```
214
219
</details>
215
220
221
+
If the request is invalid, the node publishes a result with `status: 5` (`STATUS_INVALID_REQUEST`) and fills `error_code` and `error_message`. For example, if the parameter vector has the wrong length, `error_code` is `3003` and `error_message` explains the mismatch.
222
+
216
223
Instead of starting the node with `ros2 run`, you can also use the generated launch file:
Copy file name to clipboardExpand all lines: open-codegen/CHANGELOG.md
+1Lines changed: 1 addition & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -22,6 +22,7 @@ Note: This is the Changelog file of `opengen` - the Python interface of OpEn
22
22
- Breaking change: the direct interface (Python bindings) now has an API which mirrors that of the TCP interface: the method `solve` returns either a solution or an error object. Website documentation is updated. New unit tests are implemented. Note that `solver.run()` does not return the solution object directly, but rather works in the same way as the TCP interface: it returns a response object (instance of `SolverResponse`), on which the method `.get()` returns either a `SolverStatus` or `SolverError`.
23
23
- Added helpful `__repr__` methods to generated Python binding response/status/error objects, TCP solver response/error objects, and `GeneratedOptimizer` for easier inspection and debugging
24
24
- Updated generated TCP server and C interface templates to work with the richer Rust solver error model and expose better failure information to clients
25
+
- ROS2 generated packages now publish detailed `error_code` and `error_message` fields, plus `STATUS_INVALID_REQUEST`, so invalid requests and solver failures are reported explicitly instead of being silently ignored
0 commit comments