[Rock-dev] [Rock-Ros Bridge] Create a suscriber

Sylvain Joyeux sylvain.joyeux at dfki.de
Tue Jun 4 12:33:22 CEST 2013


On 06/04/2013 12:21 PM, Pierre Letier wrote:
> Le 6/4/2013 12:06 PM, Sylvain Joyeux a écrit :
>> On 06/04/2013 11:51 AM, Pierre Letier wrote:
>>> 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(...)).
>> The connection_policy argument is optional. I'll update for that.
>>
>> Given your email, I guess that the documentation on the "Runtime
>> Setup" page seems to be (almost) enough ... What are you missing
>> exactly ? What was not clear ?
> I want to publish from a rock component on ROS. Considering that "ros"
> is the name of the Task and that he has an output port "command" written
> periodically (type Pose), If I want to publish on ROS:
>
> "ros.command.publish_on_ros('/chatter', ?????)' with ????? for the
> connection_policy that I don't know how to write.
>
> Then, in the listener.py, I have
>
> "rospy.Subscriber("chatter", Float32MultiArray, callback)" with callback
> the function called when I receive a data.
>
> Is it the way to do ? What about connection policy ?
It definitely is. You can just not give any connection policy, the 
default will work for you.

ros.command.publish_on_ros('/chatter')

The connection policy is the normal orocos connection policy. As far as 
I know, it is mostly relevant for subscribing input ports when on ROS, 
as the buffering is defined on the receiving side in ROS.

For instance, for a hypothetical input port:

ros.pose.subscribe_to_ros('/chatter', :type => :buffer, :size => 10)
-- 
Sylvain Joyeux (Dr.Ing.)
Space & Security Robotics

!!! Achtung, neue Telefonnummer!!!

Standort Bremen:
DFKI GmbH
Robotics Innovation Center
Robert-Hooke-Straße 5
28359 Bremen, Germany

Phone: +49 (0)421 178-454136
Fax:   +49 (0)421 218-454150
E-Mail: robotik at dfki.de

Weitere Informationen: http://www.dfki.de/robotik
-----------------------------------------------------------------------
Deutsches Forschungszentrum fuer Kuenstliche Intelligenz GmbH
Firmensitz: Trippstadter Straße 122, D-67663 Kaiserslautern
Geschaeftsfuehrung: Prof. Dr. Dr. h.c. mult. Wolfgang Wahlster
(Vorsitzender) Dr. Walter Olthoff
Vorsitzender des Aufsichtsrats: Prof. Dr. h.c. Hans A. Aukes
Amtsgericht Kaiserslautern, HRB 2313
Sitz der Gesellschaft: Kaiserslautern (HRB 2313)
USt-Id.Nr.:    DE 148646973
Steuernummer:  19/673/0060/3
-----------------------------------------------------------------------


More information about the Rock-dev mailing list