update arduino/Betas/RGB_V1.1.1/main/data/index.html.
parent
22db9b46cc
commit
90ea3f6b25
|
@ -4,6 +4,7 @@ HW:Ver 1.5
|
|||
FW:Ver 1.2
|
||||
-->
|
||||
<html lang="zh-cn">
|
||||
|
||||
<head>
|
||||
<title>自平衡莱洛三角形</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
||||
|
@ -12,10 +13,12 @@ FW:Ver 1.2
|
|||
<meta content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" name="viewport">
|
||||
<style>
|
||||
/*input框*/
|
||||
input, button {
|
||||
input,
|
||||
button {
|
||||
border: none;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
.tl-input {
|
||||
width: 100%;
|
||||
border: 1px solid #ccc;
|
||||
|
@ -30,6 +33,7 @@ input, button {
|
|||
-o-transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s;
|
||||
transition: border-color ease-in-out .15s, box-shadow ease-in-out .15s
|
||||
}
|
||||
|
||||
.tl-input:focus {
|
||||
border-color: #66afe9;
|
||||
outline: 0;
|
||||
|
@ -74,6 +78,7 @@ input, button {
|
|||
-webkit-box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);
|
||||
box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);
|
||||
}
|
||||
|
||||
.ant-btn-red {
|
||||
color: #fff;
|
||||
background-color: #FF5A44;
|
||||
|
@ -131,6 +136,7 @@ input, button {
|
|||
background: linear-gradient(to right, #ffa200, white 0%, white);
|
||||
background-size: 100% 100%;
|
||||
}
|
||||
|
||||
#control input[type="button"] {
|
||||
padding: 5px;
|
||||
margin: 5px 0;
|
||||
|
@ -145,49 +151,38 @@ input, button {
|
|||
<script type="text/javascript" src="highcharts.js"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
var ShaftVelocity;
|
||||
|
||||
var HighchartsData = new Array(8);
|
||||
$(function () {
|
||||
$(document).ready(function () {
|
||||
Highcharts.setOptions({ global: { useUTC: false } });
|
||||
var chart;
|
||||
$('#container').highcharts({
|
||||
chart: {type: 'spline', animation: Highcharts.svg, marginRight: 10, events: {
|
||||
load: function() {
|
||||
// set up the updating of the chart each second
|
||||
var series = this.series[0];
|
||||
var chart, time = new Date().getTime();
|
||||
$("#container").highcharts({
|
||||
chart: { type: "spline", animation: Highcharts.svg, marginRight: 10, events: { load: function () {
|
||||
var series = this.series;
|
||||
setInterval(function () {
|
||||
var x = (new Date()).getTime(), y = parseFloat(ShaftVelocity);
|
||||
series.addPoint([x, y], true, true);
|
||||
var x = new Date().getTime();
|
||||
for(i=0; i<HighchartsData.length;i++){
|
||||
series[i].addPoint([x, HighchartsData[i]], true, true);
|
||||
}
|
||||
}, 1000);
|
||||
}
|
||||
}
|
||||
},
|
||||
title: {text: '动态走势图' },
|
||||
xAxis: {type: 'datetime', tickPixelInterval: 100 },
|
||||
yAxis: {title: {text: '动态走势图' }, plotLines: [{value: 0, width: 1, color: '#808080' }] },
|
||||
tooltip: {
|
||||
formatter: function() {
|
||||
return '<b>'+ this.series.name +'</b><br/>'+
|
||||
Highcharts.dateFormat('%Y-%m-%d %H:%M:%S', this.x) +'<br/>'+
|
||||
Highcharts.numberFormat(this.y, 2);
|
||||
}
|
||||
},
|
||||
legend: { enabled: false },
|
||||
title: { text: "自平衡莱洛三角形" }, xAxis: { type: "datetime", tickPixelInterval: 100 }, yAxis: { title: { text: "Value" }, plotLines: [{ value: 0, width: 1, color: "#808080" }] },
|
||||
tooltip: { formatter: function () { return ( "<b>" + this.series.name + "</b><br/>" + Highcharts.dateFormat("%Y-%m-%d %H:%M:%S", this.x) + "<br/>" + Highcharts.numberFormat(this.y, 2) ); } },
|
||||
legend: { enabled: true },
|
||||
exporting: { enabled: false },
|
||||
series: [{name: 'ShaftVelocity',
|
||||
data: (function() {
|
||||
// generate an array of random data
|
||||
var data = [], time = (new Date()).getTime(), i;
|
||||
for (i = -30; i <= 0; i++) {
|
||||
data.push({
|
||||
x: time + i * 1000,
|
||||
y: 0
|
||||
});
|
||||
}
|
||||
return data;
|
||||
})()
|
||||
}]
|
||||
plotOptions: { spline: { marker: { radius: 4, lineColor: "#666666", lineWidth: 1} } },
|
||||
series: [
|
||||
{name: "轴速度",data: (function () {var data = [], i; for (i = -30; i <= 0; i++) { data.push({x: time + i * 1000, y: 0});}return data;})()},
|
||||
{name: "电机电压",data: (function () {var data = [], i; for (i = -30; i <= 0; i++) { data.push({x: time + i * 1000, y: 0});}return data;})()},
|
||||
{name: "目标速度",data: (function () {var data = [], i; for (i = -30; i <= 0; i++) { data.push({x: time + i * 1000, y: 0});}return data;})()},
|
||||
{name: "摆角",data: (function () {var data = [], i; for (i = -30; i <= 0; i++) { data.push({x: time + i * 1000, y: 0});}return data;})()},
|
||||
{name: "目标角",data: (function () {var data = [], i; for (i = -30; i <= 0; i++) { data.push({x: time + i * 1000, y: 0});}return data;})()},
|
||||
{name: "pitch",data: (function () {var data = [], i; for (i = -30; i <= 0; i++) { data.push({x: time + i * 1000, y: 0});}return data;})()},
|
||||
{name: "kalAngleZ",data: (function () {var data = [], i; for (i = -30; i <= 0; i++) { data.push({x: time + i * 1000, y: 0});}return data;})()},
|
||||
{name: "回旋速率",data: (function () {var data = [], i; for (i = -30; i <= 0; i++) { data.push({x: time + i * 1000, y: 0});}return data;})()}
|
||||
]
|
||||
});
|
||||
});
|
||||
});
|
||||
|
@ -220,14 +215,9 @@ function loadXMLDoc(path,element)
|
|||
function UpdateInfo()
|
||||
{
|
||||
var xmlhttp;
|
||||
if (window.XMLHttpRequest)
|
||||
{
|
||||
// IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
|
||||
if (window.XMLHttpRequest){ // IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
|
||||
xmlhttp=new XMLHttpRequest();
|
||||
}
|
||||
else
|
||||
{
|
||||
// IE6, IE5 浏览器执行代码
|
||||
} else { // IE6, IE5 浏览器执行代码
|
||||
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
|
||||
}
|
||||
xmlhttp.onreadystatechange=function()
|
||||
|
@ -235,7 +225,6 @@ function UpdateInfo()
|
|||
if (xmlhttp.readyState==4 && xmlhttp.status==200)
|
||||
{
|
||||
var arr=xmlhttp.responseText.split(",");
|
||||
|
||||
document.getElementById('TimeDiv').innerHTML=arr[0];
|
||||
document.getElementById('CurrentMillis').innerHTML=arr[1];
|
||||
document.getElementById('log_control').value=arr[2];
|
||||
|
@ -270,7 +259,9 @@ function UpdateInfo()
|
|||
if(document.getElementById('v_p_22').value=="") document.getElementById('v_p_22').value=arr[12];
|
||||
|
||||
if(document.getElementById('log_control').value=="1" && arr[13]!=""){
|
||||
ShaftVelocity = arr[13];
|
||||
for(i=0; i<HighchartsData.length;i++){
|
||||
HighchartsData[i] = parseFloat(arr[i+13]);
|
||||
}
|
||||
document.getElementById('Shaft_Velocity').innerHTML =arr[13]+"<br>"+document.getElementById('Shaft_Velocity').innerHTML;
|
||||
document.getElementById('motor_voltage_q').innerHTML=arr[14]+"<br>"+document.getElementById('motor_voltage_q').innerHTML;
|
||||
document.getElementById('target_velocity').innerHTML=arr[15]+"<br>"+document.getElementById('target_velocity').innerHTML;
|
||||
|
@ -291,49 +282,44 @@ function UpdateInfo()
|
|||
xmlhttp.send();
|
||||
}
|
||||
|
||||
function MyAutoRun()
|
||||
{
|
||||
function MyAutoRun() {
|
||||
UpdateInfo();
|
||||
}
|
||||
setInterval("MyAutoRun()", 1000);
|
||||
|
||||
function clearLog()
|
||||
{
|
||||
document.getElementById('Shaft_Velocity').innerHTML ="";
|
||||
document.getElementById('motor_voltage_q').innerHTML ="";
|
||||
document.getElementById('target_velocity').innerHTML ="";
|
||||
document.getElementById('pendulum_angle').innerHTML ="";
|
||||
document.getElementById('target_angle').innerHTML ="";
|
||||
document.getElementById('pitch').innerHTML ="";
|
||||
document.getElementById('kalAngleZ').innerHTML ="";
|
||||
document.getElementById('gyroZrate').innerHTML ="";
|
||||
function clearLog() {
|
||||
document.getElementById("Shaft_Velocity").innerHTML = "";
|
||||
document.getElementById("motor_voltage_q").innerHTML = "";
|
||||
document.getElementById("target_velocity").innerHTML = "";
|
||||
document.getElementById("pendulum_angle").innerHTML = "";
|
||||
document.getElementById("target_angle").innerHTML = "";
|
||||
document.getElementById("pitch").innerHTML = "";
|
||||
document.getElementById("kalAngleZ").innerHTML = "";
|
||||
document.getElementById("gyroZrate").innerHTML = "";
|
||||
}
|
||||
function clearDebugLog()
|
||||
{
|
||||
document.getElementById('debug_log').value ="";
|
||||
function clearDebugLog() {
|
||||
document.getElementById("debug_log").value = "";
|
||||
}
|
||||
|
||||
function checkNum(obj) {
|
||||
//检查是否是非数字值
|
||||
if (isNaN(obj.value)) {
|
||||
if (isNaN(obj.value)) { //检查是否是非数字值
|
||||
obj.value = "";
|
||||
}
|
||||
if (obj != null) {
|
||||
//检查小数点后是否对于两位
|
||||
if (obj.value.toString().split(".").length > 1 && obj.value.toString().split(".")[1].length > 2) {
|
||||
//alert("小数点后多于两位!");
|
||||
if (obj != null) { //检查小数点后是否对于两位
|
||||
if (
|
||||
obj.value.toString().split(".").length > 1 &&
|
||||
obj.value.toString().split(".")[1].length > 2
|
||||
) { //alert("小数点后多于两位!");
|
||||
obj.value = Number(obj.value).toPrecision(2);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
</head>
|
||||
<body style="background-color:black;color:white">
|
||||
|
||||
|
||||
<font size=6 onclick="(document.getElementById('debug_hidden').value%6==5)?(document.getElementById('debug_show').style.display='block'):document.getElementById('debug_hidden').value++;">自平衡莱洛三角形
|
||||
<font size="6" onclick="(document.getElementById('debug_hidden').value%6==5)?(document.getElementById('debug_show').style.display='block'):document.getElementById('debug_hidden').value++;">自平衡莱洛三角形
|
||||
<input id="debug_hidden" hidden>
|
||||
<span id="TimeDiv" hidden>datetime</Span>
|
||||
</font>
|
||||
|
@ -380,7 +366,8 @@ function checkNum(obj) {
|
|||
<td align="center">
|
||||
<div style="width: 90px;float: left"><input class="tl-input" type="text" name="target_angle_ROM" id="target_angle_ROM2" size="2" onchange="checkNum(this)"><button type="button" class="ant-btn ant-btn-primary" onclick="document.getElementById('target_angle_ROM2').value=Number(document.getElementById('target_angle_ROM2').value)+0.5;">+</button>
|
||||
<button type="button" class="ant-btn ant-btn-primary" onclick="document.getElementById('target_angle_ROM2').value=Number(document.getElementById('target_angle_ROM2').value)-0.5;">-</button><br>
|
||||
<button type="button" class="ant-btn ant-btn-red" onclick="loadXMLDoc('/Control?Type=1&Index=0&Operation='+document.getElementById('target_angle_ROM2').value,'OperationHit')">发送</button></td>
|
||||
<button type="button" class="ant-btn ant-btn-red" onclick="loadXMLDoc('/Control?Type=1&Index=0&Operation='+document.getElementById('target_angle_ROM2').value,'OperationHit')">发送</button>
|
||||
</td>
|
||||
<td align="center">
|
||||
<div style="width: 90px;float: left"><input class="tl-input" name="swing_up_voltage" id="swing_up_voltage2" size="2" onchange="checkNum(this)"><button type="button" class="ant-btn ant-btn-primary" onclick="document.getElementById('swing_up_voltage2').value=Number(Number(document.getElementById('swing_up_voltage2').value)+0.10).toPrecision(2);">+</button>
|
||||
<button type="button" class="ant-btn ant-btn-primary" onclick="document.getElementById('swing_up_voltage2').value=Number(Number(document.getElementById('swing_up_voltage2').value)-0.10).toPrecision(2);">-</button><br>
|
||||
|
@ -467,8 +454,10 @@ function checkNum(obj) {
|
|||
<td align="left">
|
||||
<table border="1" cellspacing="0" cellpadding="0" ID="logchart" width="100%">
|
||||
<tr>
|
||||
<td align="center"><div id="container" style="width:700px;height:400px;margin:0 auto;"></div>
|
||||
<div style="text-align:center;clear:both;"></td>
|
||||
<td align="center">
|
||||
<div id="container" style="width:700px;height:400px;margin:0 auto;"></div>
|
||||
<div style="text-align:center;clear:both;">
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</td>
|
||||
|
|
Loading…
Reference in New Issue