diff --git a/carsrun/car.py b/carsrun/car.py
index 6b9bea3..f6b1743 100644
--- a/carsrun/car.py
+++ b/carsrun/car.py
@@ -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")
@@ -73,4 +78,20 @@ class CAR:
def D(self): # 右转的快捷键
self.right()
def d(self):
- self.right()
\ No newline at end of file
+ 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)
\ No newline at end of file
diff --git a/carsrun/templates/index-t.html b/carsrun/templates/index-t.html
index e5626d8..0279e62 100644
--- a/carsrun/templates/index-t.html
+++ b/carsrun/templates/index-t.html
@@ -46,6 +46,23 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -168,9 +185,106 @@
},
error : function() {
+ }
+ });
+ } 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() {
+
}
});
}
+