45 lines
1.1 KiB
JavaScript
45 lines
1.1 KiB
JavaScript
function sendRosMessageExample()
|
|
{
|
|
publishStringExample(String(document.getElementById("sendRosMessageExample").value))
|
|
}
|
|
|
|
function update_sendRosMessageExample(msg)
|
|
{
|
|
document.getElementById("recievedMessageDiv").innerHTML = msg
|
|
}
|
|
|
|
function update_ProgressBar(value)
|
|
{
|
|
|
|
// This would be a great way of getting a float or int from a rosTopic and displaying it.
|
|
// I would suggest storing the data as a data field in the ros_scripts then updating it every 500 or 1000 ms rather than updating the gui every time you recieve a message
|
|
var num_string = "";
|
|
num_string = num_string.concat(value);
|
|
num_string = num_string.substring(0,4);
|
|
num_string = num_string.concat("%");
|
|
|
|
doc = document.getElementById("progressBar1");
|
|
|
|
doc.style.width = num_string;
|
|
doc.innerHTML = num_string;
|
|
|
|
if (value < 50 && value > 25 ) {
|
|
doc.className = "progress-bar progress-bar-warning";
|
|
}
|
|
else if ( value <= 25)
|
|
{
|
|
doc.className = "progress-bar progress-bar-danger";
|
|
}
|
|
else
|
|
{
|
|
doc.className = "progress-bar progress-bar-success";
|
|
}
|
|
}
|
|
|
|
|
|
window.setInterval(function(){
|
|
|
|
update_ProgressBar(Math.random() * 100);
|
|
|
|
}, 1000);
|