Package rospy :: Module numpy_msg

Module numpy_msg

source code

Support for using numpy with rospy messages.

For tutorials, see http://www.ros.org/wiki/rospy_tutorials/Tutorials/numpy

Listener example:

   from rospy.numpy_msg import numpy_msg

   rospy.init_node('mynode')
   rospy.Subscriber("mytopic", numpy_msg(TopicType)

Publisher example:

   from rospy.numpy_msg import numpy_msg
   import numpy
   
   pub = rospy.Publisher('mytopic', numpy_msg(TopicType))
   rospy.init_node('mynode')
   a = numpy.array([1.0, 2.1, 3.2, 4.3, 5.4, 6.5], dtype=numpy.float32)
   pub.publish(a)
Functions
 
numpy_msg(msg_type) source code
Variables
  __package__ = 'rospy'