[Rock-dev] [Rock-Ros Bridge] Create a suscriber
Pierre Letier
pierre.letier at spaceapplications.com
Tue Jun 4 11:51:11 CEST 2013
Hello,
I have the following ROS python code that suscribes to the "chatter"topic.
In Rock, I have a component that has an ouptut port that I would like to
publish to this subscribber. The translation of the data between ROS and
Rock is working (convertion to Float32MultiArray), but I don't find how
to write the ruby script that will publish to ROS and I don't understand
how to define the topic name in the rock script (I have to provide the
topic name in the listener.py (rospy.Subscriber(...)).
Is it possible to provide an example doing this ? Do you need other
information ?
In the documentation, there is a reference to "connection_policy", do
you have an example ?
The output port is named "command"
Thank you
Pierre
--
Pierre Letier
Robotics Engineer
25 Years in Space!
1987 - 2012
Space Applications Services NV/SA
Leuvensesteenweg 325, 1932 Zaventem, Belgium
Phone: +32 (0)2-416.05.04
Fax: +32 (0)2-721.54.44
www.spaceapplications.com
-------------- next part --------------
#!/usr/bin/env python
import rospy
from std_msgs.msg import Float64, Float32MultiArray
def callback(data):
rospy.loginfo(rospy.get_name() + ": I heard %s" % str(data))
def listener():
rospy.init_node('listener', anonymous=True)
rospy.Subscriber("chatter", Float32MultiArray, callback)
rospy.spin()
if __name__ == '__main__':
listener()
More information about the Rock-dev
mailing list