Argon.js:错误:尚未收到框架状态 [英] Argon.js: Error: A frame state has not yet been received

查看:167
本文介绍了Argon.js:错误:尚未收到框架状态的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用argon.js服务器端,以便可以将lla坐标转换为预定义的参考框架。我当然不渲染任何图形,我只是用它来转换值。请参阅此类问题
使用地理坐标而不是笛卡尔坐标绘制氩气和A型架
以获得详细信息。

I am attempting to use argon.js server side so that I can convert lla coordinates to a predefined reference frame. I'm not rendering any graphics of course, I'm just using it to convert values. See SO question Using Geo-coordintes Instead of Cartesian to Draw in Argon and A-Frame for details.

对于该线程,我试图为固定坐标创建铯实体,稍后将使用它创建相对于它的其他实体。当我这样做时,一切都会运行,直到我到达程序的最后一行 var gtrefEntityPose = app.context.getEntityPose(gtrefEntity); 我会收到错误:尚未收到帧状态

Per that thread, I am trying to create a cesium entity for a fixed coordinate which I will later use to create other entities relative to it. When I do, everything runs until I get to the last line of the program var gtrefEntityPose = app.context.getEntityPose(gtrefEntity); where I receive Error: A frame state has not yet been received.

起初,我认为这可能是由于将默认引用实体设置为 app.context.setDefaultReferenceFrame(app.context.localOriginEastUpSouth); 因为我还没有本地用户,因为它是服务器端。我查看了 setDefaultReferenceFrame 的文档以及可能需要的文档使用 convertEntityReferenceFrame 以及每个的源代码,但我无法

At first I thought this might be due to the setting the default reference entity to app.context.setDefaultReferenceFrame(app.context.localOriginEastUpSouth); since I did not have a local user yet due to it being server side. I looked up the documentation for setDefaultReferenceFrame as well as the possibility that I might need to use convertEntityReferenceFrame as well as the source code for each, but I am unable to make sense of it given my knowledge of the program.

我将错误以及应用程序代码放在下面。

I've put the error as well as my application code below.

感谢您的帮助!

/home/path/to/folder/node_modules/@argonjs/argon/dist/argon.js:4323
    if (!cesium_imports_1.defined(this.serializedFrameState)) throw new Error(
                                                                ^
Error: A frame state has not yet been received
at ContextService.Object.defineProperty.get [as frame] (/home/path/to/folder/node_modules/@argonjs/argon/dist/argon.js:4323:89)
at ContextService.getTime (/home/path/to/folder/node_modules/@argonjs/argon/dist/argon.js:4343:32)
at ContextService.getEntityPose (/home/path/to/folder/node_modules/@argonjs/argon/dist/argon.js:4381:37)
at Object.<anonymous> (/home/path/to/folder/test.js:27:35)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)

这是我的代码:

var Argon = require('@argonjs/argon');

var Cesium = Argon.Cesium;


var Cartesian3 = Cesium.Cartesian3;
var ConstantPositionProperty = Cesium.ConstantPositionProperty;
var ReferenceFrame = Cesium.ReferenceFrame;
var ReferenceEntity = Cesium.ReferenceEntity;
//var degToRad = THREE.Math.degToRad;

const app = Argon.init();
app.context.setDefaultReferenceFrame(app.context.localOriginEastUpSouth);

var data = { lla : { x : -84.398881, y : 33.778463, z : 276 }};

var gtref = Cartesian3.fromDegrees(data.lla.x, data.lla.y, data.lla.z);
var options = { position: new ConstantPositionProperty(gtref, ReferenceFrame.FIXED),
            orientation:  Cesium.Quaternion.IDENTITY
          };

var gtrefEntity = new Cesium.Entity(options);
var gtrefEntityPose = app.context.getEntityPose(gtrefEntity);


推荐答案

按照目前的设计,argon.js不会服务器端工作。特别是,在argon.js获得用户的地理空间位置和方向之前,不会设置局部坐标系,这可以从Argon4(如果您在Argon4 Web浏览器中运行)获得,也可以从Web地理位置和设备方向API(如果您在其他浏览器中运行)。

As it's currently designed, argon.js won't work server-side. In particular, the local coordinate frame is not set until argon.js has obtained a geospatial position and orientation for the "user", which is obtained either from Argon4 (if you are running in the Argon4 web browser) or from a combination of the web geolocation and deviceorientation API's (if you are running in a different browser).

具有完整的6D姿势(3D位置+ 3D方向),系统不知道用户的位置和观看方向,并且无法建立本地欧几里得坐标框架。因此, app.context.localOriginEastUpSouth 仍未定义(铯实体存在,但未设置位置和方向),而 app.context.getEntityPose( gtrefEntity)将会失败。

With a full 6D pose (3D position + 3D orientation), the system does not know the position and viewing direction of the user, and cannot establish a local euclidean coordinate frame. Thus app.context.localOriginEastUpSouth remains undefined (the Cesium Entity exists, but it's position and orientation are not set), and app.context.getEntityPose(gtrefEntity) will fail.

要在服务器端使用argon.js,您需要对其进行修改以允许程序手动设置观看者的位置和方向。我可以想象这样做,甚至可以在具有移动客户端定期将姿势发送回服务器(例如通过socket.io)的系统中使用它。在您不关心观看方向的情况下(例如,如果您只是担心用户的位置),您可以将方向设置为身份,而忽略返回姿势中的方向。

To use argon.js server-side, you would need to modify it to allow the program to manually set the position and orientation of the viewer. I could imagine doing that, and even using it in a system that has the mobile client periodically sending the pose back to the server (via socket.io, for example). In situations where you don't care about the viewing direction (e.g., if you're just worrying about the position of the user) you could just set the orientation to identity and ignore the orientation in the returned pose.

这篇关于Argon.js:错误:尚未收到框架状态的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