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

Add the State set_timestamp function #218

Merged
merged 8 commits into from
Oct 18, 2021
Merged

Conversation

buschbapti
Copy link
Contributor

This PR adds the set_timestamp function in State which I would like to use downstream when receiving timed messages. Also, I have realized the timestamp uses a steady_clock which is different to how ros handles time (those would be system_clock). I think this is still acceptable as we can convert between the two. But we have to acknowledge that properly.

@domire8
Copy link
Contributor

domire8 commented Oct 17, 2021

As we can see, the python bindings need more attention. I remember that I faced the same issue when I was refactoring tests a few weeks back. We need to decide which time module to use in python and then explicitely bind that to the cpp type. Not 100% sure how to do that though.

@eeberhard
Copy link
Member

https://pybind11.readthedocs.io/en/stable/advanced/cast/chrono.html

The C++ timestamp binds to datetime.datetime, so that needs to be used in place of time.localtime(). Precision is limited to microseconds as part of this binding but I feel that is sufficient. I don't think we need to bind a new kind of time object ourselves.

python/test/test_state.py Outdated Show resolved Hide resolved
@buschbapti
Copy link
Contributor Author

Thanks both for checking and correcting, This should be good now

domire8
domire8 previously approved these changes Oct 18, 2021
* Specify nanosecond count since epoch as the integer timestamp
representation in state.proto

* Add an explicit duration type of nanoseconds to clproto header

* Set the timestamp when decoding a message into a State
Copy link
Member

@eeberhard eeberhard left a comment

Choose a reason for hiding this comment

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

Thanks for adding this. Now that python bindings and proto with #219 are updated I think it's good to go!

@buschbapti buschbapti merged commit c27b63f into develop Oct 18, 2021
@buschbapti buschbapti deleted the feature/set-timestamp branch October 18, 2021 08:40
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.

3 participants