How to: configure the camera

The O3R has multiple parameters that have an influence on the point cloud. Some of them affect the raw measurement and others modify how the data is converted into x,y,z, etc values. These parameters can be changed to better fit your applications and this document presents how. You can refer to this page for a detailed description of each parameter.

The ifm3d API provides functions to read and set the configuration of the device. Note that JSON formatting is used for all the configurations.

For this process, an O3R object has to be initialized to establish a connection with the device (please have a look at the code example provided for full details of the imported libraries).

o3r = O3R()

Note: if you are using multiple ifm devices (O3D, O3X, O3R), you can use the Device class.

dev = Device()

Note

The GetInitStatus returns the status of the device’s initialization process. Use it to ensure the device is properly booted up before querying for data.

Read the current configuration

The first provided function outputs the current configuration of the device (the VPU and each head currently attached). This function outputs the full configuration, including the parameters set for each camera head, but also other aspects like MAC and IP addresses, etc.

conf = o3r.get();

Write a new configuration

To set a new configuration, you need to provide said configuration in JSON formatting. The provided configuration can be a subset or the full configuration, as long as it follows the proper JSON hierarchy.

o3r.set({'device':{'info':{'name':'great_o3r'}}})

Note: we use string literals for easier readability.

The full example

import json

# Define the ifm3d objects for the communication
from ifm3dpy.device import O3R

o3r = O3R()

# Get the current configuration
config = o3r.get()

# Print a little part from the config to verify the configuration
print(json.dumps(config["device"]["swVersion"], indent=4))
# Note: this assumes that a camera is plugged into port 1
print(config["ports"]["port1"]["state"])

# Let's change the name of the device
o3r.set({"device": {"info": {"name": "great_o3r"}}})

# Double check the configuration
config = o3r.get()
print(config["device"]["info"]["name"])