Comments (3)
@LuoQuestionmark as the sensors are not HW synced, the better approach is to use the newly added Sync node which syncs them based on timestamps.
See https://github.com/luxonis/depthai-python/blob/main/examples/Sync/depth_video_synced.py for an example.
from depthai-core.
So I am wondering if there is a "hidden buffer" somewhere within the program that save the outdated frame?
#366 and its PRs allow the host-side queue to be zero. Then nothing is stored or buffered...incoming data only goes to callbacks.
from depthai-core.
Thanks for your comments, I actually forgot that the issue was still open. So here is my update on the subject.
The answer to the question "if there is a 'hidden buffer'" is no. That said, there are actually two co-existing buffers, which I consider as sort of a bad design of api.
The following code
mono_xout1->input.setQueueSize(1);
mono_xout1->input.setBlocking(false);
was working as expected, to make the xout
work as a non-blocking queue.
Meanwhile, there is a second buffer configured while using the following code:
auto depth_queue = device.getOutputQueue("DEPTH");
.
The source code (version 2.24)
///////////////// Device.hpp
/**
* Gets an output queue corresponding to stream name. If it doesn't exist it throws
*
* @param name Queue/stream name, created by XLinkOut node
* @returns Smart pointer to DataOutputQueue
*/
std::shared_ptr<DataOutputQueue> getOutputQueue(const std::string& name);
/**
* Gets a queue corresponding to stream name, if it exists, otherwise it throws. Also sets queue options
*
* @param name Queue/stream name, set in XLinkOut node
* @param maxSize Maximum number of messages in queue
* @param blocking Queue behavior once full. True specifies blocking and false overwriting of oldest messages. Default: true
* @returns Smart pointer to DataOutputQueue
*/
std::shared_ptr<DataOutputQueue> getOutputQueue(const std::string& name, unsigned int maxSize, bool blocking = true);
//////////////// Device.cpp
std::shared_ptr<DataOutputQueue> Device::getOutputQueue(const std::string& name) {
// Throw if queue not created
// all queues for xlink streams are created upfront
if(outputQueueMap.count(name) == 0) {
throw std::runtime_error(fmt::format("Queue for stream name '{}' doesn't exist", name));
}
// Return pointer to this DataQueue
return outputQueueMap.at(name);
}
std::shared_ptr<DataOutputQueue> Device::getOutputQueue(const std::string& name, unsigned int maxSize, bool blocking) {
// Throw if queue not created
// all queues for xlink streams are created upfront
if(outputQueueMap.count(name) == 0) {
throw std::runtime_error(fmt::format("Queue for stream name '{}' doesn't exist", name));
}
// Modify max size and blocking
outputQueueMap.at(name)->setMaxSize(maxSize);
outputQueueMap.at(name)->setBlocking(blocking);
// Return pointer to this DataQueue
return outputQueueMap.at(name);
}
Now, the thing is, if this function is called without specifying maxSize
and blocking
, it will use the default setting from DataQueue.hpp
, which is the following:
DataOutputQueue(const std::shared_ptr<XLinkConnection> conn, const std::string& streamName, unsigned int maxSize = 16, bool blocking = true);
which means a second buffer is created as a blocking=True
and maxSize=16
.
So at the end of day we got a blocking=false
maxSize=1
buffer, and a blocking=true
maxSize=16
buffer. The combination is, alas, blocking=true
maxSize=16
. Along side with the issue mentioned as frame drifting, the frame drifting is slowly but steady.
So after specifying the configuration of the second buffer, the problem has been solved. We have had our program running for 17 days without any observable delay after the changes.
aDevice.getOutputQueue("RGB", 1, false); // after the first config for xlink
from depthai-core.
Related Issues (20)
- [Feature-Request] Question about the performance limitation and mono isp scale function HOT 1
- [Documentation] Use depthai-core library in Android HOT 1
- [BUG] {Unable to get imu data with queues callback} HOT 2
- [BUG] Unable to access to 4 TOFs from 4 S5K33D through OAK-FFC-4P HOT 2
- [BUG] Where is this file XLink/XLinkTime.h ? HOT 1
- [Feature-Request] Add options to avoid installing some dependencies with Hunter HOT 8
- Feature Request: Add `maxSensitivityIso` to `setAutoExposureLimit()` HOT 5
- [Feature-Request] {Frame sync for OAK-T} HOT 1
- [Feature-Request] Live Update of ImageManip Mesh HOT 2
- Fatal error. Please report to developers. Log: 'Fatal error on MSS CPU: trap: 09, address: 80290064' '0' HOT 7
- [BUG] OAK-FFC-6P detects only 3 cameras at a time HOT 2
- [BUG] error: no member named 'numShaves' in 'dai::ToFProperties' HOT 3
- [BUG] Intermittent Issues with OAK-D W PoE Cameras Streaming Left Camera Data HOT 10
- [BUG] Will not generate ninja compile files with external compiled xlink directory HOT 1
- [BUG] depthai-core.dll will not link HOT 9
- [BUG] host get wrong message from outputQueue HOT 2
- `DeviceBootloader::flashUserBootloader()` fails yet it returns success HOT 3
- [BUG] {nlohmann_json Hunter Download error ("Failure when receiving data from the peer")} HOT 8
- [BUG] {mingw64 XLinkConnection.cpp fails to compile due to an error in immintrin.h} HOT 1
- [BUG] Catching errors HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from depthai-core.