polled_camera contains a service definition for requesting polled images, as well as C++ server/client wrappers to simplify publishing and receiving polled images.
Under the scheme used by the old Prosilica node, polling was done entirely by service call. The client called the service specifying a region of interest, and the response contained the Image and CameraInfo. This had a number of problems:
- It is difficult to debug service calls.
- The response is invisible to the rest of the system.
- Can't be bagged or played back.
- Creates inconsistency in writing image processing nodes: streaming images are processed by callback, but polled images are processed after getting them through a service call.
Colorizing and rectification was done in the driver instead of routing the raw images through image_proc. Under the new conventions, camera drivers are responsible only for publishing raw images and the corresponding camera info.
Not easily integrated with image_transport.
Under the new scheme:
The camera driver advertises a service call <camera>/request_image. The working service definition is:
# GetPolledImage.srv string response_namespace sensor_msgs/RegionOfInterest roi --- time stamp
- On receiving a request, the driver captures an image and returns its time stamp as the service response.
The Image and CameraInfo are published to <response_namespace>/image_raw and <response_namespace>/camera_info using a latching image_transport::CameraPublisher.
- Vision nodes can subscribe to and process polled images just like any other camera image stream.
When the subscriber count for a polled image topic drops to zero, the driver shuts down the corresponding CameraPublisher.
Blaise and I agreed on the service/topic structure following discussions at ticked #3180.
The new scheme requires the driver to do some bookkeeping to keep track of polled topics. This is wrapped up in the C++ helper class polled_camera::PublicationServer (API, currently lives in prosilica_camera). This handles all of the communication; the driver need only provide a callback that fills in the Image and CameraInfo messages.
Package review meeting notes
Create new package review
Enter the date in the appropriate box to generate a template for an API or code review meeting. Check the QAProcess page for more information.