Skip to content

Commit

Permalink
Add some basic docs
Browse files Browse the repository at this point in the history
  • Loading branch information
sklaw committed Jul 6, 2018
1 parent cebdce4 commit afd5082
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 1 deletion.
16 changes: 16 additions & 0 deletions src/rostopics_to_timeseries/RosTopicFilteringScheme.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
from rostopics_to_timeseries.Smoother import Smoother

class RosTopicFilteringScheme(object):
"""A class for configuring timeseries merging.
Args:
resampling_rate: sampling rate of timeseries.
"""

def __init__(self, resampling_rate):
pass
self.filters = []
Expand All @@ -10,6 +15,17 @@ def __init__(self, resampling_rate):
self.rate = resampling_rate

def add_filter(self, topic_name, msg_type, filter_class):
"""Add a filter to fillter message from a specific topic.
Args:
topic_name: name of topic in string.
msg_type: type of message of the topic.
filter_class: class of message filer, has to be a subclass
of TopicMsgFilter.
"""


if not issubclass(filter_class, TopicMsgFilter):
raise Exception("Filter class to be added is not a subclass of TopicMsgFilter.")
self.filters.append(
Expand Down
3 changes: 2 additions & 1 deletion src/rostopics_to_timeseries/RostopicsToTimeseries.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@
class RostopicsToTimeseries(object):
"""
Args:
topic_filtering_config: [TODO]
topic_filtering_config: instance of RosTopicFilteringScheme
containing configuration of timeseries.
"""

def __init__(self, topic_filtering_config):
Expand Down
24 changes: 24 additions & 0 deletions src/rostopics_to_timeseries/TopicMsgFilter.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,42 @@ def __init__(self):
pass

def convert(self, msg):
"""function for filtering a message
Args:
msg: message to be filtered.
Returns:
a list of numbers which is one frame of the timeseries
"""

raise Exception("Unimplemented")

@staticmethod
def vector_size():
"""
Returns: number of dimensions of the timeseries.
"""

raise Exception("Unimplemented")

@staticmethod
def vector_meaning():
"""
Returns: a list of string indicating the meaning of
each dimension of the timeseries.
"""

raise Exception("Unimplemented")

@staticmethod
def get_time(msg):
"""Extract time from a message
Args:
msg: the message whose time is to be extracted
Returns: an instance of <class 'genpy.rostime.Time'>
"""

return msg.header.stamp

class BaxterEndpointStateFilter(TopicMsgFilter):
Expand Down

0 comments on commit afd5082

Please sign in to comment.