Mock ROS services, call services, and assert requests received by mocked services.
mock_service/3 registers a scenario-owned service implementation and records
each request. Use call_service/3 for synchronous clients, then assert or
refute recorded requests with expect_service_call/2 and refute_service_call/2.
Summary
Functions
Call a service synchronously and return the response.
Assert that the mocked service received at least one new request.
Assert that the mocked service received a request matching predicate.
Register a test service implementation on the scenario node.
Assert that no new request arrives on the mocked service within the timeout.
Assert that no request matching predicate arrives within the timeout.
Functions
Call a service synchronously and return the response.
Starts a service client on the scenario node on first use. Raises on timeout or connection failure.
response = call_service "/safety/check", SafetyCheck, %SafetyCheck.Request{}
response = call_service "/safety/check", SafetyCheck, %SafetyCheck.Request{}, timeout: 3_000
Assert that the mocked service received at least one new request.
Cursor-based: previous requests already matched by earlier assertions are skipped. Returns the matching request struct.
expect_service_call "/safety/check", SafetyCheck
Assert that the mocked service received a request matching predicate.
expect_service_call "/safety/check", SafetyCheck,
fn req -> req.robot_id == "hilda_1" end
Register a test service implementation on the scenario node.
All incoming requests are recorded in the collector and forwarded to
handler. Cleanup is automatic when the scenario ends.
mock_service "/safety/check", SafetyCheck,
fn _req -> %SafetyCheck.Response{allowed: true} end
Assert that no new request arrives on the mocked service within the timeout.
refute_service_call "/delete_map", DeleteMap
Assert that no request matching predicate arrives within the timeout.
refute_service_call "/delete_map", DeleteMap, fn req -> req.force == true end