A Python 2/3 library for ifm efector O3D3xx 3D cameras
- easy XMLRPC interface with integrated session handling
- PCIC V3 client for result data transfer
Usage with Python 2 requires the 'future' package
Install the package with
$ python setup.py install
For a quick start, go to the examples
folder and run
$ python create_application.py 192.168.0.69
with your device's IP address to create an example application and
$ python image_viewer.py 192.168.0.69
to view the image data coming from the camera (requires matplotlib)
The library provides all XMLRPC objects as mentioned in the camera's XMLRPC manual. The entry point is the RPC main object which can be created with e.g.
camera = o3d3xx.Device("192.168.0.69")
RPC calls can be performed e.g. like this
version_info = camera.getSWVersion()
These are the different RPC objects and the possibilites how they can be acquired:
- Session object
session = camera.requestSession()
This is different from the regular RPC call which only returns the session ID. The session ID can be retrieved fromcamera.sessionID
session = camera.session
(only valid after arequestSession()
call)
- EditMode object
edit = session.startEdit()
which is equivalent toedit = session.setOperatingMode(1)
(again, this is different from the pure RPC call)edit = session.edit
(only valid after astartEdit()
call)
- DeviceConfig object
device = edit.device
- NetworkConfig object
network = edit.network
- ApplicationConfig object
application = edit.editApplication(1)
(different from the pure RPC)application = edit.application
(only valid after aeditApplication()
call)
- ImagerConfig object
imagerConfig = application.imagerConfig
- Spatial filter configuration object
spatialFilter = application.spatialFilter
- Temporal filter configuration object
temporalFilter = application.temporalFilter
The library currently provides three basic clients:
- A simple PCIC V3 client
- Create it with
pcic = o3d3xx.PCICV3Client("192.168.0.69", 50010)
providing the device's address and PCIC port. - Send PCIC commands with e.g.
answer = pcic.sendCommand("G?")
. All asnychronous PCIC messages are discarded while waiting for the answer to the command. - Read back the next PCIC for a particular ticket number. This can be used
to read asynchronously sent results (ticket number "0000"):
answer = pcic.readAnswer("0000")
- Read back any answer coming from the device:
ticket, answer = pcic.readNextAnswer()
- Create it with
- A PCIC client supporting arbitrary formatting
- Define an instance of
o3d3xx.PCICFormat
to describe which data you want to retrieve - Most common use case: retrieval of binary data. For example, if you want
to receive amplitude and radial distance images, use the format
o3d3xx.PCICFormat.blobs("amplitude_image", "distance_image")
. - Create the client with
pcic = o3d3xx.FormatClient("192.168.0.69", format)
withformat
being thePCICFormat
instance described above. - When
result = pcic.readNextFrame()
returns for the given example,result
is a dictionary containing image arrays for the keysamplitude_image
anddistance_image
.
- Define an instance of
- A PCIC client for asynchronous image retrieval
- Deprecated, please use the
o3d3xx.FormatClient
instead, it uses much less network bandwidth if you are not interested in all available image types. - Create it with
pcic = o3d3xx.ImageClient("192.168.0.69", 50010)
. - It configures a PCIC connection to receive all image types.
- Read back the next result (a dictionary containing all the images)
with
result = pcic.readNextFrame()
- Deprecated, please use the
O3D3xx related libraries for other programming languages:
- C++: libo3d3xx
- Ruby: ruby-o3d3xx
o3d3xx-python is available at Github