Skip to content

Instantly share code, notes, and snippets.

@detik19
Created December 27, 2014 14:25
Show Gist options
  • Save detik19/48a1c5b9d384bb6c1921 to your computer and use it in GitHub Desktop.
Save detik19/48a1c5b9d384bb6c1921 to your computer and use it in GitHub Desktop.
How to Suscribe to turtle1/command_velocity in node turtlesim turtle_teleop_key
#!/usr/bin/env python
import roslib; roslib.load_manifest('second_tutorials')
import rospy
from turtlesim.msg import Velocity
def callback(data):
rospy.loginfo(rospy.get_name()+"I heard %f", data.linear)
def listener():
rospy.init_node('TedyGanteng', anonymous=True)
rospy.Subscriber("turtle1/command_velocity", Velocity, callback)
rospy.spin()
if __name__=='__main__':
listener()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment