Skip to content

Instantly share code, notes, and snippets.

@pbloem
Created May 13, 2019 10:15
Show Gist options
  • Save pbloem/1fa9f6c0ed595274b7ec0daa0823f077 to your computer and use it in GitHub Desktop.
Save pbloem/1fa9f6c0ed595274b7ec0daa0823f077 to your computer and use it in GitHub Desktop.
import roslib #; roslib.load_manifest('sr_example')
import rospy
from geometry_msgs.msg import Twist
from std_msgs.msg import Float64, String
rospy.init_node('turtlebot_controller', anonymous=True)
def move(dist, angle):
pub = rospy.Publisher('/turtle1/cmd_vel', Twist, queue_size=10)
message = Twist()
message.linear.x = dist
message.angular.z = angle
pub.publish(message)
rate = rospy.Rate(10)
for _ in range(100):
move(1.0, 1.0)
rospy.sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment