zivid / zivid-ros

Official ROS driver for Zivid 3D cameras
BSD 3-Clause "New" or "Revised" License
60 stars 45 forks source link

Capture with ROS Action Client and Server #70

Open waiyc opened 2 years ago

waiyc commented 2 years ago

Any plan to include ROS action client and server as an alternative option for capturing data from Zivid camera? Due to the fact that the data capturing time varies depends on the capturing setting, it is better to use action over service? As we can expect the action server to return the capturing result or we can choose to preempt it if we need to.

torbsorb commented 2 years ago

Hi @waiyc,

As far as I understood the major difference between action and service is that actions are asynchronous, whereas services are synchronous. I can understand why it would be interesting for you, but

  1. The APIs that our ROS-services map to are synchronous today
  2. It is possible for a user to make the call asynchronous via threads, mutexes and signals. Adding actions now might bring value, but would extend our API beyond what's provided in the core language. I believe it's more important to make sure that we have full coverage of our APIs, and work on potentially providing asynchronous functionality in the core language first. Then, once that's available it makes sense to support actions.
waiyc commented 2 years ago

Hi @torbsorb ,

Thank you for the reply. My main intention is to increase the "certainty" in knowing when the capturing process is done or failed. Currently, there is no response/feedback to tell the client that the server has completed the capturing. The only way to know the capturing process is completed is by subscribing to the image topic, is my understanding correct?

apartridge commented 2 years ago

Hi @waiyc.

You could wait for the image or point cloud topics, but it would be better to check the return value of ros::service::call() function (if you use C++ API) or rospy.ServiceProxy for the Python API. These functions should be blocking until the capture service is finished and has returned either true or false.