Ask Your Question

raminzohouri's profile - activity

2016-09-27 20:53:38 -0500 received badge  Good Question (source)
2016-03-31 00:54:57 -0500 received badge  Nice Question (source)
2015-05-31 16:15:51 -0500 received badge  Notable Question (source)
2015-05-31 16:15:51 -0500 received badge  Famous Question (source)
2014-08-24 08:05:17 -0500 commented answer access message filters cache data in python

Thanks for the reply I did so and now I am publishing the packets getting them from cache .... the code is looks like this now and I am using a service to read from the new topic... I hope this code is optimal ?

`

message_filters::Cache<bci_eeg_msgs::EegPacket>
eeg_packet_cache;
bci_eeg_msgs::EegPacketBuffer
eeg_packet_buffer; ros::Publisher
eeg_packet_buffer_pub ;

void some_function (const
bci_eeg_msgs::EegPacket::ConstPtr
&msg) {
    eeg_packet_cache.add(msg);

    std::vector<bci_eeg_msgs::EegPacket::ConstPtr>
eeg_cache_vector =
           eeg_packet_cache.getInterval(eeg_packet_cache.getOldestTime(),
eeg_packet_cache.getLatestTime());
       for(uint i = 0; i < eeg_cache_vector.size(); ++i){   
eeg_packet_buffer.data.push_back(*eeg_cache_vector[i]);
}   
eeg_packet_buffer_pub.publish(eeg_packet_buffer);
     }

int main(int argc, char **argv) {  
ros::init(argc, argv,
"caching_example");  
ros::NodeHandle nh;  
eeg_packet_cache.setCacheSize(128*5);
ros::Subscriber sub =
nh.subscribe("/eeg_signal_packet",
256 , some_function);  
eeg_packet_buffer_pub = 
      nh.advertise<bci_eeg_msgs::EegPacketBuffer>("/eeg_packet_buffer",1);
ros::spin();   return 0; }`
2014-08-24 08:01:45 -0500 received badge  Popular Question (source)
2014-08-24 04:08:09 -0500 commented answer access message filters cache data in python

I did so and it keep losing around 20 packets that are important for me.. actually I am trying to make emokit signals in available in ros... I can publish the message but the points is each message contains one packet and the sampling frequency for the device is 128Hz. Publisher does not lose any packet, also the subscriber.

But i need to queue 10 second of these packets and lose a service ros service to access the desired interval. Do you have any suggestion about how to do this ?

Boost::circularBuffer is the thing i am trying to use for queuing messages at moment .

2014-08-24 03:10:15 -0500 received badge  Student (source)
2014-08-24 02:27:14 -0500 commented answer access message filters cache data in python

Hey Austin

Thank you very much for your reply. I will report the issue for sure. At the mean time I have implemented the C++ version of the message filters cache. it looks find except that I have some packet lost in between. I am publishing a message with header and there I have 128Hz frequency but when I am reading cache with :

  1. start_time = ros::Time::now();
  2. cache.getInterval(start_time - ros::Duration(1), start_time).size()

The vector has size of 107-115. When I only subscribe and print it also seems fine. Are there any packet lost of I just need to increase the duration to get full cycle that i publish ?

2014-08-24 02:15:02 -0500 received badge  Supporter (source)
2014-08-23 13:30:52 -0500 edited question access message filters cache data in python

Hi all

I am suing message filters cache in my little python code but I couldn't figure out to access the cache data. It seems the python version has not function cache.getInterval(start, end).

in tutorial there is only c++ example seems to have the function but the python version doesn't.

Could anyone please tell me how can I possibly access the cache data.

Here is the is my code


class EegListener(object):

 def __init__(self):

     rospy.init_node('eeg_listener')
     self.eeg_subscriber = message_filters.Subscriber("/eeg_signal_packet", EegPacket)
             # the topick contains Header type and float64[] type
     self.eeg_cache = message_filters.Cache(self.eeg_subscriber, 1280)

 def callback(self,eeg_msg):                 
             print eeg_msg.header 
 def listener(self):
     self.eeg_cache.registerCallback(self.callback)
             #  self.eeg_cache.getInterval(rospy.get_rostime(),rospy.get_rostime()) does not exists !?
         rospy.spin()
2014-01-28 17:27:49 -0500 marked best answer "sensor_msgs::ImageConstPtr" encoding and type casting

Hi all in my program I subscribe this topic "/camera/depth/image" and I want to use this image for visual optometry in Fovis.

I use this function parameter "sensor_msgs::ImageConstPtr depth_image" and the encoding of this topic "depth_image->encoding.c_str()" is "32FC1" .

how cant I cast this type to "const uint16_t" ? and also for similar types like " 8UC[1-4],8SC[1-4],16UC[1-4],16SC[1-4],32SC[1-4],32FC[1-4],64FC[1-4]" ?

thank you in advance Ramin

2014-01-28 17:27:48 -0500 marked best answer rosbag play speed

Hi All I am using rosbag play --clock myrecod.bag to play file and subscribe these three topics: "/camera/rgb/image_color", "/camera/depth/image", "/camera/depth/camera_info" and I want to process each frame of these topics by fovis (http://code.google.com/p/fovis/).my recording file is 20 fps and I have time-consuming calculation on each frame of data. There for I only able to subscribe 4 fps of my recordings.

How can I slow down the play back speed of my recordings file in order to get all frames?

Thanks in Advance Ramin

2013-06-01 16:00:09 -0500 received badge  Famous Question (source)
2013-01-29 02:17:29 -0500 received badge  Notable Question (source)
2012-12-09 19:06:55 -0500 received badge  Popular Question (source)
2012-12-06 23:54:04 -0500 answered a question no matching function for call to message_filters::sync_policies::ApproximateTime

Hi Christian

Thank you for you answer. It was a good hint , but in order to get ride of that error I have to do initialize the second constructor like this :

FOVISODOMETRY::FOVISODOMETRY(vector<string> cameraTopices, const string bagFileName, const char visual_odom_frame_name):image_sync_( ApproximateTimeCustomPolicy(10), camera_info_sub_, rgb_image_sub_, depth_image_sub_)*

but I still have one question : Although I don't use it in second constructor ,why should I initialize this message_filter::synchronizer ? would you please help me on this !

thanks in advance . Ramin

typedef message_filters::sync_policies::ApproximateTime< sensor_msgs::CameraInfo, sensor_msgs::Image, sensor_msgs::Image> ApproximateTimeCustomPolicy; message_filters::Synchronizer<approximatetimecustompolicy> image_sync_;

2012-12-06 02:29:04 -0500 received badge  Editor (source)
2012-12-06 02:27:03 -0500 asked a question no matching function for call to message_filters::sync_policies::ApproximateTime

Hi All I am using ROS to subscribe some camera topics in two different ways. Fist subscribe Topic from published messages and second subscribe them directly from bag file without playing bag the file , just read it directly.

in this program i have two different constructor one for published message and the other for reading file in each of the there are functions which do these tasks.

I have this error :

**/opt/ros/fuerte/include/message_filters/synchronizer.h:152: error: no matching function for call to 'message_filters::sync_policies::ApproximateTime<sensor_msgs::CameraInfo_<std::allocator<void> >, sensor_msgs::Image_<std::allocator<void> >, sensor_msgs::Image_<std::allocator<void> > >::ApproximateTime()'**

these are my constructors :

//for reading bag file 

FOVISODOMETRY::FOVISODOMETRY(vector<string> cameraTopices,
        const string bagFileName, const char* visual_odom_frame_name)
{
/// some implementations 
}

////for subscribing from published massages 

FOVISODOMETRY::FOVISODOMETRY(const char* image_topic,
        const char* depth_image_topic, const char* camera_info_topic,
        const char* visual_odom_frame_name) :
        initialized_(false), fovis_initialized_(false), depth_image_(NULL),       depth_data_(
                NULL), grayscale_data_(NULL), rect_(NULL), odom_(NULL), node_(
                ""), private_node_("~"), camera_info_sub_(node_,
                camera_info_topic, 100), rgb_image_sub_(node_, image_topic,
                100), depth_image_sub_(node_, depth_image_topic, 100),image_sync_(
                ApproximateTimeCustomPolicy(10), camera_info_sub_,
                rgb_image_sub_, depth_image_sub_), odom_broadcaster_()

{
/// some implementations 
}

and these are the massage filter Synchronizer :

typedef message_filters::sync_policies::ApproximateTime<
            sensor_msgs::CameraInfo, sensor_msgs::Image, sensor_msgs::Image> ApproximateTimeCustomPolicy;

message_filters::Synchronizer<ApproximateTimeCustomPolicy> image_sync_;

there is one point : when I omit the file reading constructor its has no error but as soon as I add the second constructor the error appears .

please let me how can I have both of my constructors and also no error

thank you in advance

2012-11-13 21:39:57 -0500 received badge  Famous Question (source)
2012-11-13 03:16:15 -0500 received badge  Famous Question (source)
2012-11-05 03:03:17 -0500 answered a question "sensor_msgs::ImageConstPtr" encoding and type casting

Hi Thomas Thank you for your response.Its the type casting works for me and I get data that I want for Fovis .However I found that the topic ""/camera/depth/image" which I subscribe from a bag file is return rectified depth data and Fovis itself rectified data as well so its end up with a odometry far away from grand truth.

I may record those bag file in the row format and then try to rectify them in my program .

2012-11-05 02:56:05 -0500 received badge  Notable Question (source)
2012-10-24 00:56:18 -0500 received badge  Popular Question (source)
2012-10-23 01:25:59 -0500 received badge  Notable Question (source)