Open nunoguedelha opened 2 years ago
In addition, in some tests the image is occasionally flickering. Refer to https://github.com/ami-iit/component_ANA-Avatar-XPRIZE/issues/403.
At some point we suspected that the line scattering observed in the fake-framegrabber rendering was due to the simultaneous display of multiple frames, and thus related to the Historical requests (refer to this documentation section). This seems now to be a wrong lead, as we can see in the screenshot below that even a single frame includes multiple lines instead of a singe one for the fake framegrabber.
CC @traversaro @RiccardoGrieco
We publish the image data received through the plugin RealtimeTelemetryPlugin
on a Yarp port /yarpjs/cameraEcho:o
of type bottle
.
For this we added the support of socket.io
and yarp.js
features in the visualizer plugin installation page:
We then use the stream video plugin example of yarp.js
repository to display the streamed images. We can see in the stream the same scattered lines instead of a single one, as we see in the Open-MCT based visualizer.
We can conclude that the line scattered lines issue occurs in the data transmission between the telemetry server and the Open-MCT based visualizer client.
If we break the telemetry server we get a constant sample and thus a fixed frame on the visualizer, similar to the output illustrated on https://github.com/ami-iit/yarp-openmct/issues/71#issuecomment-1063569388, i.e with scattered lines.
This confirms the observation from the previous experiment. We then implement some changes in order to have the server send the raw image data buffer, and the client to apply the conversion to the URI format and base 64 (yarp.getImageSrc(...)
):
https://github.com/ami-iit/yarp-openmct/blob/34cae51cd90077c7d7d63f01f937562d5839ae15/openmctStaticServer/realtime-telemetry-plugin.js#L10-L21
This way it's easier to compare the data sent and received.
I'm suspecting an issue with the way the data transmission is scheduled, which could cause a race condition leading to concurrent data access in the case of big chunks of data, typically image data.
This way it's easier to compare the data sent and received.
/yarpjs/camLeftEye:i
into a yarpview portyarp disconnect /icubSim/camLeftEye /yarpjs/camLeftEye:i
This way, we get a fixed frame on the visualizer, and also on the yarpview display as well:
We can see that the outputs are well aligned. We then break the telemetry server and the client visualizer in order to get in the debugger the sent and received buffers.
point.value.buffer
in the subscribers notification sender notifySubscribers
.
https://github.com/ami-iit/yarp-openmct/blob/3d6105dc8efc7de4eefeef9ed27feba60bc21eba/openmctStaticServer/realtime-telemetry-plugin.js#L5-L11data.value.buffer
in the RealtimeTelemetryPlugin
plugin.
https://github.com/ami-iit/yarp-openmct/blob/34cae51cd90077c7d7d63f01f937562d5839ae15/iCubTelemVizServer/realtime-server.js#L20-L24The buffers are identical.
The problem is not in the transmission of the data between the server and client, but rather in the implementation of the yarp image type port reading.
From the yarp.js
repository examples, we know that the implementation of image type port reading through websockets works pretty well. For that reason we'll try reading the port directly via yarp socket in the visualizer client (no history shall be supported).
For that reason we'll try reading the port directly via yarp socket in the visualizer client (no history shall be supported).
This works pretty well, it solves the scattered lines issue. We can now choose a better protocol for the connection, other than tcp
.
A debug version of the fix is implemented in https://github.com/ami-iit/yarp-openmct/tree/e5e0f28fbe8708954ac8240bfc43819b2955ff02.
This change broke the shutdown sequence. Fixing...
The proper closure of the iCubTelemVizServer
server was blocked by the openmctStaticServer
server hanging at closure itself.
Received SIGINT ...
{
status: 'WRPLY',
message: 'Process (PID 36504) OpenMCT Server stopping (signal SIGINT) ...'
}
iCub Telemetry Server closing: no further connection requests accepted.
Control Console Server closing: no further connection requests accepted.
[OPEN-MCT STATIC SERVER] stdout: Received SIGINT ...
Open-MCT Visualizer Server closing: no further incoming requests accepted. Refreshing the visualizer web page will fail.
Open-MCT Visualizer Server closed: all sockets closed.
The closure process resumes normally after we kill the nodejs
process running the openmctStaticServer
server.
iCub Telemetry Server closing: no further "subscribe"/"unsubscribe" requests accepted.
[INFO] |yarp.os.impl.PortCoreInputUnit| Removing input from /icubSim/inertial to /yarpjs/inertial:i
[INFO] |yarp.os.impl.PortCoreInputUnit| Removing input from /icubSim/left_leg/stateExt:o to /yarpjs/left_leg/stateExt:o
[INFO] |yarp.os.impl.PortCoreInputUnit| Removing input from /icubSim/camLeftEye to /yarpjs/camLeftEye:i
[INFO] |yarp.os.impl.PortCoreInputUnit| Removing input from /walking-coordinator/logger/data:o to /yarpjs/walking-coordinator-logger/data:i
iCub Telemetry Server closing: disconnected network ports.
Data transmission ended.
Closing all Telemetry Server and Control Console sockets!
[
'iCub Telemetry Server closed: all sockets closed.',
'Control Console Server closed: all sockets closed.'
]
Waiting for the debugger to disconnect...
Process finished with exit code 0
The proper closure of the
iCubTelemVizServer
server was blocked by theopenmctStaticServer
server hanging at closure itself.
Further analysis and fix documented in #102 .
Converting current issue into an epic.
Camera view In the visualizer has a very poor performance: pixelation, degraded resolution, color shift (e.g blue->red), delayed input (1min).