370 lines
14 KiB
HTML
370 lines
14 KiB
HTML
|
|
<!DOCTYPE html>
|
||
|
|
<html lang="en" id="container" onmousedown="startDrag(event)" onmouseup="stopDrag(event)" onmousemove="dragging(event)" style="overflow-x: hidden;
|
||
|
|
overflow-y: hidden; ">
|
||
|
|
<head>
|
||
|
|
<meta charset="UTF-8">
|
||
|
|
<!--<script type="text/javascript" src="../roslib.min.js"></script>-->
|
||
|
|
<script src="../jquery-2.1.0.min.js"></script>
|
||
|
|
<script src="../jquery.cookie.js"></script>
|
||
|
|
<script type="text/javascript" src="../Lu_Math_Driver.js"></script>
|
||
|
|
<script type="text/javascript" type="text/javascript">
|
||
|
|
var LearnLineAB_Sch=0;
|
||
|
|
var PointA_rx=0;
|
||
|
|
var PointA_ry=0;
|
||
|
|
var PointA_rt=0;
|
||
|
|
var PointA_Ref_NodeID=0;
|
||
|
|
|
||
|
|
var PointB_rx=0;
|
||
|
|
var PointB_ry=0;
|
||
|
|
var PointB_rt=0;
|
||
|
|
var PointB_Ref_NodeID=0;
|
||
|
|
|
||
|
|
var StartNode=0;
|
||
|
|
var EndNode=0;
|
||
|
|
var Direction="Front";
|
||
|
|
var LayerType="Normal";
|
||
|
|
var CreatePairDirectionEnable="true";
|
||
|
|
var ReverseSafeSensorEnable="true";
|
||
|
|
var S300_1_Enable="false";
|
||
|
|
var S300_1_Case=0;
|
||
|
|
var S300_2_Enable="false";
|
||
|
|
var S300_2_Case=0;
|
||
|
|
var TIM_1_Enable="true";
|
||
|
|
var TIM_1_Case=0;
|
||
|
|
var TIM_2_Enable="false";
|
||
|
|
var TIM_2_Case=0;
|
||
|
|
var SpeedType=0;
|
||
|
|
var Auto_Charge_Enable="false";
|
||
|
|
var Plate_Check_Enable="false";
|
||
|
|
var Plate_Check_Enable_To_End_Dist_m=0.0;
|
||
|
|
|
||
|
|
var last_rx_tmp=0;
|
||
|
|
var last_ry_tmp=0;
|
||
|
|
var last_rt_tmp=0;
|
||
|
|
|
||
|
|
var Tmp_Speed_Direction=0;
|
||
|
|
var Speed_Direction_Sum=0;
|
||
|
|
|
||
|
|
var Car_Global_rx=0;
|
||
|
|
var Car_Global_ry=0;
|
||
|
|
var Car_Global_Theta=0;
|
||
|
|
|
||
|
|
//clearCookie("LearnLineAB_Sch");
|
||
|
|
|
||
|
|
//var IP=window.location.host;
|
||
|
|
/*
|
||
|
|
var ros = new ROSLIB.Ros({
|
||
|
|
//url : 'ws://'+IP+':9290'
|
||
|
|
url : 'ws://localhost:9190'
|
||
|
|
});
|
||
|
|
|
||
|
|
ros.on('connection', function() {
|
||
|
|
console.log('Connected to websocket server.');
|
||
|
|
});
|
||
|
|
|
||
|
|
ros.on('error', function(error) {
|
||
|
|
console.log('Error connecting to websocket server: ', error);
|
||
|
|
});
|
||
|
|
|
||
|
|
ros.on('close', function() {
|
||
|
|
console.log('Connection to websocket server closed.');
|
||
|
|
});*/
|
||
|
|
|
||
|
|
|
||
|
|
function SketchLeftLearnLineABMainPostMessage(str){
|
||
|
|
parent.window.postMessage(
|
||
|
|
str,
|
||
|
|
"*" //or "www.parentpage.com"
|
||
|
|
);
|
||
|
|
}
|
||
|
|
|
||
|
|
function LearnLineAB_Main_Init(){
|
||
|
|
LearnLineAB_Sch=0;
|
||
|
|
PointA_rx=0;
|
||
|
|
PointA_ry=0;
|
||
|
|
PointA_rt=0;
|
||
|
|
PointA_Ref_NodeID=0;
|
||
|
|
|
||
|
|
PointB_rx=0;
|
||
|
|
PointB_ry=0;
|
||
|
|
PointB_rt=0;
|
||
|
|
PointB_Ref_NodeID=0;
|
||
|
|
|
||
|
|
StartNode=0;
|
||
|
|
EndNode=0;
|
||
|
|
Direction="Front";
|
||
|
|
LayerType="Normal";
|
||
|
|
CreatePairDirectionEnable="true";
|
||
|
|
ReverseSafeSensorEnable="true";
|
||
|
|
S300_1_Enable="false";
|
||
|
|
S300_1_Case=0;
|
||
|
|
S300_2_Enable="false";
|
||
|
|
S300_2_Case=0;
|
||
|
|
TIM_1_Enable="false";
|
||
|
|
TIM_1_Case=0;
|
||
|
|
TIM_2_Enable="false";
|
||
|
|
TIM_2_Case=0;
|
||
|
|
SpeedType=0;
|
||
|
|
Auto_Charge_Enable="false";
|
||
|
|
Plate_Check_Enable="false";
|
||
|
|
Plate_Check_Enable_To_End_Dist_m=0.0;
|
||
|
|
|
||
|
|
last_rx_tmp=0;
|
||
|
|
last_ry_tmp=0;
|
||
|
|
last_rt_tmp=0;
|
||
|
|
|
||
|
|
Tmp_Speed_Direction=0;
|
||
|
|
Speed_Direction_Sum=0;
|
||
|
|
}
|
||
|
|
|
||
|
|
function client_request_left_learnlineab_main(str){
|
||
|
|
window.parent.parent.postMessage(
|
||
|
|
{
|
||
|
|
event_id: 'client_request_left_learnlineab_main',
|
||
|
|
data: {
|
||
|
|
v1: str
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"*" //or "www.parentpage.com"
|
||
|
|
);
|
||
|
|
}
|
||
|
|
/*
|
||
|
|
function client(str){
|
||
|
|
var client_LearnString=new ROSLIB.Service({
|
||
|
|
ros:ros,
|
||
|
|
name:'/Service_LearnString',
|
||
|
|
serviceType:'lu_ps20l_msgs/Srv_LearnString'
|
||
|
|
});
|
||
|
|
|
||
|
|
var request = new ROSLIB.ServiceRequest({
|
||
|
|
Learn_String_Input:str
|
||
|
|
});
|
||
|
|
|
||
|
|
client_LearnString.callService(request,function(result) {
|
||
|
|
document.getElementById('LeftLearnLineABIframe').contentWindow.postMessage(
|
||
|
|
{
|
||
|
|
event_id: 'client_response',
|
||
|
|
data: {
|
||
|
|
v1: result.result,
|
||
|
|
v2: result.ROS_String_Output,
|
||
|
|
v3: result.Rec_Learn_String_Input
|
||
|
|
}
|
||
|
|
},
|
||
|
|
"*" //or "www.parentpage.com"
|
||
|
|
);
|
||
|
|
//console.log("AAA");
|
||
|
|
//console.log(result.result);
|
||
|
|
//console.log(result.ROS_String_Output);
|
||
|
|
//console.log("BBB");
|
||
|
|
});
|
||
|
|
}*/
|
||
|
|
|
||
|
|
function receiveMessage(event) {
|
||
|
|
console.log(event);
|
||
|
|
if(event.data.event_id=="client_response_left_learnlineab_main"){
|
||
|
|
/*
|
||
|
|
var v2=event.data.data.v2;
|
||
|
|
console.log(v2);
|
||
|
|
var v2_frame=v2.split(' ');
|
||
|
|
var head=v2_frame[0];
|
||
|
|
console.log(head);
|
||
|
|
if(head=="CheckNode"){
|
||
|
|
document.getElementById('LeftLearnLineABIframe').contentWindow.postMessage(
|
||
|
|
event.data
|
||
|
|
);
|
||
|
|
}*/
|
||
|
|
document.getElementById('LeftLearnLineABIframe').contentWindow.postMessage(
|
||
|
|
event.data
|
||
|
|
);
|
||
|
|
return;
|
||
|
|
}
|
||
|
|
|
||
|
|
var frame=event.data.split('#');
|
||
|
|
var head=frame[0].split(':');
|
||
|
|
|
||
|
|
switch(head[0]){
|
||
|
|
case 'LearnLineABSch0':
|
||
|
|
{
|
||
|
|
//var info=head[1].split('#');
|
||
|
|
var data=head[1].split(',');
|
||
|
|
PointA_rx=parseFloat(data[0]);
|
||
|
|
PointA_ry=parseFloat(data[1]);
|
||
|
|
PointA_rt=parseFloat(data[2]);
|
||
|
|
PointA_Ref_NodeID=parseInt(data[3]);
|
||
|
|
LearnLineAB_Sch=1;
|
||
|
|
window.open('HMI_Sketch_Left_LearnLineAB_Sch1.html', 'LeftLearnLineABIframe');
|
||
|
|
}break;
|
||
|
|
case 'LearnLineABSch1':{
|
||
|
|
//var info=head[1].split('#');
|
||
|
|
//var data=info[0].split(',');
|
||
|
|
var data=head[1].split(',');
|
||
|
|
PointB_rx=parseFloat(data[0]);
|
||
|
|
PointB_ry=parseFloat(data[1]);
|
||
|
|
PointB_rt=parseFloat(data[2]);
|
||
|
|
PointB_Ref_NodeID=parseInt(data[3]);
|
||
|
|
LearnLineAB_Sch=2;
|
||
|
|
window.open('HMI_Sketch_Left_LearnLineAB_Sch2.html', 'LeftLearnLineABIframe');
|
||
|
|
}break;
|
||
|
|
case 'LearnLineABSch2':{
|
||
|
|
var data=head[1].split(',');
|
||
|
|
StartNode=parseInt(data[0]);
|
||
|
|
EndNode=parseInt(data[1]);
|
||
|
|
Direction=data[2];
|
||
|
|
S300_1_Enable=data[3];
|
||
|
|
S300_1_Case=parseInt(data[4]);
|
||
|
|
S300_2_Enable=data[5];
|
||
|
|
S300_2_Case=parseInt(data[6]);
|
||
|
|
TIM_1_Enable=data[7];
|
||
|
|
TIM_1_Case=parseInt(data[8]);
|
||
|
|
TIM_2_Enable=data[9];
|
||
|
|
TIM_2_Case=parseInt(data[10]);
|
||
|
|
SpeedType=parseInt(data[11]);
|
||
|
|
CreatePairDirectionEnable=data[12];
|
||
|
|
Auto_Charge_Enable=data[13];
|
||
|
|
Plate_Check_Enable=data[14];
|
||
|
|
Plate_Check_Enable_To_End_Dist_m=parseFloat(data[15]);
|
||
|
|
ReverseSafeSensorEnable=data[16];
|
||
|
|
//console.log(data+" "+"LearnLineABSch2S300_1_Case:"+S300_1_Case+ "S300_1_Enable"+S300_1_Enable);
|
||
|
|
var str="CheckNode:"+
|
||
|
|
StartNode+";"+
|
||
|
|
+PointA_rx+";"
|
||
|
|
+PointA_ry+";"
|
||
|
|
+PointA_rt+";"
|
||
|
|
+EndNode+";"
|
||
|
|
+PointB_rx+";"
|
||
|
|
+PointB_ry+";"
|
||
|
|
+PointB_rt+";"
|
||
|
|
//client(str);
|
||
|
|
client_request_left_learnlineab_main(str);
|
||
|
|
//LearnLineAB_Sch=3;
|
||
|
|
//window.open('HMI_Sketch_Left_LearnLineAB_Sch3.html', 'LeftLearnLineABIframe');
|
||
|
|
}break;
|
||
|
|
case 'LearnLineABSch2_CheckNodeOK':{
|
||
|
|
LearnLineAB_Sch=3;
|
||
|
|
window.open('HMI_Sketch_Left_LearnLineAB_Sch3.html', 'LeftLearnLineABIframe');
|
||
|
|
}break;
|
||
|
|
case 'LearnLineABSch3':{
|
||
|
|
var data=head[1];
|
||
|
|
if(data=="OK"){
|
||
|
|
var str="LearnLineAB:"
|
||
|
|
+PointA_rx+";"
|
||
|
|
+PointA_ry+";"
|
||
|
|
+PointA_rt+";"
|
||
|
|
+PointB_rx+";"
|
||
|
|
+PointB_ry+";"
|
||
|
|
+PointB_rt+";"
|
||
|
|
+StartNode+";"
|
||
|
|
+EndNode+";"
|
||
|
|
+Direction+";"
|
||
|
|
+LayerType+";"
|
||
|
|
+CreatePairDirectionEnable+";"
|
||
|
|
+S300_1_Enable+";"
|
||
|
|
+S300_1_Case+";"
|
||
|
|
+S300_2_Enable+";"
|
||
|
|
+S300_2_Case+";"
|
||
|
|
+TIM_1_Enable+";"
|
||
|
|
+TIM_1_Case+";"
|
||
|
|
+TIM_2_Enable+";"
|
||
|
|
+TIM_2_Case+";"
|
||
|
|
+SpeedType+";"
|
||
|
|
+Auto_Charge_Enable+";"
|
||
|
|
+Plate_Check_Enable+";"
|
||
|
|
+Plate_Check_Enable_To_End_Dist_m+";"
|
||
|
|
+ReverseSafeSensorEnable+";"
|
||
|
|
+"#";
|
||
|
|
//client(str);
|
||
|
|
client_request_left_learnlineab_main(str);
|
||
|
|
}
|
||
|
|
LearnLineAB_Sch=4;
|
||
|
|
window.open('HMI_Sketch_Left_LearnLineAB_Sch4.html', 'LeftLearnLineABIframe');
|
||
|
|
//LearnLineAB_Main_Init();
|
||
|
|
//window.open('HMI_Sketch_Left_LearnLineAB_Sch0.html', 'LeftLearnLineABIframe');
|
||
|
|
}break;
|
||
|
|
case 'LearnLineABSch4':{
|
||
|
|
var data=head[1];
|
||
|
|
if(data=="Continue") {
|
||
|
|
LearnLineAB_Main_Init();
|
||
|
|
window.open('HMI_Sketch_Left_LearnLineAB_Sch0.html', 'LeftLearnLineABIframe');
|
||
|
|
}
|
||
|
|
else{
|
||
|
|
LearnLineAB_Main_Init();
|
||
|
|
SketchLeftLearnLineABMainPostMessage("Main");
|
||
|
|
}
|
||
|
|
}break;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
window.addEventListener("message", receiveMessage, false);
|
||
|
|
|
||
|
|
function Lu_Judge_Last_Speed_Direction(rx,ry,rt){
|
||
|
|
var run_dist = Lu_Get_Dist(rx,ry,last_rx_tmp,last_ry_tmp);
|
||
|
|
if(run_dist>0.2){
|
||
|
|
var a = Lu_Judge_StartToEnd_SpeedDirection(last_rx_tmp,last_ry_tmp,rx,ry,rt);
|
||
|
|
last_rx_tmp=rx;
|
||
|
|
last_ry_tmp=ry;
|
||
|
|
last_rt_tmp=rt;
|
||
|
|
return a;
|
||
|
|
}
|
||
|
|
else{
|
||
|
|
return 0;
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
function Refresh(){
|
||
|
|
Car_Global_rx=parseFloat($.cookie('Car_Global_rx'));
|
||
|
|
Car_Global_ry=parseFloat($.cookie('Car_Global_ry'));
|
||
|
|
Car_Global_Theta=parseFloat($.cookie('Car_Global_Theta'));
|
||
|
|
|
||
|
|
if(LearnLineAB_Sch==1){
|
||
|
|
Tmp_Speed_Direction=Lu_Judge_Last_Speed_Direction(Car_Global_rx,Car_Global_ry,Car_Global_Theta);
|
||
|
|
Speed_Direction_Sum=Speed_Direction_Sum+Tmp_Speed_Direction;
|
||
|
|
if(Speed_Direction_Sum>=0)Direction="Front";
|
||
|
|
else Direction="Reverse";
|
||
|
|
}
|
||
|
|
|
||
|
|
//console.log("Speed_Direction_Sum="+Speed_Direction_Sum);
|
||
|
|
|
||
|
|
document.getElementById('LearnLineAB_Sch').innerText='LearnLineAB_Sch='+LearnLineAB_Sch;
|
||
|
|
|
||
|
|
document.getElementById('PointA_rx').innerText = 'PointA_rx=' + PointA_rx;
|
||
|
|
document.getElementById('PointA_ry').innerText = 'PointA_ry=' + PointA_ry;
|
||
|
|
document.getElementById('PointA_rt').innerText = 'PointA_rt=' + PointA_rt;
|
||
|
|
|
||
|
|
document.getElementById('PointB_rx').innerText = 'PointB_rx=' + PointB_rx;
|
||
|
|
document.getElementById('PointB_ry').innerText = 'PointB_ry=' + PointB_ry;
|
||
|
|
document.getElementById('PointB_rt').innerText = 'PointB_rt=' + PointB_rt;
|
||
|
|
|
||
|
|
document.getElementById('StartNode').innerText = 'StartNode=' + StartNode;
|
||
|
|
document.getElementById('EndNode').innerText = 'EndNode=' + EndNode;
|
||
|
|
document.getElementById('Direction').innerText = 'Direction=' + Direction;
|
||
|
|
|
||
|
|
|
||
|
|
var str="LearnLineAB_Sch:"+LearnLineAB_Sch+";"+"PointA:"+PointA_rx+","+PointA_ry+","+PointA_rt+";"+"PointB:"+PointB_rx+","+PointB_ry+","+PointB_rt+";"+"Direction:"+Direction+"#";
|
||
|
|
$.cookie("LearnLineAB_Sch",encodeURIComponent(str),{secure: true});//setCookie("LearnLineAB_Sch",encodeURIComponent(str),1000);
|
||
|
|
//console.log(str);
|
||
|
|
}
|
||
|
|
|
||
|
|
function Timer(){
|
||
|
|
Refresh();
|
||
|
|
}
|
||
|
|
|
||
|
|
window.setInterval("Timer()",100);
|
||
|
|
</script>
|
||
|
|
<title>Title</title>
|
||
|
|
</head>
|
||
|
|
<body>
|
||
|
|
<div id='LearnLineAB_Sch'> </div>
|
||
|
|
<div>
|
||
|
|
<iframe id="LeftLearnLineABIframe" name="LeftLearnLineABIframe" width=100% height=560 src="HMI_Sketch_Left_LearnLineAB_Sch0.html" frameborder="2" scrolling="auto"></iframe>
|
||
|
|
</div>
|
||
|
|
<div id='PointA_rx'></div>
|
||
|
|
<div id='PointA_ry'></div>
|
||
|
|
<div id='PointA_rt'></div>
|
||
|
|
<div id='PointB_rx'></div>
|
||
|
|
<div id='PointB_ry'></div>
|
||
|
|
<div id='PointB_rt'></div>
|
||
|
|
<div id='StartNode'></div>
|
||
|
|
<div id='EndNode'></div>
|
||
|
|
<div id='Direction'></div>
|
||
|
|
</body>
|
||
|
|
<script src="../js/drag.js"></script>
|
||
|
|
</html>
|