Add robotiq force display

This commit is contained in:
David Walsh
2019-05-22 14:41:40 -04:00
parent 8af9aecfb0
commit 71f81af9b0
4 changed files with 88 additions and 15 deletions

View File

@@ -186,6 +186,15 @@ robotiqDataTopic.subscribe(function(message) {
document.getElementById("robotiqY").innerHTML = force.y.toFixed(1)
document.getElementById("robotiqZ").innerHTML = force.z.toFixed(1)
var totalForce = math.norm([force.x, force.y, force.z]).toFixed(1)
var totalForcePercent = totalForce/2
doc = document.getElementById("robotiqForceBar");
doc.style.width = totalForcePercent + "%";
doc.innerHTML = totalForce + " N";
doc.setAttribute('aria-valuenow', totalForce);
if ((Math.abs(force.x) > 0.5) || (Math.abs(force.y) > 0.5) || (Math.abs(force.z) > 0.5))
{
document.getElementById("calibrateButton").className = "btn btn-danger"