openrave
openrave copied to clipboard
Osg viewer truncates update viewer update commands
How to reproduce
Draw more than 1000 axes in a loop
import numpy
viewer = env.GetViewer()
indices = range(2000)
Ts = []
offset = 0
for i in indices:
T = numpy.eye(4)
T [:3, 3] = [offset, 0 , 0]
#T[:3, 3] = numpy.random.random(3)
Ts += [T]
offset += 0.01
handlers = []
for i in indices:
handlers.append(misc.DrawAxes(env, Ts[i], dist=0.025, linewidth=4))
Observation
Only 1000 Axes are drawn on the viewer, suspect the following piece truncating the number of adding child to scene graph
// plugins/qtosgrave/qtosgviewer.cpp
void QtOSGViewer::_PostToGUIThread(const boost::function<void()>& fn, bool block)
{
if( _nQuitMainLoop != -1 ) {
// viewer quit, so anything posted won't get processed
return;
}
boost::mutex::scoped_lock lockmsg(_mutexGUIFunctions);
if( _listGUIFunctions.size() > 1000 ) {
// can happen if system is especially slow
//RAVELOG_WARN_FORMAT("too many gui post commands, ignoring %d", _listGUIFunctions.size());
return;
}
@Hsifnus
The trivial solution to this would be to expand or remove the limit on _listGUIFunctions.size(). That being said, would it be better if certain functions sent to _PostToGUIThread were able to be condensed down into a single function pushed onto _listGUIFunction that accumulates similar function calls and calls each one in sequence?