kobuki_keyop, keyop.launch
roslaunch kobuki_keyop keyop.launch I want to write a python code to replace keyop.launch. However, it doesn't go well. I think it is wrong with the way to send the message of keyboardinput. How can I solve the problem. I can compile the code. Please help me.
import roslib; roslib.load_manifest('kobuki_keyop')
from kobuki_msgs.msg import KeyboardInput
import rospy
#import KeyboardInput
from std_msgs.msg import String
#from geometry_msgs.msg import Twist
def key():
rospy.init_node("keyop")
pub1 = rospy.Publisher("keyop/motor_power",KeyboardInput)
pub1 = rospy.Publisher("mobile_base/commands/motor_power",KeyboardInput)
pub2 = rospy.Publisher("keyop/cmd_vel",KeyboardInput)
while not rospy.is_shutdown():
str = KeyboardInput()
linear_vel = KeyboardInput()
angular_vel = KeyboardInput()
print str
pub1.publish(linear_vel)
pub2.publish(angular_vel)
rospy.sleep(1.0)
rospy.spin()
if __name__ == '__main__':
key()