triangle/muyan_Betas/RGB_V1.5/main/data/index.html

521 lines
27 KiB
HTML

<!--
自平衡莱洛三角形 RGB版
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" />
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<meta http-equiv="Cache-Control" content="max-age=7200" />
<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 {
border: none;
outline: none;
}
.tl-input {
width: 100%;
border: 1px solid #ccc;
padding: 7px 0;
background: #F4F4F7;
text-align: center;
border-radius: 3px;
padding-left: 5px;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075);
-webkit-transition: border-color ease-in-out .15s, -webkit-box-shadow ease-in-out .15s;
-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;
-webkit-box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6);
box-shadow: inset 0 1px 1px rgba(0, 0, 0, .075), 0 0 8px rgba(102, 175, 233, .6)
}
.ant-btn {
line-height: 1.499;
position: relative;
display: inline-block;
font-weight: 400;
white-space: nowrap;
text-align: center;
background-image: none;
border: 1px solid transparent;
-webkit-box-shadow: 0 2px 0 rgba(0, 0, 0, 0.015);
box-shadow: 0 2px 0 rgba(0, 0, 0, 0.015);
cursor: pointer;
-webkit-transition: all .3s cubic-bezier(.645, .045, .355, 1);
transition: all .3s cubic-bezier(.645, .045, .355, 1);
-webkit-user-select: none;
-moz-user-select: none;
-ms-user-select: none;
user-select: none;
-ms-touch-action: manipulation;
touch-action: manipulation;
height: 32px;
padding: 0 15px;
font-size: 14px;
border-radius: 4px;
color: rgba(0, 0, 0, 0.65);
background-color: #fff;
border-color: #d9d9d9;
}
.ant-btn-primary {
color: #fff;
background-color: #1890ff;
border-color: #1890ff;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);
-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;
border-color: #FF5A44;
text-shadow: 0 -1px 0 rgba(0, 0, 0, 0.12);
-webkit-box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);
box-shadow: 0 2px 0 rgba(0, 0, 0, 0.045);
}
/* 这里不考虑浏览器的兼容性 */
#control input {
border: none;
background-color: transparent;
margin: 20px 0;
outline: none;
}
#control input[type="text"] {
width: 100%;
font-size: 25px;
appearance: none;
padding-bottom: 5px;
border-bottom: 3px solid #ededed;
color: #ededed;
}
#control input[type="range"] {
width: 100%;
-webkit-appearance: none;
/* background-color: silver; */
height: 8px;
border-radius: 4px;
background: -webkit-linear-gradient(#ffa200, #ffa200) no-repeat white;
background-size: 50% 100%;
}
#control input[type="range"]::-webkit-slider-thumb {
-webkit-appearance: none;
background-color: #aaa;
width: 8px;
height: 20px;
border-radius: 4px;
cursor: pointer;
}
#control input[type="range"]::-webkit-slider-thumb:hover {
background: #666;
}
#control #voltage {
background-size: 0% 100%;
}
#control #speed {
background: linear-gradient(to right, #ffa200, white 0%, white);
background-size: 100% 100%;
}
#control input[type="button"] {
padding: 5px;
margin: 5px 0;
background: linear-gradient(to bottom right, red 10%, white 90%);
border: 0px;
width: 100%;
color: white;
font-weight: white;
}
</style>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="highcharts.js"></script>
<script type="text/javascript">
var HighchartsData = new Array(8);
$(function () {
$(document).ready(function () {
Highcharts.setOptions({ global: { useUTC: false } });
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();
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: "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 },
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;})()}
]
});
});
});
</script>
<script>
function loadXMLDoc(path,element)
{
var xmlhttp;
if (window.XMLHttpRequest)
{
// IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
xmlhttp=new XMLHttpRequest();
}
else
{
// IE6, IE5 浏览器执行代码
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
if (xmlhttp.readyState==4 && xmlhttp.status==200)
{
document.getElementById(element).innerHTML=xmlhttp.responseText;
}
}
xmlhttp.open("GET",path,true);
xmlhttp.send();
}
function UpdateInfo()
{
var xmlhttp;
if (window.XMLHttpRequest){ // IE7+, Firefox, Chrome, Opera, Safari 浏览器执行代码
xmlhttp=new XMLHttpRequest();
} else { // IE6, IE5 浏览器执行代码
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
}
xmlhttp.onreadystatechange=function()
{
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];
document.getElementById('debug_log_control').value=arr[3];
document.getElementById('test_flag').value=arr[4];
if(arr[4]==2){
document.getElementById('tvv_btn').innerHTML='关闭速度测试';
document.getElementById('tvq_btn').innerHTML='开启电压测试';
}else if(arr[4]==1){
document.getElementById('tvq_btn').innerHTML='关闭电压测试';
document.getElementById('tvv_btn').innerHTML='开启速度测试';
}else{
document.getElementById('tvv_btn').innerHTML='开启速度测试';
document.getElementById('tvq_btn').innerHTML='开启电压测试';
}
document.getElementById('BAT_VOLTAGE').innerHTML=arr[5];
document.getElementById('target_angle_ROM').innerHTML=arr[6];
document.getElementById('swing_up_voltage').innerHTML=arr[7];
document.getElementById('swing_up_angle').innerHTML=arr[8];
document.getElementById('v_i_1').innerHTML=arr[9];
document.getElementById('v_p_1').innerHTML=arr[10];
document.getElementById('v_i_2').innerHTML=arr[11];
document.getElementById('v_p_2').innerHTML=arr[12];
if(document.getElementById('target_angle_ROM2').value=="") document.getElementById('target_angle_ROM2').value=arr[6];
if(document.getElementById('swing_up_voltage2').value=="") document.getElementById('swing_up_voltage2').value=arr[7];
if(document.getElementById('swing_up_angle2').value=="") document.getElementById('swing_up_angle2').value=arr[8];
if(document.getElementById('v_i_12').value=="") document.getElementById('v_i_12').value=arr[9];
if(document.getElementById('v_p_12').value=="") document.getElementById('v_p_12').value=arr[10];
if(document.getElementById('v_i_22').value=="") document.getElementById('v_i_22').value=arr[11];
if(document.getElementById('v_p_22').value=="") document.getElementById('v_p_22').value=arr[12];
if(document.getElementById('log_control').value=="1" && 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;
document.getElementById('pendulum_angle').innerHTML=arr[16]+"<br>"+document.getElementById('pendulum_angle').innerHTML;
document.getElementById('target_angle').innerHTML=arr[17]+"<br>"+document.getElementById('target_angle').innerHTML;
document.getElementById('pitch').innerHTML=arr[18]+"<br>"+document.getElementById('pitch').innerHTML;
document.getElementById('kalAngleZ').innerHTML=arr[19]+"<br>"+document.getElementById('kalAngleZ').innerHTML;
document.getElementById('gyroZrate').innerHTML=arr[20]+"<br>"+document.getElementById('gyroZrate').innerHTML;
}
if(document.getElementById('debug_log_control').value=="1"){
document.getElementById('debug_log').style.display='block';
document.getElementById('debug_log').value += arr[21];
}
}
}
xmlhttp.open("GET",'/update',true);
xmlhttp.send();
}
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 clearDebugLog() {
document.getElementById("debug_log").value = "";
}
function checkNum(obj) {
if (isNaN(obj.value)) { //检查是否是非数字值
obj.value = "";
}
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++;">自平衡莱洛三角形
<input id="debug_hidden" hidden>
<span id="TimeDiv" hidden>datetime</Span>
</font>
</div>
<table border="0">
<tr>
<td height="50">已启动:<span id=CurrentMillis></span>
&nbsp;&nbsp;&nbsp;&nbsp;电池电压:<span id="BAT_VOLTAGE" style="color:#de87b8;"></span> V
<span id="OperationHit" style="color:#ffa200;"></span>
</td>
</tr>
<tr>
<td height="50">
<button type="button" onclick="loadXMLDoc('/Control?Type=0&Index=0&Operation=0','OperationHit')" class="ant-btn ant-btn-red">开灯</button>
<button type="button" onclick="loadXMLDoc('/Control?Type=0&Index=0&Operation=1','OperationHit')" class="ant-btn ant-btn-red">+</button>
<button type="button" onclick="loadXMLDoc('/Control?Type=0&Index=0&Operation=2','OperationHit')" class="ant-btn ant-btn-red">-</button>
<button type="button" onclick="loadXMLDoc('/Control?Type=0&Index=0&Operation=3','OperationHit')" class="ant-btn ant-btn-red">关灯</button>
<button type="button" onclick="loadXMLDoc('/Control?Type=1&Index=99&Operation=0','OperationHit')" class="ant-btn ant-btn-red">电机启停</button>
<button type="button" onclick="loadXMLDoc('/Control?Type=0&Index=0&Operation=4','OperationHit')" class="ant-btn ant-btn-red">重启</button>
</td>
</tr>
<tr>
<td align="left">
<table border="1" cellspacing="0" cellpadding="0">
<tr>
<td align="center"><span style="color:#398ad9;">期望角度TA</span></td>
<td align="center"><span style="color:#5bec8d;">摇摆电压SV</span></td>
<td align="center"><span style="color:#fd42ac;">摇摆角度SA</span></td>
<td align="center"><span style="color:#4b8200;">速度环P1</span></td>
<td align="center"><span style="color:#ff33ff;">速度环I1</span></td>
<td align="center"><span style="color:#4b8200;">速度环P2</span></td>
<td align="center"><span style="color:#ff33ff;">速度环I2</span></td>
</tr>
<tr>
<td align="center"><span style="color:#ff5c5c;" id="target_angle_ROM"></span></td>
<td align="center"><span style="color:#5bec8d;" id="swing_up_voltage"></span></td>
<td align="center"><span style="color:#fd42ac;" id="swing_up_angle"></span></td>
<td align="center"><span style="color:#4b8200;" id="v_p_1"></span></td>
<td align="center"><span style="color:#ff33ff;" id="v_i_1"></span></td>
<td align="center"><span style="color:#4b8200;" id="v_p_2"></span></td>
<td align="center"><span style="color:#ff33ff;" id="v_i_2"></span></td>
</tr>
<tr>
<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>
<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>
<button type="button" class="ant-btn ant-btn-red" onclick="loadXMLDoc('/Control?Type=1&Index=1&Operation='+document.getElementById('swing_up_voltage2').value,'OperationHit')">发送</button>
</td>
<td align="center">
<div style="width: 90px;float: left"><input class="tl-input" name="swing_up_angle" id="swing_up_angle2" size="2" onchange="checkNum(this)"><button type="button" class="ant-btn ant-btn-primary" onclick="document.getElementById('swing_up_angle2').value=Number(document.getElementById('swing_up_angle2').value)+1;">+</button>
<button type="button" class="ant-btn ant-btn-primary" onclick="document.getElementById('swing_up_angle2').value=Number(document.getElementById('swing_up_angle2').value)-1;">-</button><br>
<button type="button" class="ant-btn ant-btn-red" onclick="loadXMLDoc('/Control?Type=1&Index=2&Operation='+document.getElementById('swing_up_angle2').value,'OperationHit')">发送</button>
</td>
<td align="center">
<div style="width: 90px;float: left"><input class="tl-input" name="v_p_1" id="v_p_12" size="2" onchange="checkNum(this)"><button type="button" class="ant-btn ant-btn-primary" onclick="document.getElementById('v_p_12').value=Number(Number(document.getElementById('v_p_12').value)+0.1).toPrecision(2);">+</button>
<button type="button" class="ant-btn ant-btn-primary" onclick="document.getElementById('v_p_12').value=Number(Number(document.getElementById('v_p_12').value)-0.1).toPrecision(2);">-</button><br>
<button type="button" class="ant-btn ant-btn-red" onclick="loadXMLDoc('/Control?Type=1&Index=3&Operation='+document.getElementById('v_p_12').value,'OperationHit')">发送</button>
</td>
<td align="center">
<div style="width: 90px;float: left"><input class="tl-input" name="v_i_1" id="v_i_12" size="2" onchange="checkNum(this)"><button type="button" class="ant-btn ant-btn-primary" onclick="document.getElementById('v_i_12').value=Number(document.getElementById('v_i_12').value)+0.5;">+</button>
<button type="button" class="ant-btn ant-btn-primary" onclick="document.getElementById('v_i_12').value=Number(document.getElementById('v_i_12').value)-0.5;">-</button><br>
<button type="button" class="ant-btn ant-btn-red" onclick="loadXMLDoc('/Control?Type=1&Index=4&Operation='+document.getElementById('v_i_12').value,'OperationHit')">发送</button>
</td>
<td align="center">
<div style="width: 90px;float: left"><input class="tl-input" name="v_p_2" id="v_p_22" size="2" onchange="checkNum(this)"><button type="button" class="ant-btn ant-btn-primary" onclick="document.getElementById('v_p_22').value=Number(Number(document.getElementById('v_p_22').value)+0.1).toPrecision(2);">+</button>
<button type="button" class="ant-btn ant-btn-primary" onclick="document.getElementById('v_p_22').value=Number(Number(document.getElementById('v_p_22').value)-0.1).toPrecision(2);">-</button><br>
<button type="button" class="ant-btn ant-btn-red" onclick="loadXMLDoc('/Control?Type=1&Index=5&Operation='+document.getElementById('v_p_22').value,'OperationHit')">发送</button>
</td>
<td align="center">
<div style="width: 90px;float: left"><input class="tl-input" name="v_i_2" id="v_i_22" size="2" onchange="checkNum(this)"><button type="button" class="ant-btn ant-btn-primary" onclick="document.getElementById('v_i_22').value=Number(document.getElementById('v_i_22').value)+0.5;">+</button>
<button type="button" class="ant-btn ant-btn-primary" onclick="document.getElementById('v_i_22').value=Number(document.getElementById('v_i_22').value)-0.5;">-</button><br>
<button type="button" class="ant-btn ant-btn-red" onclick="loadXMLDoc('/Control?Type=1&Index=6&Operation='+document.getElementById('v_i_22').value,'OperationHit')">发送</button>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0" ID="control" width="100%">
<tr>
<td height="50" width="50"><button type="button" class="ant-btn ant-btn-red" onclick="(this.innerHTML=='关闭速度测试'?(this.innerHTML='开启速度测试'):this.innerHTML='关闭速度测试');(document.getElementById('tvq_btn').innerHTML=='关闭电压测试'?(document.getElementById('tvq_btn').innerHTML='开启电压测试'):'');loadXMLDoc('/Control?Type=1&Index=88&Operation=0','OperationHit')" id="tvv_btn">开启速度测试</button></td>
<td width="40" align="center"><span id="speedNum">0</span></td>
<td><input type="range" id="speed" value="0" min="-100" max="100" step="1" onchange="changeV()"></td>
</tr>
<tr>
<td height="50" width="50"><button type="button" class="ant-btn ant-btn-red" onclick="(this.innerHTML=='关闭电压测试'?(this.innerHTML='开启电压测试'):this.innerHTML='关闭电压测试');(document.getElementById('tvv_btn').innerHTML=='关闭速度测试'?(document.getElementById('tvv_btn').innerHTML='开启速度测试'):'');loadXMLDoc('/Control?Type=1&Index=77&Operation=0','OperationHit')" id="tvq_btn">开启电压测试</button></td>
<td width="40" align="center"><span id="voltageNum">0</span></td>
<td>
<input type="hidden" name="test_flag" id="test_flag">
<input type="range" id="voltage" value="0" min="-12" max="12" step="1" onchange="changeV()">
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td>
<table border="0" cellspacing="0" cellpadding="0" ID="debug_show" width="100%" style="display:none">
<tr>
<td>
<button type="button" onclick="document.getElementById('debug_log_control').value=1;loadXMLDoc('/Control?Type=0&Index=6&Operation=1','OperationHit');document.getElementById('debug_log').style.display='block';">开启Debug</button>
<button type="button" onclick="document.getElementById('debug_log_control').value=0;loadXMLDoc('/Control?Type=0&Index=6&Operation=0','OperationHit');">关闭Debug</button>
<button type="button" onclick="document.getElementById('debug_log').style.display='block';">显示记录</button>
<button type="button" onclick="document.getElementById('debug_log').style.display='none';">隐藏记录</button>
<button type="button" onclick="clearDebugLog()">清除记录</button>
<input type="hidden" name="debug_log_control" id="debug_log_control">
</td>
</tr>
<tr>
<td align="left"><textarea name="debug_log" rows="10" cols="80" id="debug_log" style="display:none"></textarea></td>
</tr>
</table>
</td>
</tr>
<tr>
<td height="50">
<button type="button" onclick="document.getElementById('log_control').value=1;loadXMLDoc('/Control?Type=0&Index=5&Operation=1','OperationHit')">开启记录</button>
<button type="button" onclick="document.getElementById('log_control').value=0;loadXMLDoc('/Control?Type=0&Index=5&Operation=0','OperationHit')">停止记录</button>
<button type="button" onclick="document.getElementById('loglist').style.display='block';">显示记录</button>
<button type="button" onclick="document.getElementById('loglist').style.display='none';">隐藏记录</button>
<button type="button" onclick="clearLog()">清除记录</button>
<input type="hidden" name="log_control" id="log_control">
</td>
</tr>
<tr>
<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>
</tr>
</table>
</td>
</tr>
<tr>
<td align="left">
<table border="1" cellspacing="0" cellpadding="0" ID="loglist" width="100%">
<tr>
<td align="center"><span style="color:#ff5c5c;">Shaft<br>Velocity</span></td>
<td align="center"><span style="color:#398ad9;">motor<br>voltage q</span></td>
<td align="center"><span style="color:#ff5c5c;">target<br>velocity</span></td>
<td align="center"><span style="color:#5bec8d;">pendulum<br>angle</span></td>
<td align="center"><span style="color:#fd42ac;">target<br>angle</span></td>
<td align="center"><span style="color:#4b8200;">pitch</span></td>
<td align="center"><span style="color:#ff33ff;">kalAngleZ</span></td>
<td align="center"><span style="color:#4b8200;">gyroZrate</span></td>
</tr>
<tr>
<td align="center"><span style="color:#ff5c5c;" id="Shaft_Velocity"></span></td>
<td align="center"><span style="color:#398ad9;" id="motor_voltage_q"></span></td>
<td align="center"><span style="color:#ff5c5c;" id="target_velocity"></span></td>
<td align="center"><span style="color:#5bec8d;" id="pendulum_angle"></span></td>
<td align="center"><span style="color:#fd42ac;" id="target_angle"></span></td>
<td align="center"><span style="color:#4b8200;" id="pitch"></span></td>
<td align="center"><span style="color:#ff33ff;" id="kalAngleZ"></span></td>
<td align="center"><span style="color:#4b8200;" id="gyroZrate"></span></td>
</tr>
</table>
</td>
</tr>
</table>
<script>
const voltage = document.getElementById('voltage');
const speed = document.getElementById('speed');
function changeV() {
voltageVal = parseFloat(voltage.value);
spdVal = parseFloat(speed.value);
const voltagePercent = Math.abs(parseFloat(voltageVal / 12, 2) * 50)
const speedPercent = Math.abs(parseFloat((spdVal / 100), 2) * 100) * 1.5
if (voltageVal < 0)
voltage.style.background = `linear-gradient(to right, #ffa200 ${voltagePercent}%, white ${voltagePercent}%`
else
voltage.style.background = `linear-gradient(to left, #ffa200 ${voltagePercent}%, white ${voltagePercent}%`
if (spdVal < 0)
speed.style.background = `linear-gradient(to right, #ffa200, white ${speedPercent}%`
else
speed.style.background = `linear-gradient(to left, #ffa200, white ${speedPercent}%`
document.getElementById('voltageNum').innerHTML = voltageVal;
document.getElementById('speedNum').innerHTML = spdVal;
if (document.getElementById('test_flag').value == '1') {
loadXMLDoc('/Control?Type=1&Index=7&Operation=' + voltageVal, 'OperationHit');
}
if (document.getElementById('test_flag').value == '2') {
loadXMLDoc('/Control?Type=1&Index=8&Operation=' + spdVal, 'OperationHit');
}
};
</script>
</body>
</html>