Using IP multicast
When sending images from your GigE Vision camera to multiple computers, the overall bandwidth requirements can be significant; this can lead to significantly reduced network performance for other computers on your network. One way to reduce the bandwidth requirements, without reducing the overall frame rate or image size, is to use IP multicast between your GigE Vision camera and your computers' Gigabit Ethernet network adapter.
IP multicast is a method of sending data from one computer to a group of computers (on the Internet or on local networks) in a single transmission. Streaming media applications often use multicasting on the Internet or on private networks. Using IP multicast, a GigE Vision-compliant camera can stream data to multiple destinations without having to send multiple copies of the data; in this case, the network routers and Ethernet switches perform the data replication instead. On a local network, the Internet Group Management Protocol (IGMP) typically controls multicast delivery. In a typical network, IGMP resides on a router.
With IP multicasting, beside the camera having its own IP address, the camera is also assigned a multicast IP address. The camera sends its multicast stream to the multicast IP address. Each computer that waits to receive this multicast stream, joins the group associated with the multicast IP address (called a multicast group). Each computer must either know the multicast IP address used by the camera or have the camera's IP address and access to read the camera's settings to establish the multicast address. Each computer communicates with its networks' multicast service (typically implemented in a router) to join the list of destinations for the particular multicast group through the Zebra GigE Vision driver. This list of destinations that a multicast stream is sent to is known as a distribution tree. When the camera sends its multicast stream to the multicast address, the stream is forwarded through your network, according to the distribution tree stored on each router or switch, until it reaches the Ethernet switch closest to one or more destination computers. Once there, the image stream is sent directly to the destination computer and not to all computers attached to the Ethernet switch (as would be the case with an IP broadcast). The Ethernet routers on your network manage additions and deletions to the multicast group and its associated distribution tree; and translate the multicast IP address into multiple IP addresses using IGMP.
A multicast address is an IP address within a predetermined range from 224.0.0.0 to 239.255.255.255. This predetermined range and its subnets have been established by the Internet Engineering Task Force (IETF) best current practice document and are defined in RFC 5771 and RFC 2365. If you allocate a digitizer for a GigE Vision camera and specify the camera should use IP multicast (that is, be in multicast mode), the Zebra GigE Vision driver selects a multicast address in the 239.0.0.0 to 239.255.255.255 range; this is a range of IP addresses that is not used on the Internet. If you use an IP address outside this range (but inside the predetermined multicast IP range), conflicts are more likely to occur. If your IGMP-aware device (that is, a router, switch, or server) uses a different range of IP addresses, you can reset Aurora Imaging Library's multicast IP addresses using MdigControl with M_GC_STREAM_CHANNEL_MULTICAST_ADDRESS_STRING (for the image stream) and M_GC_MESSAGE_CHANNEL_MULTICAST_ADDRESS_STRING (for the message stream).
Note, when using IP multicast to stream images from the camera to several computers, you must allocate a multicast controller digitizer on one computer for the GigE Vision-compliant camera, and allocate a multicast worker digitizer or a monitor digitizer on one or more different computers for the same camera. The Aurora Imaging Library application that allocates the multicast controller digitizer is the only one that can modify the camera's settings. The Aurora Imaging Library application that allocates the multicast worker digitizer can only inquire the camera's settings, receive the image stream and GigE Vision messages (events), and request stream packets be resent. The Aurora Imaging Library application that allocates a multicast monitor digitizer can do everything that the multicast worker digitizer can do, except inquire the camera's settings.
[Image: BSN_GigE_Vision_Multicast_Controller_Worker_Monitor.png]
To use IP multicast with your cameras, the following considerations should be taken:
- You need a network consisting of a GigE Vision-compliant camera, an Ethernet switch (with IGMP enabled), and at least two computers (each with their own Gigabit Ethernet network adapter).
- Only one computer can have an Aurora Imaging Library application that allocates a multicast controller digitizer. This application is the only one that can control, read from, write to, and receive the image stream from the camera.
- One or more computers can have an Aurora Imaging Library application that allocates a multicast worker or monitor digitizer. These applications can read settings and information from (multicast worker digitizer only) and receive the image stream from the camera.
Two channels are considered when using IP multicast on your camera: a stream channel and a message channel. This section predominantly focuses on the stream channel. The message channel is similarly configured as the stream channel (in that it also has a multicast IP address and port). The message channel carries GigE Vision messages from the camera and is available only if the camera manufacturer has enabled the feature. GigE Vision messages are camera-specific. Refer to your camera's documentation for more information.
Configuring a multicast controller
The multicast controller digitizer behaves like a standard Aurora Imaging Library digitizer. A multicast controller digitizer assigns the multicast address of the cameras's stream channel and the multicast address of the message channel (if supported). Once configured, the multicast controller digitizer receives images and GigE Vision messages from the camera through its multicast addresses.
By default, if the digitizer was allocated using M_DEVn, the multicast controller digitizer sets the IP multicast address to be 239.255.0.(n+1). For example, if you allocate a multicast controller digitizer using M_DEV0, the multicast addresses used will be: 239.255.0.1 for the stream channel, and 239.255.1.1 for the message channel. For a multicast controller digitizer allocated using M_DEV15 (provided you have 16 or more cameras connected to your computer), the addresses used will be 239.255.0.16 for the stream channel, and 239.255.1.16 for the message channel.
To allocate and use a multicast controller digitizer, perform the following:
- Allocate the multicast controller digitizer using
MdigAllocwithM_GC_MULTICAST_CONTROLLER. - In the case of an IP conflict between the Aurora Imaging Library-determined multicast IP address and a multicast IP address already in use on your network, you can change the multicast IP address and its associated port number using
MdigControlwithM_GC_STREAM_CHANNEL_MULTICAST_ADDRESS_STRINGandM_GC_LOCAL_STREAM_PORT(for the image stream) orM_GC_MESSAGE_CHANNEL_MULTICAST_ADDRESS_STRINGandM_GC_LOCAL_MESSAGE_PORT(for the message stream). - Configure your grab and any required processing, according to your specifications.
- Use either
MdigGrab,MdigGrabContinuous, orMdigProcessto grab the image with the multicast controller digitizer; the network switches and routers will direct the image stream from the GigE Vision camera to all the members of the multicast group (that is, the multicast controller, and any multicast workers and monitor digitizers in your network).
Configuring one or more multicast workers
The multicast worker is restricted in what it can do. A worker digitizer can get information (using MdigInquireFeature or MdigInquire) and GigE Vision messages (using hooked-functions and MdigGetHookInfo), from a camera, but it cannot set values on the camera (using MdigControlFeature or MdigControl). In addition, it can receive the images that the camera is transmitting to the multicast controller computer; to do so, the multicast worker must call MdigGrab, MdigGrabContinuous, or MdigProcess.
A multicast worker digitizer is typically used to view images on a secondary station and as such, data integrity is not typically critical. A worker digitizer can issue packet resend requests (if supported by your camera). Packet resend requests are issued when missing packets are detected. Due to the nature of multicast, resent packets will be forwarded to all members of the multicast group (the controller, worker, and monitor digitizers). Disable packet resend on the worker digitizer; this eliminates the possibility that packet resend requests, issued by the worker, affect acquisition reliability on the controller. To prevent a worker digitizer from issuing packet resend requests, you can use MdigControl on the worker digitizer with M_GC_PACKET_RESEND set to M_DISABLE. You must set this control type before calling MdigGrab, MdigGrabContinuous, or MdigProcess. Disabling packet resends on the worker digitizer does not prevent packet resends on the controller digitizer.
The multicast worker digitizer's DCF (passed to MdigAlloc) is not used. A multicast worker digitizer can receive events, and acquire images from the camera. However, the worker digitizer can perform image acquisition only after another computer (with the controller digitizer) initiates a grab and the camera is streaming data. If the controller digitizer has not initiated image acquisition, the worker digitizer will not receive an image when issuing a grab command (using MdigGrab, MdigGrabContinuous or MdigProcess); instead it will wait. To avoid waiting indefinitely, set a worker digitizer's M_GRAB_TIMEOUT to an appropriate amount of time.
To allocate and use a multicast worker digitizer, perform the following:
- Allocate the multicast worker digitizer using
MdigAllocwithM_GC_MULTICAST_WORKER. - Verify that the multicast controller is still connected to the camera, using
MdigInquirewithM_GC_MULTICAST_CONTROLLER_CONNECTED. If the multicast controller digitizer disconnects, useM_GC_MULTICAST_CONTROLLER_CONNECTEDperiodically to establish when it reconnects; then, update the multicast worker digitizer's information usingMdigControlwithM_GC_UPDATE_MULTICAST_INFO. - While the multicast controller is grabbing, use either
MdigGrab,MdigGrabContinuous, orMdigProcesswith the multicast worker digitizer to grab the image from the image stream.
Configuring one or more multicast monitors
A multicast monitor is more restricted than a multicast worker, since it is allocated without the right to read or modify the camera's settings. Multicast monitor digitizers can still send packet resend requests (if supported by your GigE Vision camera), receive image streams and GigE Vision messages, just like a multicast worker, but it cannot query the camera to get its multicast IP address, port address, or query the image size or pixel format before the first frame is grabbed. Due to this, you must set some information manually for the multicast monitor digitizer. Use a multicast monitor in situations where your Aurora Imaging Library system cannot query the multicast IP address from the GigE Vision camera due to security restrictions on your network.
Note that, if your GigE Vision camera is in chunk mode, it cannot be used with a multicast monitor.
To allocate and use a multicast monitor digitizer, perform the following:
- Allocate the multicast monitor digitizer using
MdigAllocwithM_GC_MULTICAST_MONITOR. Note that you cannot allocate a monitor digitizer if your camera is in chunk-mode. - Specify the multicast IP address that the multicast controller digitizer has assigned to the camera to carry messages (events). To do so, use
MdigControlwithM_GC_MESSAGE_CHANNEL_MULTICAST_ADDRESS_STRING. - Specify the multicast UDP port that the multicast controller digitizer has assigned to the camera to carry messages. To do so, use
MdigControlwithM_GC_LOCAL_MESSAGE_PORT. - Specify the multicast IP address that the multicast controller digitizer has assigned to the camera to carry images. To do so, use
MdigControlwithM_GC_STREAM_CHANNEL_MULTICAST_ADDRESS_STRING. - Specify the multicast UDP port that the multicast controller digitizer has assigned to the camera to carry images. To do so, use
MdigControlwithM_GC_LOCAL_STREAM_PORT. - Update the multicast information for the multicast monitor digitizer, using
MdigControlwithM_GC_UPDATE_MULTICAST_INFO. Note that with a multicast monitor digitizer, you cannot detect when the controller digitizer disconnects. - Set the X-size, Y-size, and pixel format of the grab image for the digitizer, using
MdigControlwithM_SOURCE_SIZE_X,M_SOURCE_SIZE_Y, andM_GC_PIXEL_FORMAT, respectively. Alternatively, you can set these values in the DCF (for an example, see the gigevision_multicast_monitor.dcf). - While the multicast controller is grabbing, use either
MdigGrab,MdigGrabContinuousorMdigProcesswith the multicast monitor digitizer to grab the image from the image stream.