msg_test.py
Go to the documentation of this file.
1 #!/usr/bin/env python
2 # Robotical Ltd. 2016 - Apache License
3 import rospy
4 # from std_msgs.msg import Int8
5 from marty_msgs.msg import ServoMsg, ServoMsgArray
6 
7 def talker():
8  pub = rospy.Publisher('/marty/servo_array', ServoMsgArray, queue_size=10)
9  rospy.init_node('servo_test', anonymous=True)
10  rate = rospy.Rate(10)
11  servo_cmd_array = ServoMsgArray()
12  servo_cmd_1 = ServoMsg()
13  servo_cmd_2 = ServoMsg()
14  servo_cmd_1.servo_id = 0
15  servo_cmd_1.servo_cmd = 60
16  servo_cmd_2.servo_id = 8
17  servo_cmd_2.servo_cmd = 0
18  servo_cmd_array.servo_msg.append(servo_cmd_1)
19  servo_cmd_array.servo_msg.append(servo_cmd_2)
20  done = False
21 
22  while not rospy.is_shutdown():
23  if not done:
24  pub.publish(servo_cmd_array)
25  done = True
26  rate.sleep()
27 
28 if __name__ == '__main__':
29  try:
30  talker()
31  except rospy.ROSInterruptException:
32  pass
def talker()
Definition: msg_test.py:7


ros_marty
Author(s): Alejandro Bordallo
autogenerated on Fri Jul 21 2017 14:51:45