Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowed saving timestamp-less messages to Cache (using rospy.Time.now() as their timestamp). #636

Closed
wants to merge 3 commits into from

Conversation

peci1
Copy link
Contributor

@peci1 peci1 commented Jul 9, 2015

Also added a convenience getLast method for retrieving the last message in the cache.

…() as their timestamp).

Also added a convenience `getLast` method for retrieving the last message in the cache.
@ros-pull-request-builder
Copy link
Member

Can one of the admins verify this patch?

@tfoote
Copy link
Member

tfoote commented Jul 9, 2015

I don't believe we should ever automatically stamp unstamped data. An alternative would be to provide a 2nd argument to which the user could add the timestamp explicitly.

@peci1
Copy link
Contributor Author

peci1 commented Jul 9, 2015

Okay, what about adding an __init__ argument defaulting to False, which, set to True, would allow for automatic timestamping?

@dirk-thomas
Copy link
Member

That constructor argument sounds like a good option.

return [m for m in self.cache_msgs
if m.header.stamp >= from_stamp and m.header.stamp <= to_stamp]
return [self.cache_msgs[i] for i in range(0, len(self.cache_msgs))
if self.cache_times[i] >= from_stamp and self.cache_times[i] <= to_stamp]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please keep the list comprehension as simple as possible, e.g.:

[ m for i, m in enumerate(self.cache_msgs) if self.cache_times[i] >= from_stamp and self.cache_times[i] <= to_stamp]

Or even better you could even use zip to iterate over both lists at the same time.

@peci1
Copy link
Contributor Author

peci1 commented May 17, 2016

I've implemented your suggestion with the constructor argument. I've also added tests. Should I retarget to kinetic-devel, or is it okay this way?

@tfoote
Copy link
Member

tfoote commented May 17, 2016

lgtm, it would be better to target for kinetic and consider backporting only if there's strong demand

@peci1
Copy link
Contributor Author

peci1 commented May 17, 2016

Ok, see #806 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants