diff --git a/Docker/turtle_control/scripts/teleop_twist_keyboard.py b/Docker/turtle_control/scripts/teleop_twist_keyboard.py old mode 100644 new mode 100755 index eb7b570..2ff9d5a --- a/Docker/turtle_control/scripts/teleop_twist_keyboard.py +++ b/Docker/turtle_control/scripts/teleop_twist_keyboard.py @@ -1,5 +1,5 @@ #!/usr/bin/env python - +#From here:https://github.com/ros-teleop/teleop_twist_keyboard from __future__ import print_function import threading @@ -80,10 +80,10 @@ speedBindings = { class PublishThread(threading.Thread): - def __init__(self, rate): + def __init__(self, pString, rate): super(PublishThread, self).__init__() self.publisher = rospy.Publisher( - "/cmd_vel_mux/input/navi", TwistMsg, queue_size=1 + pString, TwistMsg, queue_size=1 ) self.x = 0.0 self.y = 0.0 @@ -207,6 +207,17 @@ def vels(speed, turn): if __name__ == "__main__": + pString = "/cmd_vel_mux/input/navi" + if len(sys.argv) == 2: + if sys.argv[1] == "-turtlebot": + print("Okay turtlebot it is!") + elif sys.argv[1] == "-turtlesim": + print("Okay turtlesim it is!") + pString = "/turtle1/cmd_vel" + else: + print("Possible is -turtlebot or -turtlesim") + print("Will use turtlebot!") + settings = saveTerminalSettings() rospy.init_node("teleop_twist_keyboard") @@ -222,7 +233,7 @@ if __name__ == "__main__": if stamped: TwistMsg = TwistStamped - pub_thread = PublishThread(repeat) + pub_thread = PublishThread(pString,repeat) x = 0 y = 0