Compare commits

..

2 Commits

@ -22,6 +22,11 @@ def is_raspberry_pi5():
base = BaseController('/dev/ttyAMA0', 115200)
class CAR:
input_x = 0
input_y = 0
input_speed = 0
input_acc = 0
def stop(self): # 停止运行
base.send_command({"T":1,"L":0,"R":0})
print("run: stop move")
@ -74,3 +79,19 @@ class CAR:
self.right()
def d(self):
self.right()
def up(self):
self.input_y+=10
base.gimbal_ctrl(self.input_x, self.input_y, self.input_speed, self.input_acc)
def down(self):
self.input_y-=10
base.gimbal_ctrl(self.input_x, self.input_y, self.input_speed, self.input_acc)
def yunleft(self):
self.input_x-=10
base.gimbal_ctrl(self.input_x, self.input_y, self.input_speed, self.input_acc)
def yunright(self):
self.input_x+=10
base.gimbal_ctrl(self.input_x, self.input_y, self.input_speed, self.input_acc)

@ -46,6 +46,23 @@
</div>
<button id="rear" type="button" onclick="back()" class="btn btn-lg btn-primary glyphicon glyphicon-circle-arrow-down" style="margin-left: 56px;"> </button>
</div>
<div>
<button id="up" type="button" onclick="up()" class="btn btn-lg btn-primary glyphicon glyphicon-circle-arrow-up" style="margin-left: 56px;"> </button>
</div>
<!-- <div>
<button id="printButton" type="button" onclick="printClicked()" class="btn btn-lg btn-primary">打印点击</button>
</div> -->
<div>
<button type="button" onclick="yunleft()" class="btn btn-lg btn-primary glyphicon glyphicon-circle-arrow-left" > </button>
<button type="button" onclick="guiwei()" class="btn btn-lg btn-primary glyphicon glyphicon-stop"> </button>
<button type="button" onclick="yunright()" class="btn btn-lg btn-primary glyphicon glyphicon-circle-arrow-right" > </button>
</div>
<button id="down" type="button" onclick="down()" class="btn btn-lg btn-primary glyphicon glyphicon-circle-arrow-down" style="margin-left: 56px;"> </button>
</div>
</div>
<script src='/Decoder.js'></script>
@ -170,7 +187,104 @@
}
});
} function up() {
// console.log("132465789891651354684");
$.ajax({
type: "GET",
dataType: "json",
url: "/control/up" ,
data: $('#form1').serialize(), //提交的数据
success: function (result) {
console.log(result); //打印服务端返回的数据(调试用)
if (result.resultCode == 200) {
}
;
},
error : function() {
}
});
} function yunleft() {
// console.log("132465789891651354684");
$.ajax({
type: "GET",
dataType: "json",
url: "/control/yunleft" ,
data: $('#form1').serialize(), //提交的数据
success: function (result) {
console.log(result); //打印服务端返回的数据(调试用)
if (result.resultCode == 200) {
}
;
},
error : function() {
}
});
}
function yunright() {
// console.log("132465789891651354684");
$.ajax({
type: "GET",
dataType: "json",
url: "/control/yunright" ,
data: $('#form1').serialize(), //提交的数据
success: function (result) {
console.log(result); //打印服务端返回的数据(调试用)
if (result.resultCode == 200) {
}
;
},
error : function() {
}
});
}
function down() {
// console.log("132465789891651354684");
$.ajax({
type: "GET",
dataType: "json",
url: "/control/down" ,
data: $('#form1').serialize(), //提交的数据
success: function (result) {
console.log(result); //打印服务端返回的数据(调试用)
if (result.resultCode == 200) {
}
;
},
error : function() {
}
});
}
function guiwei() {
// console.log("132465789891651354684");
$.ajax({
type: "GET",
dataType: "json",
url: "/control/guiwei" ,
data: $('#form1').serialize(), //提交的数据
success: function (result) {
console.log(result); //打印服务端返回的数据(调试用)
if (result.resultCode == 200) {
}
;
},
error : function() {
}
});
}
</script>
<script>
function refreshPage() {

Loading…
Cancel
Save