Mock ROS action servers, send goals, and assert action activity.
mock_action/3 records incoming goals, feedback, and results. Use send_goal/3
to invoke an action server, and use the expect_* and refute_goal assertions
to verify the recorded action lifecycle.
Summary
Functions
Assert that the mocked action produced a new feedback message.
Assert that the mocked action produced feedback matching predicate.
Assert that the mocked action server received a new goal.
Assert that the mocked action server received a goal matching predicate.
Assert that the mocked action produced a result.
Assert that the mocked action produced a result matching predicate.
Register a test action server implementation on the scenario node.
Assert that no new goal is submitted to the mocked action server.
Assert that no goal matching predicate is submitted.
Send a goal to an action server and return the goal UUID.
Functions
Assert that the mocked action produced a new feedback message.
expect_feedback "/navigate", Navigate
Assert that the mocked action produced feedback matching predicate.
expect_feedback "/navigate", Navigate, fn fb -> fb.progress == 100 end
Assert that the mocked action server received a new goal.
expect_goal "/navigate", Navigate
Assert that the mocked action server received a goal matching predicate.
expect_goal "/navigate", Navigate, fn goal -> goal.x == 10 end
Assert that the mocked action produced a result.
expect_result "/navigate", Navigate
Assert that the mocked action produced a result matching predicate.
expect_result "/navigate", Navigate, fn result -> result.success end
Register a test action server implementation on the scenario node.
Goals, feedback, and results are all recorded in the collector. The
handler receives (goal, publish_feedback) and must return a result struct.
Cleanup is automatic when the scenario ends.
mock_action "/navigate", Navigate, fn goal, publish_feedback ->
publish_feedback.(%Navigate.Feedback{progress: 50})
publish_feedback.(%Navigate.Feedback{progress: 100})
%Navigate.Result{success: true}
end
Assert that no new goal is submitted to the mocked action server.
refute_goal "/navigate", Navigate
Assert that no goal matching predicate is submitted.
refute_goal "/navigate", Navigate, fn goal -> goal.x < 0 end
Send a goal to an action server and return the goal UUID.
Starts an action client on the scenario node on first use.
goal_uuid = send_goal "/navigate", Navigate, %Navigate.Goal{x: 10, y: 20}