Skip to main content

Custom Widget

The Custom Widget is a powerful addition for dashboards which gives you complete customization over the look and feel of the widget. You can easily bind this to any of your telemetry to visualize the data the way you want.

The Custom Widget gives you the ability to create a fully customized widget by writing their own HTML/CSS/JS code.


The custom widget can also use the Rocos JS SDK in the JS tab to access their robot telemetry.

To create a Custom Widget click on the 'Add Widget' button on the Dashboards page and then select the 'Custom' widget button. This will open the Preview window with a code editor allowing the user to enter their code, at any point in time the user can click on the 'Refresh Preview' button to see how their widget will perform.


This is the HTML element code that will be injected as part of the widget.


Any custom style sheets to customize the look and feed of the widget.


Any Javascript function that will used by the widget. An example below shows a function used to subscribe to the Heartbeat telemetry of the robot that will update the widget HTML. NOTE the __onDestroy() method which is needed in order to clean up resources once the user navigates to another page in the Portal.

var sub = null;
var disconnectionTimer = null;
var latestMessageReceivedAt = null;
var widgetCreatedAt =;
var timeoutInterval = 5000;

var heartbeatElement = document.getElementById('heart');

function subscribe() {
var projectId = rocos.context.projectId;
var callsign = rocos.context.callsign;
var source = '/rocos/agent/telemetry/heartbeat?int=1s';

sub = rocos.clientService.subscribe(

sub.subscription = sub.observable.subscribe((res) => {
if (res) {
latestMessageReceivedAt =;


setTimeout(() => {
}, 500);


function unsubscribe() {
if (sub) {
sub = null;

function checkDisconnection() {
disconnectionTimer = setInterval(() => {
var comparedWith = latestMessageReceivedAt ? latestMessageReceivedAt : widgetCreatedAt;

// Timeout
if ( - comparedWith > timeoutInterval) {
}, timeoutInterval);


//IMPORTANT: This method needs to be included when subscribing to telementry, in order for the Portal to
//disconnect from the Agent once the user navigates to another page
function __onDestroy() {

Use Case - Historical Images