VEXU-GHOST / VEXU_GHOST

9 stars 5 forks source link

adds timer service #49

Closed xwilson03 closed 7 months ago

xwilson03 commented 7 months ago

PR Summary

PR Link: https://github.com/VEXU-GHOST/VEXU_GHOST/pull/49

Description

Adds "start_timer" and "check_timer" services for general use.

Reviewers

Reviewer Guide

Examine service interface by looking at the requests/responses.

Is there any data missing that should be tracked? Are any variables in the service messages obscure or unapparent in meaning?

Invalid: Timer does not exist. Expired: Self

Testing

  1. Open two terminals, for Server and Client.
  2. (Server) Run ros2 run ghost_ros_interfaces timer_service
  3. (Client) Run ros2 run ghost_ros_interfaces start_timer_client.
  4. (Client) Observe that all but the last timer succeeded.
  5. (Server) Observe that the last timer failed to create due to the maximum timer limit being exceeded.
  6. Wait 5 seconds, and reperform step 3.
  7. (Client) Quickly after, run ros2 run ghost_ros_interfaces check_timer_client.
  8. (Client) Observe that the first 10 timers are valid (1) but not expired (0).
  9. Perform step 7 again in 5 seconds, and observe that the first 10 timers are still valid (1), but now expired (1).
  10. (Client) Run ros2 service call /start_timer ghost_msgs/srv/StartTimer "{timer_name: test, duration_ns: 1000000000000}" twice.
  11. (Client) Observe that the second attempt failed.
  12. (Server) Observe that the failure was due to a duplicate timer name.
  13. (Client) Run ros2 service call /check_timer ghost_msgs/srv/CheckTimer "{timer_name: doesnt_exist}"
  14. (Client) Observe that the service response was invalid.

timer_demo.webm