通过 COM 从 MATLAB 将数据馈送到 Google Earth 插件
我目前正在使用 MATLAB/Simulink 和 Google Earth 进行飞行模拟项目。我想做的是让 MATLAB/Simulink 进行所有计算和模拟,并让 Google Earth 实时显示结果。
为了连接这两个程序,我使用 COM 接口,而 MATLAB/Simulink 作为 COM 客户端,Internet Explorer 作为 COM 服务器。在此之前,我一直使用 Google Earth COM API 而不是 Google Earth API(javascript 的)。但是,COM API 中的某些功能不可用或受到限制(例如:俯仰、横滚)。
因此,我求助于 Google Earth 插件。下面是 Web 应用程序的示例。
http://www.hs-augsburg.de/~bizz145/earth /fps/index3.html
使用 DOM,我可以写入网页。但我的问题是,如何刷新我在输入区域中所做的更改。是否可以通过 COM 触发事件(在我的例子中为 onClick 或 onBlur)?除了使用 Form 元素将数据提供给 Google Earth 之外,还有其他更好的解决方案吗?
I am currently working on a flight simulation project with MATLAB/Simulink and Google Earth. What I want to do, is to have MATLAB/Simulink doing all the calculations and simulations and Google Earth to display the result in real time.
To interface the two programmes, I am using COM interface, whereas MATLAB/Simulink as COM-Client and Internet Explorer as COM-server. Before that, I've been using Google Earth COM API instead of Google Earth API (the javascript one). But, some of the functions are not available or limited) in COM API (e.g: pitch, roll).
Therefore, I am resorting to Google Earth Plugin. Here is the example, how the web application should look like.
http://www.hs-augsburg.de/~bizz145/earth/fps/index3.html
Using DOM, I can write to the webpage. But my problem is, how can I refresh the change that I made in the input area. Is event triggering possible via COM (in my case onClick or onBlur)? Is there any better solution instead of using the Form element to feed the data to Google Earth?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
是的,可以通过 COM 分派“触发”事件,但您不需要这样做。如果您在 matlab 中托管 html 文档,只需使用 execScript() 调用您需要的方法...例如
UpdateCamera 将是“host.html”中的 COM 可见方法 - 类似...
关于“之字形”运动”评论 - 问题是 Google 地球插件中动画的飞行速度。要解决此问题,只需将以下行添加到您的主机 html 中即可。
此外,为了进一步平滑动画,最好通过 api 的 frameend 事件触发动画。请参阅:http://earth-api-samples.googlecode .com/svn/trunk/examples/event-frameend.html
Yes dispatching an event 'triggering' is possible via COM, but you don't need to do that. If you are hosting the html document in matlab simply use execScript() to call the methods you require...e.g.
UpdateCamera would be a COM visible method in 'host.html' - something like...
With regard to the "zig zag motion" comment - the issue is the fly to speed of the animation in the Google Earth Plugin. To resolve simply add the following lines to you host html.
Also, to smooth the animation even further it would be optimal to trigger the animation via the api's frameend event. See: http://earth-api-samples.googlecode.com/svn/trunk/examples/event-frameend.html
我们使用 xmlhttp 请求(下面的 JavaScript)解决了这个问题。在我们的例子中,我们没有从 Matlab 驱动可视化,但问题是相同的......如何将新值存入模拟可视化中。
这是它的工作原理。
这个设置对我们来说效果很好。网络负载很小。
从服务器读取数据相关的延迟约为 150 毫秒,如果您认真对待 sim 保真度,这对您来说可能很重要。鉴于 GE 在加载地形和构建数据方面的异步行为,它可能无法满足严肃的实时模拟科学家的要求。但是,让 GE 社区为您完成所有地形建模是无可比拟的!
We solved this problem using xmlhttp request (javascript below). In our case we weren't driving the visualization from Matlab but the problem is the same... how do you deposit new values into your simulation visualization.
Here's how it works.
This setup has worked out well for us. The network load is tiny.
The latency associated with reading data off the server is about 150 msec which may matter to you if you are serious about sim fidelity. Given the asynchronous behavior of GE in loading terrain and building data it may not satisfy the serious real-time simulation scientist. But you can't beat having the GE community do all your terrain modeling for you!
为什么不为 matlab 设置 xml-rpc 或 json-rpc 服务器并使用 ajax 请求从网页轮询它。然后可以使用 JavaScript API 更新相机角度。
Why not set up a xml-rpc or json-rpc server for matlab and poll it from the webpage using ajax requests. The camera angle can then be updated using the javascript api.