|
@@ -15,25 +15,19 @@ from ros_arduino_msgs.srv import CameraControl
|
|
|
import time
|
|
|
|
|
|
msg = """
|
|
|
-Reading from the keyboard and Publishing to Twist!
|
|
|
+从键盘读取控制命令遥控小车移动,控制按键如下:
|
|
|
---------------------------
|
|
|
-Moving around:
|
|
|
- i
|
|
|
+ u i o
|
|
|
j k l
|
|
|
- ,
|
|
|
+ m , .
|
|
|
|
|
|
-anything else : stop
|
|
|
|
|
|
q/z : increase/decrease max speeds by 10%
|
|
|
w/x : increase/decrease only linear speed by 10%
|
|
|
e/c : increase/decrease only angular speed by 10%
|
|
|
-1/2 : increase/decrease up/down servo angle(0-180°) by 5°
|
|
|
-3/4 : increase/decrease left/right servo angle(0-180°) by 5°
|
|
|
|
|
|
-1 : Camera UP
|
|
|
-2 : Camera Down
|
|
|
-3 : Camera Left
|
|
|
-4 : Camera Right
|
|
|
+1/2 : 相机向上/向下转动
|
|
|
+3/4 : 相机向左/向右转动
|
|
|
|
|
|
CTRL-C to quit
|
|
|
"""
|
|
@@ -43,6 +37,10 @@ moveBindings = {
|
|
|
'j':(0,0,0,1),
|
|
|
'l':(0,0,0,-1),
|
|
|
',':(-1,0,0,0),
|
|
|
+ 'u':(1,0,0,1),
|
|
|
+ 'o':(1,0,0,-1),
|
|
|
+ 'm':(-1,0,0,-1),
|
|
|
+ '.':(-1,0,0,1),
|
|
|
}
|
|
|
|
|
|
speedBindings={
|
|
@@ -76,7 +74,7 @@ def getKey():
|
|
|
|
|
|
|
|
|
def vels(speed,turn):
|
|
|
- return "currently:\tspeed %s\tturn %s " % (speed,turn)
|
|
|
+ return "当前控制速度: 线速度: %s 角速度: %s" % (speed,turn)
|
|
|
|
|
|
def angles(angle):
|
|
|
return "currently:\tangle %s " % (angle)
|
|
@@ -98,7 +96,7 @@ if __name__=="__main__":
|
|
|
pub = rospy.Publisher('cmd_vel', Twist, queue_size = 2)
|
|
|
rospy.init_node('teleop_twist_keyboard')
|
|
|
|
|
|
- speed = rospy.get_param("~speed", 0.12)
|
|
|
+ speed = rospy.get_param("~speed", 0.30)
|
|
|
turn = rospy.get_param("~turn", 1.0)
|
|
|
|
|
|
x = 0
|