Hi,<br><br>I just found this thread, sorry I didn't join earlier! Thanks for uploading those movies, the second one really helps demonstrate the lag issue.<br><br>Well, I'm almost certain the issue is that ParaViewSocketPlugin doesn't work very well for this type of high frequency rendering. I've been working on a similar remote control app, but instead of using a Wiimote to send camera manipulations, it uses KiwiViewer on iOS/Android (I'll get a movie uploaded and send you the url.) I also started with ParaViewSocketPlugin, but had to drop it in favor of a different design. So lets say the Wiimote program is sending 100 updates a second, but ParaView renders at a slower rate, lets say 30 fps for example. While ParaViewSocketPlugin is handling the very first message from the Wiimote, it receives 3 more. The problem is that it then processes the next message, instead of merging all 3 of those messages to a single camera manipulation. The longer you interact, ParaViewSocketPlugin falls further and further behind. Normally, we don't worry about any of these details when using a mouse, because Qt talks with X11 and merges pending mouse events.<br>
<br>Here's a quick hack that might work: in your python code, instead of calling Render(), or doing any work that requires a non trivial amount of time, just store the updated camera parameters and return as soon as possible. Next, modify the Qt code in ParaViewSocketPlugin to create a QTimer that fires at 30 hz. Connect the QTimer to a slot callback that execs a python code to take the current camera parameters and Render(). Hopefully, the result is that the messages arriving on the socket in ParaViewSocketPlugin empty instantly, and ParaView renders at 30 hz using the latest camera parameters.<br>
<br>Alternative designs could remove the QTimer and integrate better with the Qt event loop, so that the Wiimote sends events just like a mouse does. An advantage of something like ParaViewSocketPlugin is that you have more flexibility because you can exec arbitrary python code.<br>
<br>Pat<br><br><br><br><div class="gmail_quote">On Thu, Sep 6, 2012 at 5:38 PM, Bueter, Travis J. (S&T-Student) <span dir="ltr"><<a href="mailto:tjbxv7@mail.mst.edu" target="_blank">tjbxv7@mail.mst.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div link="blue" vlink="purple" lang="EN-US">
<div>
<p class="MsoNormal">Today I uploaded two videos to Youtube, showing the basics of what is happening. They can be found via the following links:<u></u><u></u></p>
<p style="margin-left:.75in">
<u></u><span>1.<span style="font:7.0pt "Times New Roman"">
</span></span><u></u><a href="http://www.youtube.com/watch?v=68yeT8t0TUc&feature=youtu.be" target="_blank">http://www.youtube.com/watch?v=68yeT8t0TUc&feature=youtu.be</a><u></u><u></u></p>
<p style="margin-left:.75in">
<u></u><span>2.<span style="font:7.0pt "Times New Roman"">
</span></span><u></u><a href="http://www.youtube.com/watch?v=Linns_iSBro&feature=youtu.be" target="_blank">http://www.youtube.com/watch?v=Linns_iSBro&feature=youtu.be</a><u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p>The init.py file used now uses “renView.InteractiveRender()” instead of just “Render()”, as suggested by Utkarsh. (Thank you again for that suggestion by the way!)<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">The first video is the mouse-based manipulation of 20MB of earthquake data. As shown, LOD is not active and my computer has no problem panning, rotating, etc. in near real-time.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Now in the second video you see how ParaView acts when using the Wii Nunchuk. The first part, without LOD active, you can see the extreme delay after I let go. After turning on LOD, the rendering speed does improve quite a bit but it is
still not nearly as instantaneous as the mouse is without LOD. Also the data doesn’t fully re-render after releasing the joystick; a mouse click is still required. I think I can remedy that just by sending “Render()” when the joystick is released.
<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">So my current goal is to get the Wii Nunchuk application running the ParaView rendering at least at 90% of the capacity of what the mouse can, only using LOD if it is required when using the mouse also. I’m clueless as what else I can do
with sending commands to the Python Shell to speed things up. Are there any ideas of how to reach this goal from where I am now? Whether it be improving the current process of sending Python commands or using a completely different process of manipulating
the rendering from an external application.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Also here is some more insight as to what the Wii application is actually doing in terms of interacting with ParaView. Just in case it could be useful information:<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p style="margin-left:.75in">
<u></u><span>1.<span style="font:7.0pt "Times New Roman"">
</span></span><u></u>The application is written in C++. During initialization, it connects to the server socket and loads the init.py file through the following commands:<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.75in;text-indent:.25in"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:.75in;text-indent:.25in">svr.sin_family = AF_INET;<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.75in;text-indent:.25in">svr.sin_port = htons(9000);<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.75in;text-indent:.25in">inet_aton(“127.0.0.1”, &svr.sin_addr);<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.75in;text-indent:.25in">s = socket(AF_INET, SOCK_STREAM, 0);<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.75in;text-indent:.25in">connect(s, (const sockaddr*)&svr, sizeof(sockaddr_in));<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.75in;text-indent:.25in">write(s, “execfile(‘init.py’)”, sizeof(“execfile(‘init.py’)”));<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:.75in;text-indent:.25in"><u></u> <u></u></p>
<p style="margin-left:.75in">
<u></u><span>2.<span style="font:7.0pt "Times New Roman"">
</span></span><u></u>From there, every time the joystick is moved outside of its “deadzone” the following lines are ran:<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:1.0in"><u></u> <u></u></p>
<p class="MsoNormal" style="margin-left:1.0in">stringstream ss;<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:1.0in">ss.str(std::string());<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:1.0in">ss << “command(“ << x_value << “,” << y_value << “);”;<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:1.0in">const std::string temp = ss.str();<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:1.0in">const char* cstr = temp.c_str();<u></u><u></u></p>
<p class="MsoNormal" style="margin-left:1.0in">write(s, cstr, strlen(cstr));<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p style="margin-left:.75in">
<u></u><span>3.<span style="font:7.0pt "Times New Roman"">
</span></span><u></u>I’m pretty sure that it is not the C++ side of my Wii application slowing things down. Using ‘printf()’s, all the ‘write()’s happen and finish without any noticeable delay.<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">I’m still open to any suggestions out there! All help is very appreciated
<span style="font-family:Wingdings">J</span><u></u><u></u></p><div class="im">
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal">Thanks,<u></u><u></u></p>
<p class="MsoNormal"><u></u> <u></u></p>
<p class="MsoNormal"><b><span style="font-family:"Times New Roman","serif"">Travis J. Bueter<u></u><u></u></span></b></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman","serif"">----------------------------------------------------------------------<u></u><u></u></span></p>
<p class="MsoNormal"><i><span style="font-family:"Times New Roman","serif"">Missouri University of Science and Technology - Junior<b><u></u><u></u></b></span></i></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman","serif"">B.S. Computer Engineering/Computer Science<u></u><u></u></span></p>
<p class="MsoNormal"><a href="mailto:tjbxv7@mail.mst.edu" target="_blank"><span style="font-family:"Times New Roman","serif";color:windowtext">tjbxv7@mail.mst.edu</span></a><span style="font-family:"Times New Roman","serif""><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman","serif""><a href="tel:%28573%29-238-5843" value="+15732385843" target="_blank">(573)-238-5843</a><u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman","serif""><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman","serif"">IT RSS<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman","serif"">Treasurer – MS&T Robotics Competition Team<u></u><u></u></span></p>
<p class="MsoNormal"><span style="font-family:"Times New Roman","serif"">----------------------------------------------------------------------<u></u><u></u></span></p>
<p class="MsoNormal"><span style="color:#1f497d"><u></u> <u></u></span></p>
<p class="MsoNormal"><span style="color:#1f497d"><u></u> <u></u></span></p>
</div></div>
</div>
<br>_______________________________________________<br>
Powered by <a href="http://www.kitware.com" target="_blank">www.kitware.com</a><br>
<br>
Visit other Kitware open-source projects at <a href="http://www.kitware.com/opensource/opensource.html" target="_blank">http://www.kitware.com/opensource/opensource.html</a><br>
<br>
Please keep messages on-topic and check the ParaView Wiki at: <a href="http://paraview.org/Wiki/ParaView" target="_blank">http://paraview.org/Wiki/ParaView</a><br>
<br>
Follow this link to subscribe/unsubscribe:<br>
<a href="http://www.paraview.org/mailman/listinfo/paraview" target="_blank">http://www.paraview.org/mailman/listinfo/paraview</a><br>
<br></blockquote></div><br>