Skip to content

Conversation

@domire8
Copy link
Member

@domire8 domire8 commented May 29, 2024

Description

See quick discussion in parent issue. We added the rate parameter previously in a non breaking way which required a few hacks with the parameters overrides. I think it will be nice to commit to a double rate parameter for v5. I added some helpers to get the period directly as few different types.

Review guidelines

Estimated Time of Review: 10 minutes

Checklist before merging:

  • Confirm that the relevant changelog(s) are up-to-date in case of any user-facing changes

@domire8 domire8 requested review from bpapaspyros and eeberhard May 29, 2024 06:29
this->add_predicate("in_error_state", false);

this->rate_ = this->get_parameter_value<double>("rate");
this->period_ = 1.0 / this->rate_;
Copy link

@bpapaspyros bpapaspyros May 29, 2024

Choose a reason for hiding this comment

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

Do we really need to have a member variable for the period? As in, couldn't we just call the get_period() function which in C++ could be a constexpr 1 / rate_. Clearly this is not a mistake, just trying to understand if it's for ease of use in derived classes or serves another purpose.

Same goes for the python code.

Copy link
Member Author

Choose a reason for hiding this comment

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

I wanted to save one operation...No there is no other purpose, I will remove it 👍

Copy link

@bpapaspyros bpapaspyros May 29, 2024

Choose a reason for hiding this comment

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

no strong opinion on this honestly. And I do hear the argumentation of saving one operation. The reason I asked is because we rarely use period in our derived classes.

Copy link
Member Author

Choose a reason for hiding this comment

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

The reason I asked is because we rarely use period in our derived classes.

We have several motion components that are interested in the component period for sinusoidal motion or to keep track of elapsed time. At the end, it's all about providing the helpers to simplify the work of the users.

Choose a reason for hiding this comment

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

You are right yes. Then let's leave it and resolve this question. Thank you!

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.

Nicely done, I really like that with the helper functions 👍

@domire8 domire8 merged commit 003c77b into breaking May 31, 2024
@domire8 domire8 deleted the refactor/rate branch May 31, 2024 12:55
@github-actions github-actions bot locked and limited conversation to collaborators May 31, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants