ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Vikas's profile - activity

2016-04-28 04:44:46 -0500 received badge  Good Answer (source)
2016-04-28 04:44:46 -0500 received badge  Enlightened (source)
2014-10-20 20:13:18 -0500 received badge  Nice Answer (source)
2014-02-27 00:50:41 -0500 received badge  Necromancer (source)
2014-01-22 10:10:31 -0500 answered a question Can you recommend a module for localization using one ore two video cameras?

I'll suggest PTAM

2014-01-22 09:03:14 -0500 commented answer Cannot install ROS Hydro on Ubuntu 12.04

Just a clarification: After "sudo aptitude install ps-engine" first option will be to not install ps-engine. It should be rejected with "n" and then the next option will be to install older version of ps-engine which should be accepted.

2013-09-27 10:53:56 -0500 answered a question Is there a tf:MessageFilter in the tf Python API?

I didn't find any either. I have written something similar. let me know if you find it useful.

import rospy

import Queue
import tf 
from message_filters import SimpleFilter

class TfMessageFilter(SimpleFilter):
    """Stores a message unless corresponding transforms is 
    available
    """
    def __init__(self, input_filter, base_frame, target_frame,
                 queue_size=500):
        SimpleFilter.__init__(self)
        self.connectInput(input_filter)
        self.base_frame = base_frame
        self.target_frame = target_frame
        # TODO: Use a better data structure
        self.message_queue = Queue.Queue(maxsize=queue_size)
        self.listener = tf.TransformListener()
        self.max_queue_size = queue_size
        self._max_queue_size_so_far = 0

    def connectInput(self, input_filter):
        self.incoming_connection = \
                input_filter.registerCallback(self.input_callback)

    def poll_transforms(self, latest_msg_tstamp):
        """
        Poll transforms corresponding to all messages. If found throw older
        messages than the timestamp of transform just found
        and if not found keep all the messages.
        """
        # Check all the messages for transform availability
        tmp_queue = Queue.Queue(self.max_queue_size)
        first_iter = True
        # Loop from old to new
        while not self.message_queue.empty():
            msg = self.message_queue.get()
            tstamp = msg.header.stamp
            if (first_iter and 
                self.message_queue.qsize() > self._max_queue_size_so_far):
                first_iter = False
                self._max_queue_size_so_far = self.message_queue.qsize()
                rospy.logdebug("Queue(%d) time range: %f - %f" %
                              (self.message_queue.qsize(), 
                               tstamp.secs, latest_msg_tstamp.secs))
                rospy.loginfo("Maximum queue size used:%d" %
                              self._max_queue_size_so_far)
            if self.listener.canTransform(self.base_frame, self.target_frame,
                                          tstamp):
                (trans, quat) = self.listener.lookupTransform(self.base_frame,
                                              self.target_frame, tstamp)
                self.signalMessage(msg, (trans, quat))
                # Note that we are deliberately throwing away the messages
                # older than transform we just received
                return
            else:
                # if we don't find any transform we will have to recycle all
                # the messages
                tmp_queue.put(msg)
        self.message_queue = tmp_queue

    def input_callback(self, msg):
        """ Handles incoming message """
        if self.message_queue.full():
            # throw away the oldest message
            rospy.logwarn("Queue too small. If you this message too often"
                          + " consider increasing queue_size")
            self.message_queue.get()

        self.message_queue.put(msg)
        # This can be part of another timer thread
        # TODO: call this only when a new/changed transform
        self.poll_transforms(msg.header.stamp)

Suggested usage:

import message_filters
import rospy
from sensor_msgs.msg import Image

def callback(image, trans_rot):
    print("Got image:%f" % image.header.stamp.secs)

rospy.init_node('test_tf_sync_msgs', log_level=rospy.DEBUG)
image_sub = message_filters.Subscriber('/camera/depth_registered/image_rect',
                                       Image)

ts = TfMessageFilter(image_sub, '/map', '/ar_viewer',
                                queue_size=1000)
ts.registerCallback(callback)
rospy.spin()
2013-09-21 11:01:57 -0500 commented question Openni_Launch on Lion with Xtion

>> does FIND the camera in the virtualbox vm of Ubuntu, and everything acts like it's about to work, but there is just no picture and on rostopic the camera node is just not displaying data? I have a similar problem on Ubuntu guest with Ubuntu host.

2013-07-09 21:54:27 -0500 received badge  Teacher (source)
2012-11-16 11:44:56 -0500 answered a question what's wrong with rgbdslam ?

Add rt to the libraries to be linked.

Change

SET(LIBS_LINK GL GLU ${G2O_LIBS} ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY} ${GLUT_LIBRARY} ${OPENGL_LIBRARY} ${OpenCV_LIBS} -lboost_signals)

in CMakeLists.txt to

SET(LIBS_LINK rt GL GLU ${G2O_LIBS} ${QT_LIBRARIES} ${QT_QTOPENGL_LIBRARY} ${GLUT_LIBRARY} ${OPENGL_LIBRARY} ${OpenCV_LIBS} -lboost_signals)

2012-02-10 04:19:31 -0500 answered a question tf/tutorials demo problem ros-electric

this is actually a warning when you request a frame with timestamp which is in future with respect to the latest frame available.

The warning text is probably changed in electric. The corresponding warning in diamondback is given in the following tutorial.

http://www.ros.org/wiki/tf/Tutorials/tf%20and%20Time%20%28C%2B%2B%29

2012-02-10 02:30:09 -0500 received badge  Supporter (source)