Real Time monitoring error

Couldn’t seem to find a git repo to post issue to.

Even with the built in example sensorAndSlider I can get the object itself working correctly, but when you click Real Time monitoring in the web UI at localhost:8080, the console starts to get filled up with:

“error loading the data”

The rest of the example seems to work fine (albeit I’m not using an arduino and haven’t tested actual value output), just not that real time monitoring.

Im testing on Windows 7, Node 0.12.9, in whatever the latest stable Chrome is.

The issue is, that the example is made for the arduino yun and it will only work right with that platform.
But you can use your Windows 7 as a AR-Content providing Server with no IO-Point support.

We are working on a simple possibility to program for other platforms.
Would you be interested to help?

You can find it our work on github under the name:
https://github.com/openhybrid/object/tree/beta_hardwareInterfaces

and a strong conversation is happening here right now:
http://forum.realityeditor.org/t/h-w-config-editor

I think that’s what I’ve essentially achieved so far. My Win 7 can server the AR content, and I was hoping I could just piggy back on one of the UPD broadcast of the parameter values since they seem to be emit() from socket.io.

Love to help. I’m a bit tied up with projects for the next 2 weeks, but I should have a bit of time on the weekends to experiment until I’m more free.

I also get the “error loading the data” message. It always appears when I added a target, click back and then Real Time monitoring. Additionally the I/O points won’t show up in the Reality Editor. When I restart the HybridObjects server, everything works fine. I’m on the beta_hardwareInterfaces branch.

I made a minor update to the beta_hardwareInterfaces that should remove this error message.
The message seems meaning less, as it is send when the objects has no IO-Points to send from.

@Carsten, we will have to check how the IO-Points are added to the server. It might be possible that they are only written in to the object.json file, but not added to the objectExp? When you restart the server, the data is loaded rightfully from that file.

Additional the Object should broadcast an action message to the Reality Editor that provokes the Reality Editor to reload the data.

I will look into it.

UPDATE:
Ok, I think I found the problem. addIO() can only actually add an I/O point after a target has been created because before that there is no valid objectID. We will somehow have to “re-add” the I/O points after a target has been created. But that is difficult because the I/O points are added in the exports.receive() function of a hardware interface which should only be called once. So if anyone has got an idea please let me know :slight_smile:

We could introduce a new function exports.IO() to each hardware interface which then should only call addIO() and clearIO(). We could then recall this function after a target has been created. But that could get complicated with the arduinoYun HW interface, I think. What do you think @valentin ?

Quick answer:
Taking version 0.3.1 as reference, exports.init() is used to ask the hardware interface to run the setup procedures again, including the add() functionality. So yes, we need take care that the initialization can be called when needed.

Looking deeper: I think the Arduino procedure was like this:

If the Arduino code calls add() but no object exists:

  1. HybridObjectsUtilities.createFolder(obj, __dirname, globalVariables.debug);
    is called to make sure that the folder for the new object exists.
  2. Other then this nothing is happening since there is no target and ID jet.

Once a new target is present, the add() calls do add the new IO-Points. Right when the target is uploaded the following is happening:

  1. createObjectFromTarget() https://github.com/openhybrid/object/blob/v0.3.1/server.js [Line: 1240] is called.
    This initializes the object with all needed properties and starts the Heartbeat.

  2. The arduino code is triggered via exports.init() to initialize the add() functions again in order to fill the object values.
    https://github.com/openhybrid/object/blob/v0.3.1/server.js [Line: 1280]

  3. Only once the object exists, the info page is access able.
    Here is the code from the Arduino Yun hardwareInterface that adds new IO-Points:
    https://github.com/openhybrid/object/blob/v0.3.1/hardwareInterfaces/arduinoYun/index.js [Line 197- 251]

Ohh this is so good to have all this discussions.
I realize how important a good documentation is.

1 Like

Ah OK, I think in that case it will be sufficient to simply move the addio() calls into the init() function. I will give it a try tomorrow and let you know if it works.

