Replies: 2 comments 1 reply
|
Hello @nathantg sharing our experience since we also ran into a similar issue when preparing Yamcs Studio displays for our previous mission. importPackage(java.lang);
var Runnable = java.lang.Runnable;
var Thread = java.lang.Thread;
var timerRunnable = new Runnable({
run: function() {
while (true) {
// Clear the image first to force a refresh
widgetController.setPropertyValue("image_file", "");
try {
Thread.sleep(1);
} catch (e) {
// Handle interruption if needed
}
// Set the image file
widgetController.setPropertyValue("image_file", "reconstructed_images/lastimage1.png");
try {
// Wait for 1 second before next refresh
Thread.sleep(1000);
} catch (e) {
// Handle interruption if needed
}
}
}
});
var timerThread = new Thread(timerRunnable);
timerThread.start();However I don't remember the "could not load image" error so your might be experiencing a different situation. Hope these pointers help somehow! |
|
Assuming that the path to the image is a parameter value, you probably want to make sure that this values is only emitted after the image file has been fully written to disk. That would be my only guess for your "Could not load image" error. Else, see I concur with @ljburtz idea of sourcing your images from a bucket instead of a local path. This would also work in Yamcs Studio by setting image_file to something like ys://{mybucket}/{some/object.png}. |
Uh oh!
There was an error while loading. Please reload this page.
I have multiple images coming from spacecraft being downlinked to my ground station (where I run yamcs studio). I want to be able to display these images into an image widget, with the ability to select which file in a file list to display in the widget. I would also like the most recent image to be displayed upon arrival without the need to refresh the OPI. What would be the best way to do this?
I currently have this implemented, where I have arrow buttons to change the image that is being displayed. And the images are placed in a directory within the workspace for the Java script to read. However, when a new file is placed in the directory, the information for the image is accessible (the script knows the new file is there), but I get a "Could not load image" error when the script called the setPropertyValue() function with the file path. It's not until I refresh the OPI will the image be displayed.
Some advice on the best way to approach this would be great!
All reactions