[ros-users] problems receiving messages

Top Page
Attachments:
Message as email
+ (text/plain)
+ (text/html)
Delete this message
Reply to this message
Author: User discussions
Date:  
To: ros-users
Subject: [ros-users] problems receiving messages



    
    
    
    p { margin-bottom: 0.08in; }a:link {  }




Hi
folks,



I
am having some problems receiving messages.
The
idea is to implement an EKF using data from odometry, gps, laser scan
and row detection.
These
messages are recorded in bags, with frequencies of 45, 95, 75 and 15
Hz, respectively.



First
I implemented a code that just receives the messages, with the
callback associated functions printing on screen the time stamp of
each message, and in the end the program prints the received messages
total number.



The
first strange thing noticed is that, using subscribers queue size = 1
and spinOnce() with loop_rate.sleep() of 1 KHz, I am missing about
50% of the messages recorded in the bags. It is strange, because the
total frequency of the messages in the bags is 230 Hz, and the code
is running at 1 KHz.
Even
that, to solve this, I changed to subscribers queue size = 50 with
spin().




After
it, I started to receive all the messages. But looking to the screen,
it is possible to see that the different type messages are arriving
out of time order. ROS processes the entire queue of one message
type before starting to process the others. This could be the reason
for receiving messages in wrong order. But even looking to the first
message of each block type, the time stamps are still out of order.



I
tried different things, like spin() with multi threads and the
approximate time message filter, and I am still receiving the
messages out of order. My last try was to store all the messages in a
single bag, and run the code in
http://www.ros.org/wiki/rosbag/Cookbook
to order the messages in the bag to match the timestamps. The results
got much better, but I am still receiving some messages out of time
order.



Is
ROS supposed to work like this? Do you have any suggestion to solve
these problems?



Thanks
a lot,



Gustavo
Freitas