UPDATE:
I think your fix https://github.com/openhybrid/object/commit/4b7ec31d2604633025586689b2199b2a5836051b might have broken something. Now the Monitoring webpage doesn’t show any I/O points at all it just says “loading the data”. But I couldn’t figure out why that is so far. Your fix absolutely makes sense to me, so it might be something else…

I tried to move the addIO() calls to the init() function and added a call to it right before the call to receive(). That seems to work. The I/O points appear on the RealityEditor without a restart of the server. The yun interface might need some refactoring though because in it’s init() function it writes to the serialPort which might not be open yet. Maybe just moving the serialPort.open() out of the serialServer() will do the trick…

I think this must be a bug within the new web interface implementation.
My guess is that it loads the IO-Points template once.
When init() is called the web interface is not updated rightfully.

I would need to dig deeper in @marcteys web interface code to figure it out my self.

It seems to be a nice workaround.
I tried to fix this issue this morning just by reading the code, but without an iPad it’s very difficult. Still looking but I think valentin you will know more the structure.
Also when I worked on the interface I try to not change the core of your work (but I may be wrong). Maybe the most easy for you is to read the diff of my changes and see If I change something in the core : Diff

1 Like

@marcteys Welcome to the Forum!
I am happy that you joined us.

I think we deal with two problems.

  1. The initialization of the hardware interfaces within the server data structure.
  2. Update within the Web-Frontend for when the initialization happens.

The first point is easy to solve.
For the second point there are some open questions:
Is the web interface loading its structure once a time or is it updating permanently?
Is there some sort of one time initialization for how many IO-Points will be visible?

Concerning point 2:
Just to clarify the issue I’m encountering: The Monitoring web page doesn’t show any I/O points anymore and just says “loading the data”. Even if I restart the server. That used to work! So I think either @valentin or I broke something. As far as I can see the GetAndSendData() function dynamically reads the objectValues and is called every 100ms (see line 302 in HybridObjectsWebFrontend.js). So I think it should just work… But it doesn’t. I will play around some more tomorrow, maybe I messed something up in my branch and it is working for you? Do you experience the same issue?

I read the forum at least once a week, I was just not active yet :slight_smile:

The monitor interface load the structure once. All the static html templates are loaded on the loadBaseTemplate function and stored in the baseTemplate variable. Then L224, the app get the details (index, IOName, origin, etc).
Every 100ms, the app read the values and then replace (so interface not loaded) the row in the monitor.html who have the data-variable or data-objects attribute. The full object array named jsonUpdate can be exposed line 293. The function templateModule.updateTemplate() create the table and return the html element. This update loop is made every 100ms, each time loading the variables directly from the core.

@valentin, do you have the same problem ?
A clue to solve that is to the line 227 , to know if the code gets to this point.

I will try to find an iPhone / iPad in the next couple of days, not guaranteed.

I think I’m on to something: The if statement in line 296 never resolves to true in my installation. So the webpage doesn’t get updated. I will investigate further and let you know what I find.

FYI: I’m running the server on my Windows Laptop and I’m opening the webpage on the same Laptop.

In the javascript console I get some socket.io Errors:

Failed to load resource: net::ERR_CONNECTION_REFUSED
Failed to load resource: net::ERR_CONNECTION_REFUSED
Failed to load resource: net::ERR_CONNECTION_REFUSED
GET http://localhost/socket.io/?EIO=3&transport=polling&t=1452088586516-3 net::ERR_CONNECTION_REFUSED
GET http://localhost/socket.io/?EIO=3&transport=polling&t=1452088593571-4 net::ERR_CONNECTION_REFUSED
GET http://localhost/socket.io/?EIO=3&transport=polling&t=1452088600620-5 net::ERR_CONNECTION_REFUSED
GET http://localhost/socket.io/?EIO=3&transport=polling&t=1452088607628-6 net::ERR_CONNECTION_REFUSED

We should continue the discussion in the New hardwareinterfaces API thread.