SICK IVP Ruler E Reference Manual

R EFERENCE M ANUAL
Ruler E
Reference Manual
Please read the complete manual before attempting to operate your Ruler.
%
Laser radiation
$ Avoid direct exposure to the beam $ Avoid direct eye exposure
The Ruler is a laser product and operation using procedures other than those specified herein may result in hazardous radiation exposure.
Do not open the Ruler
The Ruler unit should not be opened, the Ruler contains no user serviceable parts inside. Opening the ruler unit may result in hazardous radiation exposure.
Turn off the laser power to the Ruler before maintenance
The power to the laser in the Ruler must be turned off before any maintenance is per­formed. Failure to turn this power off when maintaining the unit may result in hazardous
adiation exposure. r
Please read and follow ALL Warning statements throughout this manual.
Windows and Visual Studio are registered trademarks of Microsoft Corporation.
All other mentioned trademarks or registered trademarks are the trademarks or registered trademarks of their respective owner.
© SICK IVP 2005-11-22
All rights reserved
Subject to change without prior notice.
Reference Manual
Ruler E
Contents
Contents
1 Overview......................................................................................................................................... 5
1.1 Configuration Using Ranger Studio......................................................................................... 7
1.2 Measurement Methods........................................................................................................... 8
1.2.1 Range Resolution....................................................................................................... 9
1.2.2 Performance............................................................................................................. 10
1.3 Developing Applications........................................................................................................ 11
1.4 Triggering ...............................................................................................................................12
2 Laser Safety .................................................................................................................................13
2.1 Laser Safety Classification.................................................................................................... 13
2.1.1 Classification............................................................................................................13
2.2 Installation Considerations ...................................................................................................14
3 Configuring the Ruler..................................................................................................................15
3.1 Configuration Hierarchy.........................................................................................................18
3.2 Ethernet Configuration ..........................................................................................................18
3.3 System Configuration ............................................................................................................18
3.4 Image Configuration .............................................................................................................. 19
3.5 Measurement Configuration ................................................................................................. 20
3.6 Measurement Components ..................................................................................................21
3.6.1 Horizontal Threshold (HorThr) ................................................................................. 22
3.6.2 Horizontal Max (HorMax).........................................................................................24
3.6.3 Horizontal Max and Threshold (HorMaxThr) ........................................................... 25
3.6.4 Hi-res 3D (Hi3D)....................................................................................................... 26
3.7 Details on 3D Profiling Algorithms........................................................................................ 27
4 Ranger Studio..............................................................................................................................31
4.1 Ranger Studio Main Window.................................................................................................31
4.2 Visualization Windows...........................................................................................................32
4.2.1 Zoom in Visualization Windows...............................................................................33
4.3 Parameter Editor ...................................................................................................................34
4.4 Using Ranger Studio.............................................................................................................. 35
4.4.1 Connect and Get an Image......................................................................................35
4.4.2 Adjust Exposure Time ..............................................................................................35
4.4.3 Set Region-of-Interest .............................................................................................. 36
4.4.4 Collection of 3D Data............................................................................................... 37
4.4.5 Getting a Complete Object In One Image ...............................................................38
4.4.6 Save Visualization Windows.................................................................................... 38
4.4.7 Save and Load 3D Data...........................................................................................39
5 Ruler API ......................................................................................................................................40
5.1 Connecting to the Camera ....................................................................................................40
5.2 Retrieving Measurement Data.............................................................................................. 41
5.3 Changing Camera Configuration...........................................................................................44
5.4 Transforming Measurement Values .....................................................................................44
5.5 Field-of-View........................................................................................................................... 46
5.6 Rectifying Measurement Values ........................................................................................... 47
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 3
Reference Manual
Ruler E
Contents
6 Examples .....................................................................................................................................48
6.1 ruler_ex .....................................................................................................................................48
6.2 RulerNetConsoleExample......................................................................................................50
7 Hardware Description .................................................................................................................52
7.1 Measurement Set Up ............................................................................................................52
7.2 Electrical Connections........................................................................................................... 54
7.3 Technical Data.......................................................................................................................56
7.4 Dimensional Drawings...........................................................................................................57
Appendix ............................................................................................................................................ 58
A Ruler E Models and Type Codes ........................................................................................... 58
B Recommended Network Cards............................................................................................. 59
C Recommended Switches.......................................................................................................60
D iCon Device Configuration..................................................................................................... 60
E Encoder Wire Diagram...........................................................................................................61
F Laser Safety Box .................................................................................................................... 64
4 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 1
Ruler E
Overview
1 Overview
The Ruler measures the shape of object by using laser triangulation, which means that it analyzes images of the object as it passes under a laser line. Each image shows the laser as a cross-section of the object viewed from an angle. Since the optics in the camera is mounted at a fixed distance and angle from the laser, the height of each point of the cross-section can be calculated by detecting the laser in the image.
Depending on the model of the Ruler, it can make two or three different types of meas­urements:
Range Measures the height of the object along the laser line.
Intensity Measures the amount of light that is reflected by the object along the
laser line.
Scatter Measures how the incoming laser light is distributed beneath the surface
of the object. This is useful for example for finding the orientation of fibers in wood. (Only available for Ruler with the scatter option.)
Figure 1.1 – Measuring a cross-section of an object in 3D
Profile
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 5
Chapter 1 Reference Manual
Ruler E
Overview
The result from measuring one cross-section of the object – the measurement data – is collected into a profile. These profiles are sent to a computer connected to the camera through an Ethernet network. The computer runs a custom application that takes care of the profiles from the camera. This application can for example analyze the data to find defects in the objects and control a lever that pushes faulty objects to the side.
Before the Ruler can be put into production you must write such an application. It is devel­oped in for example Microsoft Visual Studio, using one of the APIs delivered with the software for the camera.
Figure 1.2 – Profiles are sent from the Ruler to a PC, where they are analyzed by a custom application.
Note that the output from the camera is not actual images of the object, but a set of height, intensity or scatter values – one value for each point along the cross section of the object. If desired, these measurements can be visualized as a profile plot showing the shape of the cross section, or – by combining several profiles – as a complete 3D image of the object.
6
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 1
Ruler E
Overview
1.1 Configuration Using Ranger Studio
Before the data from the Ruler can be used in an application, the Ruler should be config­ured to deliver profiles with sufficient quality and speed. This is usually done by setting up the camera in a production-like environment and evaluating different measurement meth­ods and parameter settings until the result is satisfactory.
The Ranger Studio application that is delivered with the Ruler can be used for evaluating different set-ups of the camera. With Ranger Studio, you can change the settings for the camera and instantly see how the changes affects the measurement result from the Ruler.
Once the Ruler has been set up to deliver measurement data that meets the require­ments, the settings can be saved in a parameter file from the Ranger Studio. This parame­ter file is later used when connecting to the Ruler from the application to be developed.
Figure 1.3 – Configuring the Ruler with Ranger Studio.
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 7
Chapter 1 Reference Manual
Ruler E
Overview
1.2 Measurement Methods
When configuring the Ruler for measurement, you can choose any of the camera’s built-in measurement methods – or components:
HorThr Horizontal threshold, a fast method for measuring range values using one
or two thresholds.
HorMax Horizontal max, measures the maximum intensity of the laser, and de-
termines the position of the maximum intensity.
HorMaxThr Horizontal max and threshold, measures range values using one thresh-
old, and measures the maximum intensity of the laser.
Hi3D High-resolution 3D, measures range values with high resolution, as well
as the maximum intensity. Can also measure scatter when used with a Ruler with Scatter option.
Figure 1.4 – Threshold locates the laser in each column of the sensor image by searching for intensities above a certain level, while Max searches for the maximum intensity in each column.
Which component to use is of course depending on what to measure – range, intensity or scatter – but also on the required speed and resolution of the measurements, as well as the characteristics of the objects to measure and the conditions in the environment.
For each measurement method, there are a number of parameters that can be changed for further fine-tuning the quality and performance of the measurements. These parame­ters specifies for example exposure time and in which area of the image to search for the laser line.
Columns
Rows
Projected
laser line
Sensor image
Columns
Columns
Threshold
Max
Rows
Rows
Intensity
Intensity
HorThr HorMax
8 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 1
Ruler E
Overview
1.2.1 Range Resolution
When measuring heights, the resolution depends on which algorithm that is used when detecting the laser line. For example the HorMaxThr method returns the location of the line with 1/2 pixel resolution, while the Hi3D method has a resolution of 1/16
th
of a pixel.
Besides the measurement method, the actual measurement accuracy in millimeters depends on the distance between the Ruler and the object. The further away the object, the lower the accuracy.
This is because the object is viewed from a perspective, and therefore a pixel at the bot­tom of the image shows a larger area of the object than pixels at the top of the image.
Therefore, one way of increasing the accuracy in the measurements is to move the Ruler closer to the objects to measure.
Figure 1.5 – The laser line seen from a perspective, on the sensor, and the resulting profile
Millimeters
V
iewed from
the Ruler
(world)
Millimeters
Columns
Rows
Sensor image
Range
(mm)
Resulting
Profile
Width
(mm)
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 9
Chapter 1 Reference Manual
Ruler E
Overview
1.2.2 Performance
The performance of the Ruler – that is, the maximum number of profiles it can deliver each second – depends on the chosen measurement method, but also on the size of the sensor image in which to search for the profile. The larger the image, the longer it takes to search.
Therefore, one way of increasing the performance of the Ruler is to use a smaller part of the sensor.
Figure 1.6 – A small image may be faster to analyze than a high
Note that the maximum usable profile rate is usually limited by the characteristics of the object’s surface and conditions in the environment.
10 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 1
Ruler E
Overview
1.3 Developing Applications
Once the quality of the measurement data is sufficient, you need to write an application that takes care of the measurement data, analyzes it and makes the decisions based on the measurements. This application is developed in Visual Studio 7, using one of the APIs that are delivered with the Ruler.
There are two APIs included with the development software for Ruler, to be used in Visual Studio: RulerNet API for use with.Net, and Ruler C++ API for use with C++. Both APIs contain the same functions but differ in the syntax.
The APIs handles all of the communication with the Ruler, and contain functions for:
$ retrieving profiles from the Ruler $ starting and stopping the Ruler $ changing Ruler configuration
Most of these functions are encapsulated in a Ruler class, and your application estab­lishes contact with the Ruler camera by creating a Ruler object.
When the Ruler is measuring, it will send a profile to the PC as soon as it has finished measuring a cross-section. On the PC, the profiles are collected and placed in a buffer by the Ruler object. When your application needs measurement data, it requests data from the Ruler object, which will then return a full buffer of profiles.
Figure 1.7 – All communication with the Ruler is handled by the API. Your application retrieves buffers of profiles from a Ruler object.
Your application can specify the size of the buffers, and it is possible to set the buffer size to 1 in order to receive one profile at a time. However, this will also add overhead to the application, and put extra load on the CPU.
The profiles that your application receives are calibrated – that is, the measurement values are given in a metric coordinate system local to the Ruler. You can translate these measurement values to a different coordinate system by setting a Transformation for the Ruler object in your application.
This could be useful for example if you have several Rulers mounted around a conveyor belt where the objects are passing by. By setting transformations for each Ruler, your application will receive all measurements given in a common coordinate system, relieving your application from having to recalculate each value itself.
Profiles
request()
Ruler API
Application
buffers
Control
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 11
Chapter 1 Reference Manual
Ruler E
Overview
1.4 Triggering
The Ruler can be triggered by external signals in two different ways:
Enable Triggers the Ruler to start measuring a series of profiles. As long as
the Enable signal is low, the Ruler will not measure anything. This sig­nal could for example come from a photo switch located along the conveyor belt.
The Enable signal is also useful for synchronizing two or more Rulers.
Pulse triggering Triggers the Ruler to measure one profile. This signal could for exam-
ple come from an encoder on the conveyor belt.
Figure 1.8 – Triggering the Ruler with Enable and Pulse triggering signals.
The Ruler must be configured to use these external signals for triggering. This is done by setting the Enable and Trig mode parameters with Ranger Studio.
If pulse triggering is not used for triggering profiles, the Ruler will measure in free-running mode – that is, make measurements with a regular time interval determined by the Ruler’s cycle time. The actual distance on the object between two profiles is then determined by the speed of the object – that is, how far the object has moved during that time.
When measuring the true shape of an object, you should always use an encoder with the Ruler. With the signals from the encoder as pulse triggering signals, it is guaranteed that the distance that the object has moved between two profiles is well known.
You can find the actual distance between two profiles even if the Ruler is measuring in free-running mode, as long as you have an encoder connected to the Ruler. The encoder information can then be embedded in the profiles sent to the PC, where your application can use this information to calculate the distance.
Enable
Profiles
Pulse
triggering
12 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 2
Ruler E
Laser Safety
2 Laser Safety
The Ruler E is an OEM component.
When the Ruler is incorporated into any machine or installation several laser safety re­quirements must be fulfilled.
2.1 Laser Safety Classification
The United States Center for Devices & Radiological Health (CDRH) enforces strict safety requirements for lasers and laser products.
Recommended reading: Laser Institute of America Laser Safety Guide.
Since the Ruler unit is intended to be incorporated into a measurement system, where it may be partially hidden, it is important to understand the safety issues regarding laser systems. This is so that the complete installation can be performed in accordance with the laser safety regulations.
The CDRH classifies lasers into several categories, and the regulations regarding the two classes applicable to Ruler systems are given here.
2.1.1 Classification
The classification is based on the laser power measured in a certain way (for complete information, please refer to http://www.fda.gov/cdrh).
For the Ruler this corresponds to the maximum light power measured through a 7 mm aperture 100 mm away from the laser aperture.
The limitations for the classification of the laser classes is then
$ Class II / 2M 1 mW $ Class IIIb / 3B 500 mW for emission duration 0.06 sec
Class II / 2M – "Caution"
This applies to Ruler E 600/1200 (II / 2M laser)
Considered eye-safe with caution, but may present a greater hazard if viewed using collecting optics. Focusing of this light into the eye could cause eye damage.
Class II / 2M laser products must bear warning and certification labels.
Class IIIb / 3B – "Danger"
This applies to the Ruler E 600/1200 B (IIIb / 3B laser)
Considered dangerous to your retina if exposed. This includes looking directly into a reflection from a specular (mirror-like) surface. Normally, class IIIb / 3B lasers will not produce a hazardous diffuse reflection. Certification is given on prod­ucts that have a key box and remote interlock connector.
Class IIIb / 3B laser products must bear warning and certification labels.
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 13
Chapter 2 Reference Manual
Ruler E
Laser Safety
2.2 Installation Considerations
Class II / 2M
$ Laser warning and aperture labels in conformance with the labels below should be
present on the complete system.
$ If possible the laser radiation from the laser should be terminated with a diffuse reflect-
ing material.
$ Eye protection – during installation and alignment operations appropriate eye protec-
tion should be used. The eye protection should be designed to reduce the laser power in the wavelength region 600-700 nm. If uncertain, contact SICK IVP for information regarding acquisition of such eye protection.
$ Visible and/or audible indication of operation of the laser (Ruler) should be present in
the installation. The indication should be activated before the Ruler is powered on.
$ A beam attenuator, which reduce the laser emission down to class I limits should be
present in the system.
Lack of beam attenuator and emission indicator is accepted by CDRH according to "Guid­ance on Laser Products - Conformance with IEC 60825-1, Am. 2 and IEC 60601-2-22 (Laser Notice No. 50)".
Class IIIb / 3B
In addition to the considerations for class III/2M lasers, the following also applies: $ A key-box with a removable key must be present in the system. Without the key it
should not be possible to power-on the laser unit of the Ruler.
$ Remote interlock connector – a connector readily available for connecting a remote
emergency stop or remote barrier interlock.
The remote interlock connector having an electrical potential difference of no greater than 130 root-mean-square volts between terminals. When the terminals of the con­nector are not electrically joined, no human access to laser radiation from the laser product in excess of the accessible emission limits of Class I is possible.
Figure 2.1 – Placement of the laser warning and certification labels
Class II / 2M
Class IIIb / 3B
14 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 3
Ruler E
Configuring the Ruler
3 Configuring the Ruler
The Ruler can be configured to fit many different applications. This enables testing of different set-ups and fine-tuning of the parameter values, in purpose to optimize the measurement loop.
The Ranger Studio is used for changing the parameters. The Parameter editor in Ranger Studio retrieves the current parameters from the Ruler and allows you to modify them. Configurations can be stored on file for later use.
When configuring the Ruler there are some basic concepts necessary to be familiar with:
$ Region-of-Interest $ External Triggering $ Cycle Time and Exposure Time
Region-of-Interest
The Region-of-Interest (ROI) is used to define what part of the sensor to be used in a measurement. The ROI is defined in two dimensions, ROI-width and ROI-height.
Figure 3.1 – ROI-width and ROI-height
The ROI-width is defining which columns to use in a configuration and is set by a start column and number of columns. The ROI-width is common to all components in a configu­ration.
The ROI-height is defining which rows to use for a specific component. It is set by a start row and number of rows. Using a smaller region on the sensor enables measurements at a higher rate.
Columns
Rows
ROI-height
ROI-width
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 15
Chapter 3 Reference Manual
Ruler E
Configuring the Ruler
External Triggering
There are two ways to trigger the Ruler using external signals:
Enable Triggers the Ruler to start measuring a series of profiles. This signal
could for example come from a photo switch located along the con­veyor belt.
This signal is connected to In1 on the Power I/O connector.
Pulse triggering Triggers the Ruler to measure one profile. This signal could for exam-
ple be the differential signals Phase 1 and Phase 2 coming from an encoder on the conveyor belt.
This signal is connected to In1 and In2 on the Encoder connector.
The Ruler is configured to use these external signals for triggering by setting the Enable and Trig mode parameters.
When using enable, you set the Scan height parameter to specify the number of meas­urements that the Ruler should make after the Enable signal goes high. After the specified number of measurements, the Ruler checks the enable signal again, and if it is high continues to make another series of measurements.
When using pulse triggering, you set the Number of pulses per trig parameter to specify the number of pulses on the signal before a measurement is made. The Ruler counts the number of pulses received on the pulse triggering inputs using an internal counter, which is reset every time a measurement is made.
When you connect both In1 and In2 on the Ruler’s Encoder connector to signals from the encoder, the signal on In2 can be used for detecting when the object moves backwards. If so, the Ruler will decrement the counter instead. This way the object can move backward and forward under the Ruler, but the Ruler will not measure any section of the object more than once.
Figure 3.2 – Using In1 and In2 to detect movements in both directions.
The pulse triggering counter will also be reset every time the Enable signal goes high.
If pulse triggering is not used, the Ruler will measure in free-running mode, make meas­urements with a regular time interval determined by cycle time. The distance on the object between two measurements is then determined by the speed of the object – that is, how far the object has moved during that time.
To find the actual distance between two measurements when measuring in free-running mode, you can connect an encoder to the Ruler and set the Mark parameter. This will make the Ruler embed the encoder information in the profiles sent to the PC.
Forward Backward Forward
In1
(pulse trig)
In2
(direction)
Increment
No. of
pulses
per trig
Decrement Increment
Pulse trig
counter
Profiles
16 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 3
Ruler E
Configuring the Ruler
Cycle Time and Exposure Time
The cycle time – that is the time between two profiles – and the exposure time – the time during which the sensor is measuring the light from the object – can be set separately when configuring the Ruler.
However, the exposure time cannot be longer than the cycle time. Therefore, if the expo­sure time is set to be longer than the cycle time, the cycle time will be used as the actual exposure time.
If the exposure time instead is set to be shorter than the cycle time, the Ruler will reset the sensor at the beginning of each cycle and then read the exposure after the specified time.
The Ruler uses a rolling shutter – that is, it reads out the exposure on the sensor one row at a time, and at the same time resets that sensor row. Thus, reading the entire sensor image takes a certain amount of time.
When the exposure time is equal to the cycle time, the Ruler only needs to go over the sensor once every cycle. Therefore the shortest possible cycle time would be the same as the time it takes to read the sensor.
But when the exposure time is shorter than the cycle time, the Ruler needs to go over the sensor twice – once for resetting the sensor and once for reading the exposure. Resetting the sensor takes just as long time as it takes to read the exposure, which means that the shortest possible cycle time would in this case be two times the read-out time.
When triggering profiles with pulse triggering, the exposure time should be set to be shorter than the cycle time, otherwise the sensor will be exposed during the entire cycle. This time may vary since it is depending on the pulse trigger signal, leading to varying exposure times.
Figure 3.3 - Exposure time when set to longer and shorter than the cycle time.
Read-out
Cycle time
Used exposure
time
Read-out
Cycle time
Reset
Exposure time
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 17
Chapter 3 Reference Manual
Ruler E
Configuring the Ruler
3.1 Configuration Hierarchy
The following information uses the same hierarchy as in the parameter editor in Ranger Studio. This means that the settings are grouped into the following configurations:
Ethernet Set-up of the communication between the Ruler and the PC.
System Set-up of the Ruler system.
Image Used when the Ruler is running in Image mode, for example for setting up
of Region-of-Interest.
Measurement Selection and set-up of the measurement method to use when measuring
profiles.
Which measurement method to use is specified by the measurement
component that is included in this configuration.
3.2 Ethernet Configuration
The Ethernet configuration is used for communication set-up.
Redundancy packages are used for recovering lost packages and can be used for safer communication between the Ruler and the PC. Each redundancy package can be used for recovering one lost package since the previous redundancy package was sent. For exam­ple, if Redundancy frequency is set to 10, one package out of ten can be lost without losing any data.
The maximum package size depends on whether or not the Network Interface Card in the PC and all other equipment involved in the communication can handle Ethernet “Jumbo frames”.
Input parameters
Redundancy frequency Number of data packages sent between each redundancy
package 0 – 100. Default value 10. A low value means higher security but also higher load on the PC.
Max package size States the maximum size of the Ethernet data package.
The bigger the package – the lower the CPU overhead for the communication. 100 – 4054 bytes. Default value 1472. 1472 Maximum size without Ethernet Jumbo frames. 4054 Maximum size if all equipment can handle
Ethernet Jumbo frames.
3.3 System Configuration
The System settings are used for switching the laser off in order to increase the laser’s life time.
Input parameters
Laser On Laser Off/On. 0 – 1. Default value 1.
0 = Laser Off. 1 = Laser On.
18 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 3
Ruler E
Configuring the Ruler
3.4 Image Configuration
The image settings are intended for evaluation purposes. It is used for set-up of one gray­scale region of the sensor, with a common exposure time for the whole region.
The following parameters are common for all the components in the Image configuration:
Input parameters
Use enable States if enable signal should be used or not.
Default value 0. 0 = disabled 1 = enabled
Start column The first sensor column to acquire data from.
0 – 1280 (for Ruler E 600) 0 – 768 (for Ruler E 1200)
Number of columns The number of columns to acquire (a multiple of 8).
256 – 1536 (for Ruler E 600). Default value 1536. 256 – 1024 (for Ruler E 1200). Default value 1024.
Trig mode Triggering mode:
0 = Free-running/No triggering 1 = Not applicable in Ruler E 2 = Pulse triggering
Number of pulses per trig Only valid for pulse triggering. 1 – 65535
Image 1 Component
Image 1 is an Image configuration component. Image 1 is used for evaluation purposes when tuning in the sensor region and the exposure time for the 3D measurement configu­ration.
To help setting the height of the ROI, the current ROI can be shown in the images sent from the Ruler by setting the Measurement ROI overlay parameter. When set, the top and bottom row of the ROI is marked with a dashed line in the images.
Image 1 is reflecting the measurement 3D configuration. Following parameters are avail­able for the Image 1 component:
Input parameters
Measurement ROI overlay States if the ROI overlay function for the measurement
configuration is enabled or not. Default value 0. 0 = not enabled 1 = enabled
Start row The first sensor row to acquire data from. 0 – 511.
Number of rows The number of rows to acquire data from. 1 - 512. Default
value 512.
Exposure time The time in micro seconds that the sensor is exposed to
light. 10 – 200000. Default value 10000.
Gain The amplification of the analog sensor data before AD
conversion. 1 = No amplification 3 = 3 times 4 = 4 times
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 19
Chapter 3 Reference Manual
Ruler E
Configuring the Ruler
3.5 Measurement Configuration
The measurement configuration is designed for measurements on the sensor.
The following parameters are common for all the components in the Measurement con­figuration:
Input parameters
Use enable States if enable signal should be detected or not. Default
value 0. 0 = disabled 1 = enabled
Cycle time In free-running mode; the time in micro seconds between
each measurement. In pulse triggering mode; the shortest possible time between two measurements – that is, between two trig pulses.
Start column The first sensor column to acquire data from.
0 – 1280 (for Ruler E 600). 0 – 768 (for Ruler E 1200).
Number of columns The number of columns to acquire (a multiple of 8).
256 – 1536 (for Ruler E 600). Default value 1536. 256 – 1024 (for Ruler E 1200). Default value 1024.
Trig mode Triggering mode:
0 = Free-running/No triggering 1 = Not applicable in Ruler E 2 = Pulse triggering
Number of pulses per trig
Only valid for pulse triggering. 1 – 65535
Scan height Number of profiles delivered per buffer when Use enable is
set to 1. 1 – 65535
This value should be the same as the
ProfilesPerBuffer
property set for the Ruler object in the application.
Mark States if encoder values and input status information should
be inserted in the profile or not. 0 = No. 1 = Values inserted.
20 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 3
Ruler E
Configuring the Ruler
3.6 Measurement Components
The Ruler can use one of four different components, or algorithms, to find the position of the laser line in the sensor image:
$ Horizontal threshold $ Horizontal max $ Horizontal max and threshold $ Hi-res 3D (and Scatter)
This section contains a short description of each measurement component and the input parameters that can be used.
The measurement resolution depends on both the measurement method as well as the distance between the Ruler and the measured object. The resolution on different dis­tances from the Ruler using the Hi3D and Horizontal threshold with 2 thresholds is shown in the following figures.
0
0,1
0,2
0,3
0,4
0,5
0,6
400 450 500 550 600 650 700 750 800 850 900
HorThr
Hi3D
width
Resolution for Ruler E 600
Resolution (mm)
HorThr Hi3D Width
Distance from
Ruler (mm)
Resolution for Ruler E 1200
Resolution (mm)
0
0,25
0,5
0,75
1
1,25
1,5
1,75
2
300 500 700 900 1100 1300 1500
HorThr Hi3D Width
A very short and simplified description of the differences between horizontal threshold and horizontal max algorithms is illustrated in the following figure.
Distance from
Ruler (mm)
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 21
Chapter 3 Reference Manual
Ruler E
Configuring the Ruler
Figure 3.4 – The difference between horizontal threshold and horizontal maximum
Intensity
Maximum value
Threshold
Sensor row
Mean value o
f
the threshold
Mean value of the maximum position
3.6.1 Horizontal Threshold (HorThr)
This algorithm is used when high speed is needed. If a smaller sensor region is used up to 10000 profiles can be acquired per second.
The threshold algorithm uses one or two fixed thresholds. Using one threshold gives ½­pixel range resolution, using two gives ¼-pixel resolution. Using two thresholds typically increase the execution time of the algorithm with a factor close to two.
Median and/or Morphology filters can also be used in this algorithm. The Median filter calculates a median value on the binary image data of 3 columns (actual column and its left-right neighbors) before the range algorithm is applied. The morphology filter is used for reducing noise in the sensor image before the laser line is detected. If both filters are used, the morphology filter is applied before the median filter.
Input parameters
Start row The first sensor row to acquire data from. 0 – 511. Default value
0.
Number of rows The number of rows to acquire algorithm data from. 16 – 512.
Default value 128.
Exposure time The time that the sensor is exposed to light (microseconds)
Threshold 1 First (low) threshold level. 0 – 255.
Threshold 2 Second (high) threshold level. 0 – 255.
Number of thresh­olds
Number of thresholds to use. 1 = One threshold is used, Threshold 1. 2 = Two thresholds are used, Threshold 1 and Threshold 2.
Median States if the Median filter should be applied on the data or not.
0 = filter disabled 1 = filter enabled
Morphology Morphology filter on sensor image enabled or not.
0 = filter disabled 1 = expand mode 2 = shrink mode
Morphology size Filter size 3 – 5 rows.
22 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 3
Ruler E
Configuring the Ruler
The measurement speed of a configuration using the Horizontal Threshold component depends mainly on the current settings for the ROI. The maximum speed with one and two thresholds enabled is shown in the following figure.
0
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000
0 100 200 300 400 500
HorThr Maximum Profile Speed
Profiles per second
1 threshold
2 thresholds
1 threshold 2 thresholds
Number of rows
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 23
Chapter 3 Reference Manual
Ruler E
Configuring the Ruler
3.6.2 Horizontal Max (HorMax)
The horizontal max measures intensity and range values using maximum intensity. This algorithm is measuring range data with less accuracy than Horizontal threshold. Informa­tion on maximum speed is found in the figure that follows after the list of parameters and the height resolution is 1 or ½-pixel.
Input parameters
Start row The first sensor row to acquire data from. 0 – 511. Default value
0.
Number of rows The number of rows to acquire algorithm data from. 16 – 512.
Default value 512.
Exposure time The time that the sensor is exposed to light. (microseconds)
Gain The amplification of the analog sensor data before AD conver-
sion: 1 = No amplification 3 = 3 times 4 = 4 times
Threshold The noise level, i.e. the minimum light level to consider as a
valid laser position. 0 – 255. Note, that a low setting of the threshold might increase the amount of noise.
Sub pixeling The resolution to use when computing the mid-position of the
first and last position that represents the maximum value. 0 = Resolution of 1 pixel 1 = Resolution of ½-pixel
Ad bits Number of bits to perform AD conversion of sensor data on.
5 – 8. Default 7.
The acquisition speed of a configuration using the Horizontal Max component depends mainly on the current settings for the ROI and AD bits. The maximum speed at 5 – 8 bit AD conversion is shown in the following figure.
0
1000
2000
3000
4000
5000
6000
7000
8000
0 100 200 300 400 500
HorMax Maximum Profile Speed
Profiles per second
5 AD bits
6 AD bits
7 AD bits
8 AD bits
5 AD bits, no subpix
6 AD bits, no subpix
5 AD bits 6 AD bits 7 AD bits 8 AD bits 5 AD bits, no subpix 6 AD bits, no subpix
Number of rows
24 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 3
Ruler E
Configuring the Ruler
3.6.3 Horizontal Max and Threshold (HorMaxThr)
The horizontal max and threshold algorithm combines the two above-mentioned algo­rithms. Threshold is used for measuring range and max for measuring intensity. This algorithm gives better 3D and is slightly faster than HorMax. One threshold can be used.
Median and/or Morphology filters can also be use in this algorithm. The Median filter calculates a median value on the binary image data of 3-columns (actual column and its left-right neighbors) before the range algorithm is applied. The morphology filter is used for reducing noise in the sensor image before the laser line is detected. If both filters are used, the morphology filter is applied before the median filter.
Input parameters
Start row The first sensor row to acquire data from. 0 – 511. Default value
0.
Number of rows The number of rows to acquire algorithm data from. 16 – 512.
Default value 128.
Exposure time The time that the sensor is exposed to light. (microseconds)
Gain The amplification of the analog sensor data before AD conversion
1 = No amplification 3 = 3 times 4 = 4 times
Threshold Threshold level. 0 – 255.
Ad bits Number of bits to perform AD conversion of sensor data on.
5 – 8. Default 7.
Median States if the Median filter should be applied on the data or not.
0 = filter disabled 1 = filter enabled
Morphology Morphology filter enabled or not.
0 = filter disabled 1 = expand mode 2 = shrink mode
Morphology size Filter size 3 – 5 rows.
The acquisition speed of a configuration using the Horizontal Max and Threshold compo­nent depends mainly on the current setting for the ROI and AD bits. The maximum speed at 5 - 8 bit AD conversion is shown in the following figure.
0
1000
2000
3000
4000
5000
6000
7000
8000
9000
10000
0 100 200 300 400 500
HorMaxThr Maximum Profile Speed
Profiles per second
5 AD bits
6 AD bits
7 AD bits
8 AD bits
5 AD bits 6 AD bits 7 AD bits 8 AD bits
Number of rows
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
25
Chapter 3 Reference Manual
Ruler E
Configuring the Ruler
3.6.4 Hi-res 3D (Hi3D)
Hi3D gives the best 3D resolution of the available components by using an algorithm that is similar to center-of-gravity. Height resolution is 1/16
th
pixel.
This component delivers one range profile and one intensity profile. When this algorithm is used with a Ruler with the scatter option (S-version), the algorithm can also deliver a scatter profile.
The following parameters are available for the Hi-res 3D component:
Input parameters
Start row The first sensor row to acquire data from. 0 – 511. Default value
0.
Number of rows The number of rows to acquire algorithm data from. 16 – 512.
Default value 128.
Exposure time The time that the sensor is exposed to light. (microseconds)
Gain The amplification of the analog sensor data before AD conversion.
1 = No amplification 3 = 3 times 4 = 4 times Gain 4 is recommended for best contrast on scatter data.
Mode Mode:
0 = Range and Intensity. 1 = With Scatter (valid only for S-version)
Scatter offset Offset distance in percentage from the maximum position.
0 – 99. Too low an offset gives scatter value = intensity value, while too high an offset gives a dark (black) image.
Threshold The noise level, i.e. the minimum light level to consider as a valid
laser position. 0 – 255. Note, that a low setting of the threshold might increase the amount of noise.
Ad bits Number of bits to perform AD conversion of sensor data on. Lower
number of bits gives lower 3D resolution and decreased contrast in scatter measurement. 5 – 8. Default 7.
The acquisition speed of a configuration using the Hi-res 3D component depends mainly on the current setting for the ROI and AD bits. The maximum speed at 5 – 8 bit AD conver­sion is shown in the following figure.
0
500
1000
1500
2000
2500
3000
3500
4000
4500
0 100 200 300 400 500
Hi3D Maximum Profile Speed
Profiles per second
5 AD bits
6 AD bits
7 AD bits
8 AD bits
5 AD bits 6 AD bits 7 AD bits 8 AD bits
Number of rows
26 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 3
Ruler E
Configuring the Ruler
3.7 Details on 3D Profiling Algorithms
This section contains basic information on how the measurement algorithms works and further details.
Laser Impact Position on the Sensor
The basic function of all the 3D measurements is to compute the impact position of the laser line for all columns of the selected Region-of-Interest. The light intensity distribution from the laser line along a sensor column across the laser line can be described as in the following figure.
Figure 3.5 – The impact position of the laser in one column
The laser line will produce a distinct light peak distributed over a number of pixels along the sensor column. The center of this peak will be defined as the impact position of the laser line on that sensor column, which is the range value.
Threshold
Digitizing an analog signal by the means of a binary threshold is a common technique in signal/image-processing.
The signal in the previous figure can be thresholded by defining an intensity threshold. This operation will produce a result in which all pixels with an intensity above the threshold will be defined as logical ones. Pixels with intensity below the threshold will be defined as logical zeros. This will form a digital representation of the analog signal represented by a group of logical ones and zeros.
Figure 3.6 – Digitalizing one column of the sensor image using a binary threshold
The width of the laser light peak is defined as the number of pixels representing the peak with intensity above the threshold.
Intensity
Sensor row
ROI end
ROI start
Intensity
Threshold
Sensor row
ROI end
ROI start
Sensor row
ROI end
ROI start
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
27
Chapter 3 Reference Manual
Ruler E
Configuring the Ruler
The position of the first and last pixel defining this width can be computed with a resolu­tion of one pixel.
½-pixel position: The center of the light peak can be computed as the mid-position of the first and last pixel that represent the peak. If the width of this group consists of an even number of ones, the mid-position will fall between two pixel centers. Thus the impact position will have a resolution of half a pixel.
¼-pixel position: Two peak-widths can be computed using two different thresholds. For each width the mid-positions are computed with a resolution of half a pixel. The average of the two mid-positions is then computed giving a resolution of a quarter of a pixel.
Multiple light peaks
If several light peaks are above the threshold at the same sensor column the first peak found in the search direction is used to represent the impact position of the laser line. This may not be true and will in this case yield an incorrect range measurement.
Figure 3.7 – A too low threshold may detect multiple light peaks
In this case either the false peak must be suppressed or the threshold must be altered (as in following figure.
Figure 3.8 – Altering the threshold to remove false peaks
In the case that the true light peak (the laser) is the first along the search order the correct range value will be computed.
Intensity
False laser peak
Threshold
Sensor row
ROI end
ROI start
Sensor row
ROI end
ROI start
Intensity
Threshold
False laser peak
Sensor row
ROI end
ROI start
Sensor row
ROI end
ROI start
28
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 3
Ruler E
Configuring the Ruler
Center-of-gravity
Center-of-gravity (Cog) is another method of finding the impact position of the laser line in a sensor column. With this method typical resolution of 1/16
th
of a pixel is achieved. The
Hi3D algorithm is based on calculations similar to Cog.
In the Center-of-gravity method one threshold is used, but compared to ordinary threshold­ing the sensor data above the threshold is digitized to a 5 – 8-bit representation. The sensor data below the threshold is set to 0 as in the ordinary thresholding. The center-of­gravity is then calculated through two sums:
Cog =
(x * f (x))
(f (x))
Where x is the sensor row and f(x) the digitized intensity level in the sensor data.
Figure 3.9 – Calculating the center-of-gravity
Median Filter
The Median filter calculates a median value on the binary data of 3-columns of the binary image (actual column and its left and right neighbors) before the range algorithm is ap­plied. This filter pre-process the binary image data used in the profile detection of the Horizontal Threshold and Horizontal Max and Threshold components. The calculation does not increase the time for the processing.
In cases when using two thresholds this filter is applied to both binary results independ­ently, but with the same parameters.
If both median filter and morphological is used, the morphological filter is applied before the median filter.
Morphology Filter
The morphology parameter is used for reducing noise in the sensor image before the laser line is detected. It can be used with the Horizontal Threshold and Horizontal Max and Threshold components.
Ideally the laser peak on the sensor is a smooth peak without any noise present. However, due to different noise sources the peak may be affected by noise peaks. The morphology filters are designed to reduce the effect of these noise peaks. If, when studying a Ruler profile, the resulting profile appears to have two distinct levels, or have profile points that appear at more or less random positions, the morphological filters can help the situation.
There are two basic binary morphology filters, shrink (erode) and expand (dilate), and both those are implemented.
Intensity
Threshold
Sensor row
ROI end
ROI start
Intensity
Sensor row
ROI end
ROI start
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 29
Chapter 3 Reference Manual
Ruler E
Configuring the Ruler
Morphological filters are applied to each pixel in the image, and the result in each pixel is a function of the pixels within a defined region around that pixel. The morphological filters in Ruler work on single columns of 3-5 vertically oriented pixels, i.e. each pixel are processed together with neighbors above and below up to 2 rows away.
If the profiling algorithms use multiple thresholds each thresholded image is processed independently, but using the same filter settings.
Using the morphological filters with size 3 gives no decrease in algorithm speed, but increasing the filter size might give a small increase in minimum possible cycle time.
If both morphological and median filter is used, the morphological filter is applied before the median filter.
Figure 3.10 – Applying a morphological filter to one column of the sensor image
In a shrinking morphological filter of size Nx1 pixels the operation is defined as a Boolean AND of the pixels within the region. That is, if all pixels within the region are 1 the result is 1, otherwise 0.
Consider the binary images in the figure above. In the first noisy example, the noise peak is removed by the shrink filter, but in the second example the result is only improved by the expand filter.
In an expanding morphological filter of size Nx1 pixels the operation is defined as a Boo­lean OR of the pixels within the region. That is, if any pixel within the region is 1 the result is 1, otherwise 0.
Consider the binary images in the figure again. In the first example, the noise peak re­mains, and the profile result is not improved, but in the second example the result is improved.
30 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 4
Ruler E
Ranger Studio
4 Ranger Studio
Ranger Studio application is a tool for evaluating data and different set-ups of the camera. With Ranger Studio, you can change the settings for the camera and instantly see how the changes affect the measurement result from the Ruler.
Once the Ruler has been set up to deliver measurement data that meets the require­ments, the settings can be saved in a parameter file.
This chapter starts with a presentation of the windows and continues with examples of how to use them.
Ranger Studio consists of a Main Window, Visualization Windows and a Parameter Editor.
Figure 4.1 – Ranger Studio windows
Visualization window
Main window
Control
bar
Parameter edito
r
Log
4.1 Ranger Studio Main Window
The main window is the core of the application. It consists of a menu bar, a control bar with buttons and a log window.
$ Menu bar – menus with access to visualization windows and options. $ Control bar – contains the functions for controlling the Ruler. $ Log – shows error and status messages.
The buttons in the control bar are grouped into three categories:
$ Camera control – contains buttons to connect and disconnect the camera. $ Acquisition control – to start and stop the scanning loop and to change between scan-
ning in Image or Measurement mode. Image mode is used for set-up purposes. Measurement mode is used for collection measurement data.
$ Parameters – to handle parameter files and to start the parameter editor.
All these tools are also available in the menus.
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 31
Chapter 4 Reference Manual
Ruler E
Ranger Studio
4.2 Visualization Windows
The visualization window is used for visualizing the result from the camera. Several visuali­zation windows showing different results can be open at the same time. The visualization windows are further described later on in this chapter.
The visualization windows can be opened from the menu bar in Ranger Studio main win­dow (Choose View
Æ Combined).
In Image mode, this Visualization window shows a grayscale 2D image. This is useful in order to, for example, adjust the exposure time and to decide the region of interest.
Figure 4.2 – Visualization window with grayscale 2D image.
In Measurement mode the View menu offers visualization windows for combined data, and windows for range, intensity and scatter data as applicable. Scatter data is only be avail­able in Rulers with the scatter option (S-version).
Figure 4.3 – Visualization windows with range, scatter and intensity images.
The visualization window always shows the measurement data as an 8-bit grayscale image. This means that the original range measurement values are translated to 255 grayscale values, where 1 (black) corresponds to the bottom of the field-of-view (FOV) and 255 (white) corresponds to the top of the FOV. The value 0 means missing data.
In addition, the range profiles are re-sampled to get range values that are evenly distrib­uted along the x-axis, to be able to display the measured objects with correct proportions.
Figure 4.4 – The original measurement values in a range profile and corresponding row in the image displayed in the visualization window.
Grayscale
value
Range
(mm)
Top of
FOV
255
Bottom
of FOV
0
x (pixels)
x (mm)
Corresponding row in the
visualization window
Original range profile
32 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 4
Ruler E
Ranger Studio
4.2.1 Zoom in Visualization Windows
The zoom function is available in any visualization window. Right-click in the visualization window to display the zoom menu:
$ New 8-bit gray-scale zoom window $ New 3D zoom window $ New profile zoom window
Figure 4.5 – Range visualization window with Profile and 3D zoom windows.
When choosing a zoom window from this menu a rectangle is shown at the upper left corner of the active visualization window and a new zoom window is opened. Several zoom windows can be shown simultaneously.
To separate which rectangle belongs to which zoom window, the rectangles have different colors depending on the type of zoom window:
8-bit grayscale Green rectangle. The region is displayed as a grayscale 2D image.
If you resize the zoom window, you may have to move or resize the
rectangle in the visualization window before the zoom is displayed in full resolution.
3D zoom Yellow rectangle. The data is displayed as a 3D surface, where varia-
tion in height is also indicated by different colors. The lowest value is shown as black color.
Before generating the 3D surface, the data is filtered by a small
median filter to reduce noise peaks. The 3D zoom window can be of use even if the data is intensity data.
Profile zoom Blue rectangle. The region is shown as a rectangle, but the profile
displayed is taken from the top row of the rectangle. The data is dis­played as a profile, where range, intensity or scatter is displayed as the y-coordinate.
Note that the profile window shows 8-bit data, which means that the
measurement values are translated to 256 levels, just as in the visu­alization windows.
The contents of the zoom image are updated as the rectangle is resized and moved around in the active visualization window. The rectangle is resized and moved by pressing the left mouse button pointing the cursor on the frame or in the middle of the rectangle respectively.
When viewing the 3D zoom, you can change the perspective and coloring of the 3D sur­face:
$ Hold down the left mouse button and move it to change the viewing direction, so that
the object can be viewed from various angles.
$ Hold down the right mouse button and move it up or down in the image to remap the
coloring of the surface. This can be used to emphasize different parts of the current data.
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 33
Chapter 4 Reference Manual
Ruler E
Ranger Studio
4.3 Parameter Editor
The Parameter Editor button in Ranger Studio main window opens the Parameter Editor window, which retrieves the current parameters from the system and allows you to modify parameters in the camera.
The Parameter Editor consists of three areas: Parameter tree, Parameter list and a Status bar.
Parameter list
Parameter tree
Figure 4.6 – The Parameter editor window.
The parameter tree shows a hierarchical structure of the system configuration. When selecting an item in the parameter tree all available parameters for that item are shown in the Parameter list on the right.
The parameter list is a table containing the parameter names and parameter values. When selecting a parameter name, or its value, information about parameter type, range etc is displayed in the status bar at the bottom. The value of a parameter can be changed in the parameter value column. If changing a parameter value fails an error message is shown in the log, but the attempted value might still be seen in the editor. In this case, restart the parameter editor to receive the original value.
The status bar at the bottom of the parameter editor displays additional information about the selected parameter.
Status bar
Value The value type of the parameter, for example int for integer.
Min The low limit of the parameter.
Max The upper limit of the parameter.
Default The default value of the parameter.
Parameter type If the parameter is of type Argument, Setting or Property
Argument The camera needs to be stopped while changing
this parameter.
Setting This parameter can be changed at any time.
Property Read only parameter that cannot be changed.
Info Additional information about typical valid values, use, etc.
When you are satisfied with the parameter settings in the camera, use the button Save parameters in Ranger Studio main window to save it as a parameter file.
For detailed information about parameters, see Configuring the Ruler on page 15.
34 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 4
Ruler E
Ranger Studio
4.4 Using Ranger Studio
This section introduces the basics in Ranger Studio and describes how to:
$ Get an Image from the Ruler $ Adjust the Exposure time $ Set the Region-of-Interest (ROI) $ Collect 3D data
The common way of working is to iterate until you are satisfied with the configuration and the received data.
It is assumed that the Ruler and Ranger Studio are installed and are working properly. How to install the Ruler and Ranger Studio is described in the installation instruction. For capturing 3D images you also need movement and some kind of photo switch or similar device connected to the Ruler.
We also assume that you have placed some object to measure in the laser plane. The object should fit into the field of view of the Ruler.
4.4.1 Connect and Get an Image
To get an image from the Ruler, first connect to the Ruler, and then load a suitable pa­rameter file. Which parameter file to use depends on the model of the Ruler (600 or 1200) and which measurement method you plan to use. Ranger Studio includes default parame-
er files for each measurement method. t
1. Start Ranger Studio.
2. Click Connect on the Control bar.
3. Click Load Parameters in the Ranger Studio and select the appropriate parameter file.
4. Choose Image from Configuration.
5. Choose View
Æ Combined from the menu bar.
A visualization window appears, but it is still empty.
6. Click Start to start the acquisition.
The visualization window shows the live view of the Ruler.
The view in the visualization window can be used for finding an appropriate exposure time or the region-of-interest.
4.4.2 Adjust Exposure Time
T o adjust the exposure time, Ranger Studio should already be connected to the Ruler.
1. Click Parameter Editor in the Ranger Studio.
2. If needed, expand the parameter tree by clicking on the +-signs.
3. Select the Image 1 component in the parameter tree.
All parameters for this component are listed to the right.
4. Select Exposure time and change the value until the laser line is visible in the Visuali-
zation window, but not much else of the scene is. This means that the area not hit by laser light should not be visible.
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 35
Chapter 4 Reference Manual
Ruler E
Ranger Studio
In many situations 3000 microseconds could be a good starting point, but this depends on the surface properties of the object.
When a suitable exposure time is found and the Ruler is measuring in free-running mode,
he same value should be given to two more parameters in the Parameter Editor: t
5. Select the Measurement configuration in the parameter tree.
6. Select Cycle time and change the value to the same as you found as suitable expo-
sure time. The point is that the cycle time should not exceed the exposure time.
7. Select the measurement component under the Measurement configuration in the
parameter tree.
8. Select Exposure time and change the value to the exposure time you found suitable
above.
Note, when measuring in free-running triggering mode the lowest value of the cycle time and the exposure time will be used as exposure time.
4.4.3 Set Region-of-Interest
The region-of-interest (ROI) is the area of the sensor image in which the Ruler will measure the object. By using a small ROI, the Ruler will normally be able to deliver profiles at a higher rate.
Changing the size of the ROI – Start row and Number of rows - has no effect unless the Ruler is stopped. Therefore it is necessary to stop the Ruler, make the changes and then
tart the Ruler again, in order to see the effect of this change. s
1. Put the highest part of the object closest to the sensor.
2. Click Parameter Editor in the Ranger Studio.
3. Select the Image 1 component in the parameter tree of the Parameter Editor.
4. Select Measurement ROI overlay and change the value to 1.
This will display two animated dashed lines as an overlay to the image data in the Visualization window. The region in between these lines is used for 3D data acquisi­tion. To begin with the lines may be in the edge of the window so you cannot see them. A good idea could be to enlarge the window.
5. Select the measurement component in the Measurement configuration in the parame-
ter tree.
6. Repeat step 7 – 12 until the area is selected.
7. If the Ruler is running, click Stop in the control bar of Ranger Studio main window
8. Select Start row in the parameter tree and change the value until the upper most part
of the laser line is just beneath the fist dashed line. You must start the Ruler to see the changes in the Visualization window, but stop the Ruler before changing the value again.
9. Click Start to start the Ruler and put the lowest part of the object into the laser plane.
10. Click Stop to stop the Ruler.
11. Select Number of rows and change the value until the second dashed line is just
below the lowest part of the laser line projected onto the object. Similarly, the Ruler must be started to see the changes, but stopped before changing the value.
1 2. Click Start to start the Ruler again.
In many cases it is a good idea to not include data from the background, for example the conveyor belt.
36 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 4
Ruler E
Ranger Studio
4.4.4 Collection of 3D Data
When you have a suitable exposure time and the ROI have been set, the system is ready
or 3D data generation. The first step is to change to measurement mode as follows: f
1. If still running, click Stop in the control bar of Ranger Studio main window.
2. Close the Visualization window.
3. Choose Measurement from Configuration.
4. Choose View Æ Range from the menu bar.
A visualization window appears, but it is still empty.
5. Select the measurement component under the Measurement configuration in the
parameter tree in the Parameter Editor.
6. Click Start in Ranger Studio.
The Visualization window shows a grayscale image where a single profile is repeated from the top to the bottom of the window. You can view the profile in a Profile zoom window by right-clicking and choosing from the zoom menu if you like.
7. Move the object back and forth through the laser plane.
Collection of 3D profiles describing the object’s shape is displayed in the Visualization window next to the intensity data from the object.
It may be necessary to change parameters to improve the image quality and perform­ance.
New 3D Profiles are being collected constantly, overwriting what is displayed in the visuali­zation window. In order to get an entire 3D Image of the object, an external enable signal will come at handy. A photo switch or similar device can be connected to the Ruler. Infor­mation on signal requirements and pin configuration can be found in the Hardware De-
cription. s
8. Now, we assume a photo switch or similar is connected to the Ruler.
9. Click Stop in Ranger Studio.
10. Select the Measurement configuration in the parameter tree.
11. Select the Use Enable parameter and change the value to 1.
This means that measurements will be generated only as long as the photo switch is active.
12. Click Start in Ranger Studio to start the Ruler again and keep the switch active as long
as the object is in the laser plane.
13. Move the object thru the laser plane at a constant speed.
Now a 3D image (i.e. collection of 3D profiles) is displayed in the Visualization window. If the whole object does not fit into one image, try to increase the object speed.
14. If you want to save the configuration from the Ruler, click Stop to stop the acquisition.
15. Click Save parameters and give the file a name.
1 6. Click Disconnect.
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 37
Chapter 4 Reference Manual
Ruler E
Ranger Studio
4.4.5 Getting a Complete Object In One Image
In many situations, it is desirable to get the complete object into one image buffer rather than getting it distributed in several successive images. There are several possible ways of doing this, for instance by adapting the speed of the conveyor or by changing the profile rate. However, in most cases the profile rate and the object speed are already decided and can not be altered. In these cases, the number of scans collected in each image buffer needs to be adapted to the application.
When using an external trigger (for example a photo switch) it is important to synchronize the PC buffers with the number of scans sent from the Ruler for each trig pulse. If these are not synchronized, parts of the object may end up in two successive images.
In this description, it is assumed that the measurement have been set up to use a photo
witch or similar according to the above. s
1. Make a measurement and from the resulting image estimate how many scans that
would be required to fit the complete object into one image.
2. Select the Measurement configuration in the parameter tree.
3. Select ScanHeight and set it to the estimate you made. This will make the Ruler send
this amount of scans for each trig pulse (after competion of previous collection of scans).
4. Click Disconnect to synchronize the image buffers (the parameter settings of the Ruler
will remain in the Ruler unit).
5. Choose Options
Æ Options… from the menu bar. A Ruler Option window appears.
6. Set the Lines per frame item to the very same value used for the ScanHeight parameter.
7. Depending on the number of lines per frame, it may also be necessary to increase the
Buffer size (that is, if a large value is used).
8. Click OK to close the window.
9. Click Connect to connect to the Ruler again.
10. Click Start to collect data and ensure that the complete object fits into one image. If
not, repeat the procedure again.
4.4.6 Save Visualization Windows
It is possible to save the contents of the visualization windows – that is, the images that are displayed. The data will be saved as bitmap images (.bmp)
N ote that only the visible windows are saved.
1. Collect the data you want to save.
2. Stop the Ruler by clicking Stop in Range Studio.
3. Choose File
Æ Save image as BMP...
4. Fill in a file name in the dialog box.
This will save the visible visualization windows (not zoom windows) as BMP files
<filename>.BMP The contents of the Combined window
<filename>_R.BMP The contents of the Range window
<filename>_I.BMP The contents of the Intensity window
<filename>_S.BMP The contents of the Scatter window
38 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 4
Ruler E
Ranger Studio
4.4.7 Save and Load 3D Data
You can save the collected 3D data, and later load and view the data in Ranger Studio, for example on another computer.
The 3D data is saved in two files: one .xml and one .dat file. Both files must be placed in the same folder when loading the data into Ranger Studio.
T o save the collected 3D data, do as follows:
1. Collect the data you want to save.
2. Choose File
Æ Save buffer... from the menu bar.
3 . Fill in a name for the files in the dialog box and click Save.
T o load a file containing saved 3D data into Ranger Studio, do as follows:
1. Make sure that Ranger Studio is disconnected from any Ruler.
2. Choose File
Æ Load buffer... from the menu bar.
3. Select the .xml file to load in the dialog box and click Open.
Note: the corresponding .dat file must be found in the same folder as the .xml file.
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 39
Chapter 5 Reference Manual
Ruler E
Ruler API
5 Ruler API
When developing the applications that analyze the measurement data from the Ruler, you use the Ruler API for controlling the Ruler as well as retrieving the resulting profiles.
There are two different APIs installed with the development software for the Ruler:
Ruler C++ API For use with C++
RulerNet API For use with .Net
Both APIs contain the same functions and differ mainly in the syntax used. The biggest difference is that the Ruler C++ API uses set and get methods to access the object properties.
The Ruler APIs are based on the Ruler class, which is the main class associated with a Ruler camera. In addition there are a number of support classes for geometry information (Point, FieldOfView, Rotation and Transformation) and enumerations (error and status codes).
When building an application using the RulerNet API, make sure that there is a reference to the RulerNet.dll library. When using the Ruler C++ API, make sure that the program is linked with the icon2.lib library.
This chapter describes the RulerNet API, and the examples are written in VB.Net. However, the Ruler C++ API contains the same functions having the same names. An example program showing how the Ruler C++ API is used can be found in Examples on page 48. You can also explore the functions in the API with the RulerGUIExample program.
More detailed information on the Ruler APIs is found in the online help for the APIs, which can be opened from the Start menu.
5.1 Connecting to the Camera
To connect to the Ruler camera from your application, do the following:
$ Create a Ruler object. $ Set the CameraAddress property to the IP address of the camera. $ Set the ParameterFile property to point out the parameter file that contains the
configuration that the camera should use. Parameter files are created with Ranger Stu­dio.
$ Call the Ruler object’s InitRuler() method. The Ruler will then enter the Stopped
state, which means that it is connected but not measuring.
' Create a new Ruler and give it a name Dim myRuler As New Ruler.RulerNet("MyRuler")
' Set the IP address of the Ruler unit we want to connect to. myRuler.CameraAddress = "192.168.0.43"
' Set the path to the parameter file to use. myRuler.ParameterFile = "parameterFile.prm"
' Initialize the Ruler unit with the above settings. Dim res As ErrorCodes res = myRuler.InitRuler()
40 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 5
Ruler E
Ruler API
Once connected, you can start and stop the camera by using the StartRuler() and StopRuler() methods. When you are done with the camera, call the CloseRuler()
method.
When the camera is started and measuring, it may alter between two states:
Started The camera is measuring and sending measurement data to the PC.
WaitingForEnable If the UseEnable parameter is set in the parameter file used by the
Ruler, the camera is waiting for the Enable signal to become high, and therefore not sending any measurement data.
You can find out which state the Ruler currently is in by calling the Ruler object’s Ping() method.
NotInitialized
Stopped
Started
WaitingForEnable
InitRuler()
StartRuler()
StopRuler()
UpdateParameters()
CloseRuler()
Figure 5.1 – The normal states for a Ruler object and the Ruler camera.
In addition to the states in the illustration, the Ruler also has an Error state, which means that the current configuration of the Ruler is not valid, and therefore the Ruler cannot be started.
NOTINITIALIZED STOPPED
STARTED
create ob
j
ect
5.2 Retrieving Measurement Data
When retrieving the profiles with the Ruler object, the measured values for each point in the profile are placed in up to four separate arrays of data:
x X coordinate for the measured point in millimeters (float).
range Range values (height values) in millimeters at the measured point (float)
intensity Intensity values (grayscale values) at the measured point (0–255, byte).
scatter When used with a Ruler with the Scatter option, scatter values at the
measured point (0–255, byte).
The index of a value in the arrays tells which point the data belongs to. For example, the x value for the 3:rd point in the first profile in the buffer is stored in the 3:rd item in the x array, and the corresponding range value in the 3:rd item in the range array.
Since a number of profiles are retrieved at a time, the values for the other profiles are placed in order after the first profile. For example, the x value for the 3:rd point in the second profile is stored in item number (3 + PointsPerProfile) in the x array, etc.
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 41
Chapter 5 Reference Manual
Ruler E
Ruler API
... ...
0
1
2
3
4
5
1023
1024
1025
1026
1027
1028
(PointsPerProfile *
ProfilesPerBuffer) - 1
x
range
intensity
scatter
Figure 5.2 – How measurement data is stored in the arrays
In addition to the measurement data, the following information is also returned for each profile by the Ruler object:
id ID of the profile that the measurement data belongs to (integer).
mark If the Mark parameter is set, the encoder values are returned in this
array (signed integer).
status Status and error information for each profile (integer):
Flag Bit Description
INVALID 0 Set if data was lost during transmission
– 1-15 Reserved
OVER_TRIG 16-23 Number of overtrigs that have occurred
– 24-26 Reserved
ENCODER_B 27 Set if the signal on In2 on the Encoder
connector is high (Encoder Phase 2)
ENCODER_A 28 Set if the signal on In1 on the Encoder
connector is high (Encoder Phase 1)
LASER 29 Set if Laser is on
ENABLE 30 Set if the signal on In1 on the Power I/O
connector is high (Enable)
– 31 Reserved
The ENABLE flag in the status information is useful when using an external enable trigger­ing signal. A profile where the ENABLE flag is off (0) indicates that the measurement of an object is finished.
To retrieve measurement data from the Ruler, declare arrays to be filled with the meas­urement data, and call the Ruler object’s RequestDataSeparate() method, and pass the arrays as arguments:
res = ruler.RequestDataSeparate(id, status, scatter, x, range, intensity, mark)
3:rd point in
first profile (0)
3:rd point in
second profile (1)
Profile 0 Profile 1
42 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 5
Ruler E
Ruler API
All arrays should be one-dimensional arrays of integers or floats, and must have exactly the same size as the data contained in one buffer, that is:
$ the x, range, intensity and scatter arrays should contain
(PointsPerProfile * ProfilesPerBuffer) elements.
$ the id, mark and status arrays should contain ProfilesPerBuffer elements
Note that in Visual Basic you declare arrays by specifying the highest index in the array, and not the size of the array. Since the first element in an array has the index 0, the decla­ration should look like the following example:
points = myRuler.ProfileWidth profiles = myRuler.ProfilesPerBuffer Dim x(points * profiles - 1) As Single ... Dim id(profiles - 1) As Integer ...
Before retrieving measurement data, your application can check the Ruler object’s AvailableBuffer property to see whether there is any data to retrieve. If the property has a non-zero value, there is at least one buffer of data to retrieve.
If you try to retrieve data when there is nothing in to retrieve, the method will time out after a period of time that is specified by the Timeout property. If Timeout is set to 0 the method will return immediately if there is no buffer available. If Timeout is set to -1, the method will never time out – that is, the thread will be halted until there is data in the buffer.
If you do not retrieve measurement data quickly enough the internal queue of buffers will eventually become full. The size of the internal buffer is controlled by the Memory- BufferSize property.
If the buffer gets full, requestDataSeparate will return the error code E_FIFO_FULL. This means that profiles have been lost as the queue was full. If you should encounter this error code, it is recommended to stop the Ruler and restart it.
To solve the overflow problem you can try the following:
$ Increase the MemoryBufferSize to make the queue larger. $ Increase the cycle time in the Ruler parameters. $ Call requestDataSeparate at a more regular interval. $ Increase the priority of the thread and/or process.
Please note that context switching and other operating system activities will interrupt your process/thread at random intervals, which can cause the memory buffers to overflow if you do not have enough processing margin to allow for this overhead.
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 43
Chapter 5 Reference Manual
Ruler E
Ruler API
5.3 Changing Camera Configuration
The Ruler object is usually associated with a parameter file, which is specified with the ParameterFile property and used when the Ruler unit is initialized. If necessary, you may re-configure the Ruler from your application by specifying a different parameter file, for example if you should need to change measurement method.
There are a few additional parameters that can be set from your application, in addition to the parameters in the parameter file:
MemoryBufferSize The total memory size available for buffers.
ProfilesPerBuffer The number of profiles that are gathered in a buffer, before it can
be retrieved by your application. If set to 1, your application will be able to retrieve individual pro­files from the Ruler, but this will also add a substantial overhead to the application, which may result in slower performance.
When running in triggered mode, it is recommended to have this
property set to the same value as the Scan height parameter in the parameter file for the camera.
Timeout Time in milliseconds before a call to
RequestDataSeparate()
times out. If set to -1, the method will never time out.
RulerMode Used for switching the Ruler between Image and Measurement
configuration, that is sending images or sending profiles.
Transformation Used for recalibrating the measured range values between two
coordinate systems. This is further described in the following sec­tion.
When you change any of the properties of the Ruler object (including changing parameter file), you must call the Ruler object’s UpdateParameters()method for the changes to take effect. The Ruler must always be stopped before this method is called.
5.4 Transforming Measurement Values
The measurement values that are retrieved from the Ruler are always calibrated to a local coordinate system. In this coordinate system, the x-axis of this coordinate system is paral­lel with the Ruler, and located at a fixed distance from the camera.
r
0
x
0
Figure 5.3 – Location of the Ruler in the local coordinate system.
Range
(mm)
Ruler 600 Ruler 1200
x0 500 1000
r
0
1000 2000
Origo
(0,0)
X
position (mm)
44 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 5
Ruler E
Ruler API
By setting a transformation for the Ruler object, you can change the coordinate system and receive the measurements in a coordinate system that suits your environment. This is particularly useful if you have several Rulers that measure the same object.
You set a transformation by setting the Transformation property of the Ruler object. The transformation consists of two parts:
Transformation.Rotation A counter-clockwise rotation, specified by the
angle in radians (Angle) and a center of rotation (Center), which is a point in the Ruler’s coordi­nate system
Transformation.Translation The distance to move the origin of the Ruler’s
coordinate system along the x axis (x) and the z axis (range).
Figure 5.4 – Transforming the coordinate system
When you have set a transformation, the Ruler object must be updated for the translation to take effect.
Note that the transformation is performed on the PC and not in the Ruler. Therefore it is included in the parameter files, but must be set by your application. If you always want to use the same transformation with the Ruler, your application should save the transforma­tion parameters in order to be able to retrieve them when re-initializing the Ruler.
Rotation
Center of
rotation
Global coordinates
Translation (negative)
Local coord
i
nates
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 45
Chapter 5 Reference Manual
Ruler E
Ruler API
5.5 Field-of-View
The FieldOfView property of the Ruler object contains the coordinates for the field-of­view for the camera. However, this field-of-view is not exactly the same as the FOV of the Ruler:
$ The FOV of the Ruler is the trapezoid area in the laser plane within which objects could
be measured.
$ The field FieldOfView property is the smallest rectangle that encloses the FOV of
the Ruler.
Figure 5.5 – The FieldOfView property for a non-rotated and a rotated Ruler.
The field-of-view in the Ruler object is thus a bounding box within which all point measured by the Ruler lies. There is no guarantee that the Ruler can measure every point inside this bounding box.
If the Ruler object has a transformation set, the field-of-view rectangle in the API is a rectangle in the global coordinate system – that is, a rectangle that encloses the rotated FOV.
FieldOfView
rectangle
FieldOfView
rectangle
Ruler FOV
Ruler FOV
Ruler without
transformation
Ruler with
transformation
46 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 5
Ruler E
Ruler API
5.6 Rectifying Measurement Values
The Ruler API has a function for rectifying the measurement values – that is, re-sampling the values in order to get profiles where the range, intensity and scatter values are uni­formly distributed along the x-axis. This is useful for example when visualizing the meas­ured object, to keep the correct proportions of the object.
To rectify the measurement values, set the RectifyWidth property to the number of x values in the resulting profiles. If set to 0, the measurement values will not be rectified.
When rectifying, the x values in the resulting profile is first calculated from the Rectify- Width property. The range, intensity or scatter value for each new point along the x-axis is then calculated by interpolating the measurement values in the original profile surround­ing the new x value. If there are no measurement values near the x value to interpolate for, the interpolated value will be set to 0, which means missing data.
Please note that re-sampling the measurement values will add extra load on the CPU.
Figure 5.6 – Rectifying profiles.
Not enough
values
FOV top
FOV bottom
x x
FOV
left
FOV
right
Missing data
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
47
Chapter 6 Reference Manual
Ruler E
Examples
6 Examples
This section shows two programs that are examples on how the APIs could be used retreiv­ing data from a Ruler. These programs are also delivered on the CD in complied versions ready for test.
6.1 ruler_ex
This example shows how to write a simple application using the Ruler C++ API.
The program goes through the following steps:
$ Create a Ruler object and sets the object’s properties using set() methods $ Connect to the Ruler by calling the init() method $ Allocate the arrays needed for retrieving the profiles sent by the Ruler $ Start the Ruler $ Retrieve the profiles using the requestDataSeparate() method, one buffer at a
time, and print out some statistics about the measurement speed.
The program will run until any key is pressed on the keyboard.
When compiling this program, make sure that you link with the icon2.lib library.
#include <string>
/// For _kbhit()
#include <conio.h>
/// For GetTickCount()
#include "windows.h"
/// For Ruler C++ API
#include "ruler_api.h"
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{ cout << "Ruler E example program. " << endl;
const char *ip = "192.168.0.43";
Ruler::Ruler *ruler = Ruler::Ruler::createRuler("MyRuler");
ruler->setCameraAddress(ip); ruler->setRulerMode("Measurement"); ruler->setProfilesPerBuffer(100); ruler->setTimeout(10); ruler->setParameterFile("MyParameterFile_RulerE.PRM");
/// Connect to the ruler and transfer all settings. int ret = ruler->init();
if(ret != 0) { cout << "Ruler init() failed: " << ret << endl; delete ruler; exit(1); }
48 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 6
Ruler E
Examples
/// Allocate memory buffer to receive profiles in: int profiles, width;
ret = ruler->getProfilesPerBuffer(&profiles); if(ret != 0) { cout << "Ruler getProfilesPerBuffer() failed: " << ret << endl; delete ruler; exit(1); }
ret = ruler->getProfileWidth(&width); if(ret != 0) { cout << "Ruler getProfilesPerBuffer() failed: " << ret << endl; delete ruler; exit(1); }
int *status = new int[profiles]; int *mark = new int[profiles]; int *id = new int[profiles];
float *x = new float[profiles*width]; float *range = new float[profiles*width];
unsigned char *intensity = new unsigned char[profiles*width]; unsigned char *scatter = new unsigned char[profiles*width];
/// Start acquisition of profiles. ret = ruler->start();
if(ret != 0) { cout << "Ruler start() failed: " << ret << endl; delete ruler; exit(1); }
int count = 0; while(!_kbhit()) { ret = ruler->requestDataSeparate(profiles, profiles*width, id, status, mark, x, range, intensity, scatter); if((ret != Ruler::Ruler::ErrorCodes::E_ALL_OK) && (ret != Ruler::Ruler::ErrorCodes::E_TIMEOUT)) { cout << "Ruler requestDataSeparate() failed: " << ret << endl; delete ruler; exit(1); }
if(ret == Ruler::Ruler::ErrorCodes::E_ALL_OK) { // Here we can do image processing of the data.
/// Every 10 seconds we output statistics. if((GetTickCount() % 10000) == 0) { cout << ":" << count*profiles/10 << "Hz (total)" << endl; count = 0; }
if(ret == Ruler::Ruler::ErrorCodes::E_ALL_OK) count++; } }
ruler->stop();
if(ret != 0) { cout << "Ruler stop() failed: " << ret << endl; delete ruler; exit(1); }
ruler->close();
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 49
Chapter 6 Reference Manual
Ruler E
Examples
if(ret != 0) { cout << "Ruler close() failed: " << ret << endl; }
delete ruler;
return 0; }
6.2 RulerNetConsoleExample
This example shows how to write a simple application using VB.Net and the RulerNet API.
The program goes through the following steps:
$ Create a Ruler object and sets the object’s properties $ Connect to the Ruler by calling the InitRuler() method $ Allocate the arrays needed for retrieving the profiles sent by the Ruler $ Start the Ruler $ Retrieve the profiles using the RequestDataSeparate() method, one buffer at a
time, and print out some statistics about the measurement speed.
The program will run in an infinite loop.
' Import the Ruler namespace
Imports Ruler.RulerNet
Module Module1
Sub Main()
' Create a new Ruler and give it a name Dim ruler As New Ruler.RulerNet("MyRuler") Dim res As ErrorCodes Dim points, profiles As Integer
' Set the timeout for requesting data to 10 milliseconds. ruler.Timeout = 10
' Set the IP address of the Ruler unit we want to connect to. ruler.CameraAddress = "192.168.0.43"
' Each buffer received from the Ruler will contain 10 profiles. ruler.ProfilesPerBuffer = 10
' Tell the ruler to work in measurement mode. ruler.RulerMode = "Measurement"
' Initialize the Ruler unit with the above settings. res = ruler.InitRuler()
If res <> ErrorCodes.E_ALL_OK Then Console.WriteLine("Error connecting to Ruler: " & res.ToString()) End If
' Get the array sizes. points = ruler.ProfileWidth profiles = ruler.ProfilesPerBuffer
' Create the arrays. Dim x(points * profiles - 1) As Single Dim range(points * profiles - 1) As Single Dim intensity(points * profiles - 1) As Byte Dim scatter(points * profiles - 1) As Byte Dim id(profiles - 1) As Integer Dim status(profiles - 1) As Integer Dim mark(profiles - 1) As Integer
50 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 6
Ruler E
Examples
' Start data acqusition. res = ruler.StartRuler()
If res <> ErrorCodes.E_ALL_OK Then Console.WriteLine("Error starting Ruler: " & res.ToString()) End If
' Request data forever. While True ' Check if there is any buffers available. If ruler.AvailableBuffers >= 0 Then res = ruler.RequestDataSeparate(id, status, Nothing, x, range, intensity, Nothing)
If res = ErrorCodes.E_ALL_OK Then
' .... (Do data processing here)
ElseIf res = ErrorCodes.E_TIMEOUT Then ' ... Timeout occured. Else Console.WriteLine("Error requesting data: " & res.ToString()) End If End If End While
End Sub
End Module
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 51
Chapter 7 Reference Manual
Ruler E
Hardware Description
7 Hardware Description
7.1 Measurement Set Up
The field-of-view (FOV) is located at a certain distance from the Ruler, the stand-off, and is a trapezoid shaped area in the laser plane. The maximum height and the maximum width of the object to be inspected define a rectangle which must be entirely inside the trapezoid total FOV.
Figure 7.1 – The Ruler’s field-of-view
The Ruler delivers profiles at a rate determined by the camera parameter settings. The maximum possible profile rate depends on the chosen measurement accuracy and se­lected region of interest. It should be noted, however, that the maximum usable profile rate in an application may be limited by the surface properties of the inspected objects and the laser strength used. The selected profile rate defines the resolution in the length (moving) direction.
Total
field of view
Stand-off
Example
field of view
Total
height
range
height
width
52 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 7
Ruler E
Hardware Description
Table 7.1- Measurement details.
Ruler E600 Ruler E 1200 Remarks
Example field-of-view (height x width)
250 x 600 mm 250 x 1200 mm Typical height x width.
Stand-off 415 mm 280 mm
Individual deviation may occur.
Total height range 450 mm 1000 mm
Individual deviation may occur.
Width range 450 – 820 mm 500 – 1550 mm
At stand-off level and at maximum distance from Ruler. Individual devia­tions may occur.
Sensor resolution 1536 x 512 pixels 1024 x 512 pixels
Height resolution, typical
0.15 mm 0.4 mm
The sensor row resolu­tion depends on the object distance from Ruler and on the 3D algorithm used.
Max profile rate 10000 profiles/s 10000 profiles/s
Dependent on set-up and application.
Figure 7.2 – Maximum field-of-views for Ruler E 600 and E 1200
Ruler E 600 Ruler E 1200
280 mm
415 mm
500 mm
450 mm 450 mm
1000 mm
820 mm
1550 mm
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
53
Chapter 7 Reference Manual
Ruler E
Hardware Description
7.2 Electrical Connections
The electrical connections are done with M12 plug-connectors and a custom Ethernet IP65 RJ45 connector. There are three or four connectors on the top of the side of the Ruler. The Heating connector is only available on Rulers with the heating option (H­versions).
link data
on
heating
ethernet
function
encoder
power-I/O
Figure 7.3 – Top plate of Ruler with M12 connectors, Ethernet connector, and LEDs
The LEDs on the top plate have the following functions:
LED When lit
On The Ruler is powered.
Function The laser is armed, meaning that there is power on the Laser Power
Supply pin, and the laser is either active or can be activated from an application.
Link The Ruler is connected to an Ethernet network.
Data The Ruler is sending data over the Ethernet connection.
Power - I/O connector (male)
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
1
2
3
4
5
6
7
8
Pin Color* Signal Description
1 White In 1 Enable (24V)
2 Brown Power 24V power supply
3 Green Out 1 Reserved (B-type)
4 Yellow In 2 Reset (24V)
5 Gray TRA TRA, RS485
6 Pink TRB TRB, RS485
7 Blue GND Ground
8 Red In 3 Laser Power Supply (24V)
*Color is valid for cable type DOL-1208-
54 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 7
Ruler E
Hardware Description
2
1
7
6
5
4
3
8
2
1
7
6
5
4
3
8
2
1
7
6
5
4
3
8
Encoder connector (female)
Pin Color** Signal Description
1 White In1 +
Phase 1, RS422 + TTL signal level, terminated
2 Brown In2 +
Phase 2, RS422 + TTL signal level, terminated
3 Green In2 -
Phase 2, RS422 - TTL signal level, terminated
4 Yellow In1 -
Phase 1, RS422 - TTL signal level, terminated
5 Gray GND Ground
6 Pink - Reserved
7 Blue In4 Monitor Enable (24 V)
8 Red Out 2 Reserved (B-type)
**Color is valid for cable type STL-1208-
Heating Connector (male)
Only valid for Rulers with the Heating option (H)
Pin
Color
Signal
Description
1 Brown Power 24V Power Supply
2 White GND Ground
3 Blue GND Ground
4 Black Power 24V Power Supply
5 Green/yellow Out A Temperature Control
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 55
Chapter 7 Reference Manual
Ruler E
Hardware Description
7.3 Technical Data
Table 7.2 – Technical Data for Ruler E:
Technical Data
Imager CMOS
1536 x 512 Ruler E 600
Pixel resolution
1024 x 512 Ruler E 1200
Laser filter 60 nm FWHM
Laser wavelength 660 +/- 15 nm
Laser class
2M and 3B: IEC 60825-1: 2001-8 21CFR 1040.10/11
Laser modes DC
Interfaces
GigaBit Ethernet RS485 Encoder: RS 422 (TTL level) compatible
Digital inputs 3 x HIGH = 10V ... 28.8V
Digital outputs
2 x B - type (reserved); < 100mA total current of all digital outputs
Weight 7.0 kg
Dimensions (lxhxd) 420 x 163 x107 mm
Power supply DC 24 V ± 20%, separate pin for laser supply
Current consumption < 1 A
Ripple < 5 V
PP
Connectors
Power - I/O: M12, 8-pin, male Ethernet: custom IP65 RJ45 Encoder: M12, 8-pin, female Heating: M12, 5-pin, male
Operating temperature
0°C ... 40 °C
-30 ° ... 40 °C with Heating option
Storage temperature -30° C ... 70° C
Single shock 15 g, 3 x 6 directions
Vibration 5 g, 58 ... 150 Hz
Enclosure rating IP 65
Housing material
Aluminium: surface grey varnished Connectors: nickel plated brass Windows: float glass, AR coated
56 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Chapter 7
Ruler E
Hardware Description
7.4 Dimensional Drawings
Figure 7.4 – Ruler E 600 and E 1200 (not to scale)
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 57
Appendix A Reference Manual
Ruler E
Appendix
Appendix
A Ruler E Models and Type Codes
Table A.1 – Ruler E models and type codes
Version
Scatter
Heating
3B Laser
Type Code Part no
Ruler E600
RULER-E2111
1 029 237
Ruler E600 S X
RULER-E2112
1 029 238
Ruler E600 B X
RULER-E2121
1 028 042
Ruler E600 SB X X
RULER-E2122
1 029 239
Ruler E1200 RULER-E1111 1 028 041
Ruler E1200 S X
RULER-E1112
1 029 230
Ruler E1200 H X
RULER-E1211
1 029 231
Ruler E1200 B X RULER-E1121
1 029 233
Ruler E1200 SH X X RULER-E1212
1 029 232
Ruler E1200 SB X X
RULER-E1122
1 029 234
Ruler E1200 HB X X
RULER-E1221
1 029 235
Ruler E1200 SHB X X X
RULER-E1222
1 029 236
58 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Appendix B
Ruler E
Recommended Network Cards
B Recommended Network Cards
Due to the large amount of data that the Rulers delivers, it is required to connect them to the PC using a separate Gigabit Ethernet network, without other interfering traffic.
Recommended network interface cards:
$ Intel PRO 1000GT Desktop adapter $ 3COM 3C2000 adapter
Network interface cards based on RealTek chips generally creates higher CPU load on the PC when receiving streaming data from the Ruler.
The two adapters mentioned above can send and receive Ethernet Jumbo Frames which gives a performance increase (lower CPU usage).
Table B.2 – Recommended network cards and settings
Intel Driver 3COM Driver
Receive Buffers
Recommended setting 512 500
Default settings 256 256
Maximum setting 2048 500
Jumbo Frames
Recommended setting 4500 4500
Default settings disabled disabled
Maximum setting 16128 9014
Note: The maximum frame size used by the Ruler is set by the Max package size parame­ter. This parameter is by default set not to use Jumbo frames.
Without using jumbo frames, the maximum Ethernet frame size is 1518 bytes, which includes 46 bytes used for headers. This means that the maximum size for the data packages that the Ruler can send is 1472 bytes, which should also be the maximum value for the Max package size parameter in the Ethernet Configuration of the Ruler when not using jumbo frames.
When using jumbo frames the Ruler unit can support up to 4054 bytes in each data package, which corresponds to 4100 bytes per Ethernet frame.
Symptoms of Possible Problem
Receive Buffers
Symptoms of too low setting: Multiple consecutive packets are lost, e.g. 31 consecu­tive packets are lost.
Symptoms of too high setting: Use of memory increases.
Jumbo Frames
Symptoms of too low setting: The Ruler will use a smaller size which implies higher CPU load on the PC.
Symptoms of too high setting: If you use a switch, which is unable to support Jumbo Frames, connected between the Ruler and the PC, it is impossible to receive stream­ing data from the Ruler.
TCP/IP settings
IP Address
In the recommended configuration the PC uses IP address 192.168.1.x, where x is 1 – 10.
Net mask
In the recommended configuration the PC uses net mask 255.255.255.0
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 59
Appendix C Reference Manual
Ruler E
Appendix
C Recommended Switches
There are some features of a switch which are important to consider when choosing a switch. One thing is if the switch is capable to handle Ethernet Jumbo frames or not.
Recommended switches: $ NetGear GS716T - 16 port switch
This switch is capable to handle Ethernet Jumbo frames
D iCon Device Configuration
The iCon Device Configuration is a utility for changing the IP address of a Ruler. You start iCon Device Configuration by choosing Launch iCon Device Configuration from the Start menu
Note: You need to have administrator privileges on the PC to be able to use iCon Device Configuration.
Figure D.1 – The iCon Device Configuration window
Update Update the list of available Rulers. Updating the list may take approxi-
mately 15 seconds.
Configure camera Displays a dialog box in which you can change the IP adress of the Ruler
selected in the list. The Ruler will be updated and restarted when you click OK in the dialog box.
60 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Appendix E
Ruler E
Encoder Wire Diagram
E Encoder Wire Diagram
When external synchronization signals are used these should be connected to the Encoder connector according to the following wire diagram.
Warning
Never connect any signals while the Ruler unit is powered. Never connect a powered I/O & Encoder Interface unit to a Ruler. Never connect anything but TTL signal levels
ailure to follow these rules may damage the Ruler unit. F
Each Ruler E is delivered with an Encoder cable. This cable has a M12 plug in one end and is open in the other.
Table E.3 – Ruler E to SICK Stegman Encoder wire diagram
%
WARNING
Ruler E SICK Stegman Encoder
Pin Color* Signal Pin Color Signal
1 White In1 + 8 Pink A+
2 Brown In2 + 5 White B+
3 Green In2 - 6 Brown B-
4 Yellow In1 - 1 Black A-
5 Gray GND 10 Blue GND
6 Pink -
7 Blue In4
8 Red Out 2
*Color is valid for cable type STL-1208-
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 61
Appendix E Reference Manual
Ruler E
Appendix
Wiring example A
This example shows a wire diagram for connecting one Sick Stegman RS422 encoder (DRS-60 with TTL output levels) to two Ruler units. In this example the encoder is con­nected for both forward and backward signals.
1
8
5
4
7
6
3
2
Ruler #1
1
8
5
4
7
6
3
2
Ruler #2
5
10
6
1
8
SICK Stegman Encoder (RS 422)
Figure E.2 – Wiring example
Do not connect more than two Rulers to one Encoder unit without additional driver circuit.
Phase1 RS422+
Phase2 RS422+
Phase2 RS422-
Phase1 RS422-
62 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Appendix E
Ruler E
Encoder Wire Diagram
Wiring example B
This example shows a wire diagram for connecting one Sick Stegman RS422 encoder (DRS-60 with TTL output levels) to two Ruler units. In this example the encoder is con­nected for forward signals.
1
8
5
4
7
6
3
2
Ruler #1
1
8
5
4
7
6
3
2
Ruler #2
5
10
6
1
8
SICK Stegman Encoder (RS 422)
Figure E.3 – Wiring example – forward signals
Do not connect more than two Rulers to one Encoder unit without additional driver circuit
Phase1 RS422+
GND
Phase1 RS422-
GND
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
63
Appendix F Reference Manual
Ruler E
Appendix
F Laser Safety Box
Laser Safety box for Ruler with laser class 3B (B-versions) is used for turning off and on the laser power to the Ruler.
Figure F.4 – Laser Safety box for Ruler with laser class IIIb/3B (B-versions)
Figure F.5 – Laser Safety box connectors and LEDs
Lit if laser power
supply is on
Lit if device
power is on
Input from external
power supply and I/O
Key switch for
laser power
Output to Ruler
Power I/O connector
64 SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved
Reference Manual Appendix F
Ruler E
Laser Safety Box
Figure F.6 – Laser Safety Box function
All pins except pin 8 are connected directly through the box. Pin 8, which is the Laser Power Supply for the Ruler, is switched by the key switch on the Laser safety box.
Technical Data:
Table F.4 – Technical Data for the Laser Safety box:
External power supply and I/O
Laser power
(pin 8)
To the Ruler
Supply voltage V
s
24V +/- 20%
Ripple < 5Vpp
Current consumption (Laser safety box only)
<50 mA
Enclosure Rating IP65
Weight approx. 350gr.
Operating temperature -10 ... +48 °C
Storage temperature -20 ... +70 °C:
SICK IVP • Industrial Sensors • www.sickivp.com • All rights reserved 65
Loading...