Moved around files into sub directories, Fixed form submission call function so that it does not refresh page on enter key
This commit is contained in:
95
index.html
95
index.html
@@ -2,27 +2,33 @@
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<script type="text/javascript" src="eventemitter2.min.js"></script>
|
||||
<script type="text/javascript" src="roslib.min.js"></script>
|
||||
<!--
|
||||
Link to included files. These are typically done by fetching from the web.
|
||||
Because this needs to run without an internet conection, the files were saved
|
||||
locally
|
||||
-->
|
||||
<script type="text/javascript" src="include/eventemitter2.min.js"></script>
|
||||
<script type="text/javascript" src="include/roslib.min.js"></script>
|
||||
|
||||
<!-- <link rel="stylesheet" href="bootstrap.min.css">
|
||||
<script src="jquery.min.js"></script>
|
||||
<script src="bootstrap.min.js"></script> -->
|
||||
<!-- Bootstrap is a beatuful and usefull library of GUIs. Docs can be found here: http://getbootstrap.com/
|
||||
Tutorials can be found here: http://www.w3schools.com/bootstrap/default.asp
|
||||
-->
|
||||
<link rel="stylesheet" href="include/bootstrap.min.css">
|
||||
<script src="include/jquery.min.js"></script>
|
||||
<script src="include/bootstrap.min.js"></script>
|
||||
<script src="include/roslib.js"></script>
|
||||
|
||||
|
||||
<audio id="audio" src="audio/beep-04.mp3" autostart="false" ></audio>
|
||||
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<link rel="stylesheet" href="bootstrap.min.css">
|
||||
<script src="jquery.min.js"></script>
|
||||
<script src="bootstrap.min.js"></script>
|
||||
|
||||
<script src="roslib.js"></script>
|
||||
|
||||
<audio id="audio" src="beep-04.mp3" autostart="false" ></audio>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
var ros = new ROSLIB.Ros();
|
||||
|
||||
ros.connectionName = 'ws://192.168.1.102:9090';
|
||||
ros.connectionName = 'ws://192.168.1.103:9090';
|
||||
// ros.connectionName = 'ws://localhost:9090';
|
||||
|
||||
|
||||
@@ -32,7 +38,6 @@
|
||||
document.getElementById("ConnectionIPInput").value = ros.connectionName;
|
||||
document.getElementById("ConnectionIPLabel").innerHTML = 'No connection';
|
||||
document.getElementById("ConnectionButton").className = "btn btn-warning"
|
||||
|
||||
console.log(error);
|
||||
});
|
||||
|
||||
@@ -51,13 +56,24 @@
|
||||
// Create a connection to the rosbridge WebSocket server.
|
||||
ros.connect(ros.connectionName);
|
||||
|
||||
function attemptConnection()
|
||||
|
||||
// attept to connect to the ros master from the IP given orgrab it from the form
|
||||
ros.attemptConnection = function(ipAddress)
|
||||
{
|
||||
ros.connectionName = document.getElementById("ConnectionIPInput").value;
|
||||
if( typeof ipAddress !== "undefined")
|
||||
{
|
||||
ros.connectionName = ipAddress;
|
||||
}
|
||||
else
|
||||
{
|
||||
ros.connectionName = document.getElementById("ConnectionIPInput").value
|
||||
}
|
||||
console.log('Connection = ' + ros.connectionName);
|
||||
ros.connect(ros.connectionName);
|
||||
}
|
||||
|
||||
|
||||
// LISTENER ///
|
||||
var voltageListener = new ROSLIB.Topic({
|
||||
ros : ros,
|
||||
name : '/asctec/LL_STATUS',
|
||||
@@ -100,16 +116,19 @@
|
||||
{
|
||||
document.getElementById("VoltageDisplay").className = "progress-bar progress-bar-success"
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
function updateUpTime(time)
|
||||
{
|
||||
document.getElementById("UpTime").innerHTML = time
|
||||
}
|
||||
};
|
||||
|
||||
window.setInterval(function(){
|
||||
// ShowTime();
|
||||
}, 100);
|
||||
|
||||
function validateForm()
|
||||
{
|
||||
ros.attemptConnection();
|
||||
return false;
|
||||
};
|
||||
|
||||
</script>
|
||||
</head>
|
||||
@@ -123,18 +142,17 @@
|
||||
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
<form>
|
||||
<div id="ConnectionIPForm" class="form-group has-warning has-feedback" align="center">
|
||||
<form class="form-inline" role="form" onsubmit="return validateForm()">
|
||||
<div id="ConnectionIPForm" class="form-group has-warning" align="center">
|
||||
<label id="ConnectionIPLabel" class="col-sm-3 control-label" for="inputWarning">Connection warning</label>
|
||||
<div class="col-sm-6">
|
||||
<input type="text" class="form-control" id="ConnectionIPInput" value="No IP Address yet">
|
||||
<input type="text" class="form-control" id="ConnectionIPInput" value="No IP Address yet"/>
|
||||
<script type="text/javascript">
|
||||
document.getElementById("ConnectionIPInput").value = ros.connectionName;
|
||||
//document.getElementById("ConnectionIPInput").value = ros.connectionName;
|
||||
</script>
|
||||
<!-- <span class="glyphicon glyphicon-remove form-control-feedback"></span> -->
|
||||
</div>
|
||||
<div class="col-sm-1">
|
||||
<button id="ConnectionButton" type="button" class="btn btn-warning" onclick=attemptConnection()>Connect</button>
|
||||
<button id="ConnectionButton" type="button" class="btn btn-warning" onclick="ros.attemptConnection()">Connect</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
@@ -148,25 +166,26 @@
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
|
||||
<label class="col-sm-2"> Battery Voltage: </label>
|
||||
<div class="progress">
|
||||
<div id="VoltageDisplay" class="progress-bar progress-bar-striped active" role="progressbar"
|
||||
aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width:100%" >
|
||||
No data recieved yet.
|
||||
<div class="row">
|
||||
<label class="col-sm-2"> Battery Voltage: </label>
|
||||
<div class="progress">
|
||||
<div id="VoltageDisplay" class="progress-bar progress-bar-striped active" role="progressbar"
|
||||
aria-valuenow="40" aria-valuemin="0" aria-valuemax="100" style="width:100%" >
|
||||
No data recieved yet.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<label class="col-sm-2"> Up Time: </label>
|
||||
<div class="col-sm-1" id="UpTime" align="left">
|
||||
N/A
|
||||
</div>
|
||||
<div>
|
||||
seconds
|
||||
|
||||
<div class="row">
|
||||
<label class="col-sm-2"> Up Time (s): </label>
|
||||
<div class="col-sm-1" id="UpTime">
|
||||
N/A
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user