Skip to content

Instantly share code, notes, and snippets.

@RDaneelOlivav
Created June 22, 2018 10:13
Show Gist options
  • Save RDaneelOlivav/f3726889ec1cf2c7f6bc4b7d57afb665 to your computer and use it in GitHub Desktop.
Save RDaneelOlivav/f3726889ec1cf2c7f6bc4b7d57afb665 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# license removed for brevity
import rospy
from std_msgs.msg import Float32
def talker():
pub = rospy.Publisher('/pexod/vel_cmd', Float32, queue_size=1)
rospy.init_node('hexapod_mover_node', anonymous=True)
rate = rospy.Rate(1) # 10hz
position = Float32()
position.data = 0.7
while not rospy.is_shutdown():
rospy.loginfo("Moving Hexapod to position =="+str(position))
pub.publish(position)
rate.sleep()
position.data *= -1
if __name__ == '__main__':
try:
talker()
except rospy.ROSInterruptException:
pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment