Software trigger mode in python environment #386
Replies: 6 comments 15 replies
-
This is known issue with the Firmware version 0.16.23, where the camera has to be triggered two to four times to successfully acquire the frame. The State of the Port has to be changed from IDLE --> RUN --> IDLE before triggering the camera. The following code snippet gives anidea of working with swTrigger() via Python API. from ifm3dpy import FrameGrabber, buffer_id, O3R
import matplotlib.pyplot as plt
cam = O3R()
config = cam.to_json()
# Set the PORT state to IDLE before Triggering --> two state iterations required
for i in range(2):
config['ports']['port2']['state'] = "RUN" #Expecting a head on Port 2
cam.set(config)
pcic_Port = config['ports']['port2']['data']['pcicTCPPort']
config['ports']['port2']['state'] = "IDLE"
cam.set(config)
fg = FrameGrabber(cam, pcic_Port)
fg.start([buffer_id.RADIAL_DISTANCE_IMAGE])
# Iterate the Software Trigger until the software trigger is accepted
for _ in range(5):
fg.sw_trigger()
[ok, frame_port2] = fg.wait_for_frame().wait_for(200) # We estimate 100ms @ 10 Hz + some additional network delay/latency
if ok:
print('successfully the image is acquired')
break
else:
print('Frame is not acquired in 200 milli Seconds. Triggering again')
rad_distance_image = frame_port2.get_buffer(buffer_id.RADIAL_DISTANCE_IMAGE)
plt.imshow(rad_distance_image)
plt.show() This issue will be solved in the future releases. If you have any further questions please let us know. |
Beta Was this translation helpful? Give feedback.
-
I have just small question. i have two camera heads at port2 and port3. So my question regarding swtriggergroup value. both ports have different swtrigger value? How can i differentiate swtrigger group while data acquisition is on going. Because i am working mostly with 3D data and due multi camera interference, there are some noise points (flying pixels). So i want to avoid this noise using swtrigger. And at start of camera heads, would it be in RUN mode or IDLE mode? |
Beta Was this translation helpful? Give feedback.
-
Hi, I tried followed python code and i am getting 3D data 1 in 5 execution. I tried to execute code and sometimes i have output only from 1 sensor or sometimes from another camera. Do you have any suggestion? o3r = O3R() for i in range(2): fg_try = FrameGrabber(o3r, pcic_Port2) for _ in range(5): async def bottom(): async def upper(): async def run_both_async_funcs(): def worker1(): worker1() |
Beta Was this translation helpful? Give feedback.
-
Hi @dekhanra, My application is to capture same scene with two 3d camera (both mounted in same direction but at different height) and merge both pointclouds. But if both camera run at same time then multi camera interference occurs and increase unwanted noise in pointclouds. So my objective is run both camera parallel with different channelvalue and using software trigger for acquiring pointclouds. |
Beta Was this translation helpful? Give feedback.
-
It sounds like you are trying to acquire the data at same time from the both the cameras. You can try the following things which may work for your application.
Please try this and let me know if this works BR |
Beta Was this translation helpful? Give feedback.
-
Crosstalk mitigation For multi camera setups there are two possible routes to mitigate multi camera interference:
Based on the two (three) options above the simplest implementation is 1. For details on how to set each parameter see the documentation on ifm3d.com For details on the software implementation for option 1 / 2.1 see the suggestions given earlier (this QA thread). I hope this clears things up. If you have additional questions about the principles discussed here, please implement the different options and benchmark them independently. BR |
Beta Was this translation helpful? Give feedback.
-
Hi, I am using two O3R camera with VPU. Both camera runs parallel for grabbing an image and 3D data. So i want to configure both camera on software trigger mode. But i am getting always stuck at frame= await fg.wait_for_frame().
I have installed ifm3dpy==1.1.1 version. Here is my whole code with configuration. Can you help me to set both camera for software trigger mode.
from ifm3dpy import O3R, FrameGrabber, buffer_id
import asyncio
o3r = O3R('10.100.100.31')
o3r.set(
{
"applications": {
"classes": {
"ods": {
"instanceSchema": {},
"license": "UNLICENSED",
"minimumFirmwareVersion": {
"major": 0,
"minor": 16,
"patch": 3
},
"version": {
"major": 0,
"minor": 0,
"patch": 0
}
}
}
},
"device": {
"clock": {
"currentTime": 1581090712488271648,
"sntp": {
"active": True,
"activeServerAddress": "",
"activeServerName": "time1.google.com",
"availableServers": [],
"systemClockSynchronized": False
}
},
"diagnostic": {
"confInitStages": [
"device",
"ports",
"applications"
],
"temperatures": [
{
"entity": "PLL-therm",
"value": 31.0
},
{
"entity": "MCPU-therm",
"value": 31.0
},
{
"entity": "PMIC-Die",
"value": 100.0
},
{
"entity": "Tboard_tegra",
"value": 26.0
},
{
"entity": "GPU-therm",
"value": 28.0
},
{
"entity": "BCPU-therm",
"value": 31.0
},
{
"entity": "thermal-fan-est",
"value": 29.5
},
{
"entity": "Tdiode_tegra",
"value": 26.75
}
],
"upTime": 68000000000
},
"info": {
"description": "",
"device": "0302",
"deviceTreeBinaryBlob": "tegra186-quill-p3310-1000-c03-00-base.dtb",
"features": {},
"guiSettings": "",
"name": "",
"partNumber": "OVP800",
"productionState": "AA",
"serialNumber": "000020228630",
"vendor": "0001"
},
"log": {
"components": {},
"level": "warn",
"storage": "volatile"
},
"network": {
"authorized_keys": "",
"interfaces": {
"eth0": {
"ipAddressConfig": 0,
"ipv4": {
"address": "10.100.100.31",
"dns": "255.255.255.0",
"gateway": "10.100.100.1",
"mask": 24
},
"mac": "48:B0:2D:55:03:AC",
"networkSpeed": 1000,
"useDHCP": False
},
"eth1": {
"ipAddressConfig": 0,
"mac": "00:02:01:43:70:24",
"networkSpeed": 0,
"useDHCP": True
}
}
},
"status": "OPERATE",
"swVersion": {
"euphrates": "1.18.3",
"firmware": "0.16.23-823",
"kernel": "4.9.140-l4t-r32.4+g8c7b68130d9a",
"l4t": "r32.4.3",
"schema": "v1.4.1",
"tcu": "1.0.4"
}
},
"ports": {
"port0": {
"acquisition": {
"delay": 0,
"framerate": 10.0,
"version": {
"major": 0,
"minor": 0,
"patch": 0
}
},
"data": {
"algoDebugConfig": {
"version": {
"major": 0,
"minor": 13,
"patch": 12
}
},
"availablePCICOutput": [
"RGB_INFO"
],
"pcicTCPPort": 50010
},
"info": {
"calibration": {
"version": {
"major": 0,
"minor": 1,
"patch": 0
}
},
"device": "2301",
"deviceTreeBinaryBlobOverlay": "001-ov9782.dtbo",
"features": {
"fov": {
"horizontal": 127,
"vertical": 80
},
"resolution": {
"height": 800,
"width": 1280
},
"type": "2D"
},
"icc": {
"version": {
"major": 0,
"minor": 0,
"patch": 0
}
},
"name": "",
"partNumber": "M03933",
"productionState": "AA",
"sensor": "OV9782",
"sensorID": "OV9782_127x80_noIllu_Csample",
"serialNumber": "000000000812",
"vendor": "0001",
"version": {
"major": 11,
"minor": 1,
"patch": 0
}
},
"mode": "standard_autoexposure2D",
"processing": {
"extrinsicHeadToUser": {
"rotX": 0.45,
"rotY": 0.0,
"rotZ": 0.0,
"transX": -0.15,
"transY": 1.74,
"transZ": -0.07
},
"version": {
"major": 0,
"minor": 13,
"patch": 12
}
},
"state": "RUN"
},
"port1": {
"acquisition": {
"delay": 0,
"framerate": 10.0,
"version": {
"major": 0,
"minor": 0,
"patch": 0
}
},
"data": {
"algoDebugConfig": {
"version": {
"major": 0,
"minor": 13,
"patch": 12
}
},
"availablePCICOutput": [
"RGB_INFO"
],
"pcicTCPPort": 50011
},
"info": {
"calibration": {
"version": {
"major": 0,
"minor": 1,
"patch": 0
}
},
"device": "2301",
"deviceTreeBinaryBlobOverlay": "001-ov9782.dtbo",
"features": {
"fov": {
"horizontal": 127,
"vertical": 80
},
"resolution": {
"height": 800,
"width": 1280
},
"type": "2D"
},
"icc": {
"version": {
"major": 0,
"minor": 0,
"patch": 0
}
},
"name": "",
"partNumber": "M03933",
"productionState": "AA",
"sensor": "OV9782",
"sensorID": "OV9782_127x80_noIllu_Csample",
"serialNumber": "000000000809",
"vendor": "0001",
"version": {
"major": 11,
"minor": 1,
"patch": 0
}
},
"mode": "standard_autoexposure2D",
"processing": {
"extrinsicHeadToUser": {
"rotX": 0.0,
"rotY": 0.0,
"rotZ": 0.0,
"transX": 0.0,
"transY": 0.635,
"transZ": 0.0
},
"version": {
"major": 0,
"minor": 13,
"patch": 12
}
},
"state": "RUN"
},
"port2": {
"acquisition": {
"channelSelection": "manual",
"channelValue": 2,
"delay": 0,
"exposureLong": 1200,
"exposureShort": 1000,
"framerate": 15.0,
"offset": 0.0,
"swTriggerGroup": 2,
"version": {
"major": 0,
"minor": 0,
"patch": 0
}
},
"data": {
"algoDebugConfig": {
"version": {
"major": 0,
"minor": 13,
"patch": 12
}
},
"availablePCICOutput": [
"TOF_INFO",
"RADIAL_DISTANCE_NOISE",
"RADIAL_DISTANCE_COMPRESSED",
"REFLECTIVITY",
"AMPLITUDE_COMPRESSED",
"CONFIDENCE"
],
"pcicTCPPort": 50012
},
"info": {
"calibration": {
"version": {
"major": 0,
"minor": 4,
"patch": 2
}
},
"device": "3101",
"deviceTreeBinaryBlobOverlay": "001-irs2381c.dtbo",
"features": {
"fov": {
"horizontal": 60,
"vertical": 45
},
"resolution": {
"height": 172,
"width": 224
},
"type": "3D"
},
"icc": {
"version": {
"major": 1,
"minor": 0,
"patch": 6
}
},
"name": "",
"partNumber": "M03933",
"productionState": "AA",
"sensor": "IRS2381C",
"sensorID": "IRS2381C_60x45_4x2W_60x45_C2",
"serialNumber": "000000000812",
"vendor": "0001",
"version": {
"major": 11,
"minor": 1,
"patch": 0
}
},
"mode": "standard_range4m",
"processing": {
"diParam": {
"anfFilterSizeDiv2": 2,
"dynamicSymmetryThreshold": 20.0,
"enableTemporalFilter": True,
"maxDistNoise": 0.05,
"medianSizeDiv2": 0,
"minAmplitude": 30.0,
"minReflectivity": 3.0,
"mixedPixelFilterMode": 1,
"mixedPixelThresholdRad": 0.05
},
"extrinsicHeadToUser": {
"rotX": 0.45,
"rotY": 0.0,
"rotZ": 0.0,
"transX": -0.15,
"transY": 1.7,
"transZ": -0.15
},
"version": {
"major": 0,
"minor": 13,
"patch": 12
}
},
"state": "IDLE"
},
"port3": {
"acquisition": {
"channelSelection": "manual",
"channelValue": 4,
"delay": 0,
"exposureLong": 3000,
"exposureShort": 1000,
"framerate": 20.0,
"offset": 0.0,
"swTriggerGroup": 3,
"version": {
"major": 0,
"minor": 0,
"patch": 0
}
},
"data": {
"algoDebugConfig": {
"version": {
"major": 0,
"minor": 13,
"patch": 12
}
},
"availablePCICOutput": [
"TOF_INFO",
"RADIAL_DISTANCE_NOISE",
"RADIAL_DISTANCE_COMPRESSED",
"REFLECTIVITY",
"AMPLITUDE_COMPRESSED",
"CONFIDENCE"
],
"pcicTCPPort": 50013
},
"info": {
"calibration": {
"version": {
"major": 0,
"minor": 4,
"patch": 2
}
},
"device": "3101",
"deviceTreeBinaryBlobOverlay": "001-irs2381c.dtbo",
"features": {
"fov": {
"horizontal": 60,
"vertical": 45
},
"resolution": {
"height": 172,
"width": 224
},
"type": "3D"
},
"icc": {
"version": {
"major": 1,
"minor": 0,
"patch": 6
}
},
"name": "",
"partNumber": "M03933",
"productionState": "AA",
"sensor": "IRS2381C",
"sensorID": "IRS2381C_60x45_4x2W_60x45_C2",
"serialNumber": "000000000809",
"vendor": "0001",
"version": {
"major": 11,
"minor": 1,
"patch": 0
}
},
"mode": "standard_range4m",
"processing": {
"diParam": {
"anfFilterSizeDiv2": 2,
"dynamicSymmetryThreshold": 20.0,
"enableTemporalFilter": True,
"maxDistNoise": 0.05,
"medianSizeDiv2": 0,
"minAmplitude": 30.0,
"minReflectivity": 3.0,
"mixedPixelFilterMode": 1,
"mixedPixelThresholdRad": 0.5
},
"extrinsicHeadToUser": {
"rotX": 0.0,
"rotY": 0.0,
"rotZ": 0.0,
"transX": 0.0,
"transY": 0.638,
"transZ": 0.0
},
"version": {
"major": 0,
"minor": 13,
"patch": 12
}
},
"state": "IDLE"
}
}
}
)
o3r.save_init()
async def bottom():
fg = FrameGrabber(o3r, pcic_port=50012)
fg.start([buffer_id.NORM_AMPLITUDE_IMAGE,buffer_id.RADIAL_DISTANCE_IMAGE,buffer_id.XYZ])
fg.sw_trigger()
frame = await fg.wait_for_frame()
cartesian_3d = frame.get_buffer(buffer_id.XYZ)
fg.stop()
async def upper():
fg = FrameGrabber(o3r, pcic_port=50013)
fg.start([buffer_id.NORM_AMPLITUDE_IMAGE,buffer_id.RADIAL_DISTANCE_IMAGE,buffer_id.XYZ])
fg.sw_trigger()
frame = await fg.wait_for_frame()
cartesian_3d = frame.get_buffer(buffer_id.XYZ)
fg.stop()
def worker():
loop = asyncio.new_event_loop()
asyncio.set_event_loop(loop)
asyncio.ensure_future(bottom())
asyncio.ensure_future(upper())
loop.run_forever()
worker()
Beta Was this translation helpful? Give feedback.
All reactions