-
Notifications
You must be signed in to change notification settings - Fork 993
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
ESC Telemetry plugin: add diagnostics support #1705
base: master
Are you sure you want to change the base?
ESC Telemetry plugin: add diagnostics support #1705
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would rather having separate diagnostics for each ESC than each value.
Config part looks ugly. You can use private node handle to shorten paths.
auto pnh = ros::NodeHandle(ros::NodeHandle("~esc_telemetry"), "diagnostics")
pnh.param("enabled", diag_enabled, false);
...
Also you can move limit init to custom diag class. |
I will work on that than.
Will that not create a bunch independent of limits per ESC? That is a bit too much "configurability"! |
Not necessary to use different names. E.g.
|
I did some of the changes you requested, but I think I did not use it the way you planned. Can you take a look at it? |
pnh.param("curr_max/nok", this->_curr_max_nok, 10.0f); | ||
pnh.param("curr_max/ok", this->_curr_max_ok, 8.0f); | ||
pnh.param("rpm_max/nok", this->_rpm_max_nok, 12000); | ||
pnh.param("rpm_max/ok", this->_rpm_max_ok, 9000); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps i'd generate that list by cog.
// [[[cog:
// fields = [
// ("temp", (1.0, 0.0), (85.0, 90.0), ),
// ...
// ]
//
// for field, min_, max_ = range fields:
// for fm, lim = zip(("min", "max"), (min_, max_)):
// for fn, l = zip(("ok", "nok"), lim):
// cog.outl(f"""pnh.param("{field}_{fm}/{fn}", this->{field}_{fm}_{fn}, {l});""")
// ]]]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done, now I just need to find out how to run the cog compiler
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, sorry, please use for _ in fields
. = range
is a golangism.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed it, but now it has other issues :(
c39664b
to
6f2276c
Compare
int rpm_min_nok; | ||
int rpm_min_ok; | ||
int rpm_max_nok; | ||
int rpm_max_ok; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can generate most of that fields by cog also. Will need to move fields list and extend it to have type.
lim(lim_) | ||
{} | ||
|
||
const Limits& lim; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah no, we can't really use const ref on temporary object. https://stackoverflow.com/questions/15513734/const-reference-as-class-member
Try to add limits object to the plugin class and pass it to diags.
9841fa9
to
7c45aef
Compare
@amilcarlucas could you please post gcc error here? |
It is deep and ugly:
Thanks for your review and help |
Add |
Thanks! It compiles now. But cog does not:
|
9dd8487
to
613f38d
Compare
What version of python do you use? For f-strings you need >= 3.6. |
613f38d
to
f56d42c
Compare
My bad I was using I will move the diagnostics to the dynamically created ESC objects ... soonish |
|
f56d42c
to
14fc11d
Compare
This create separated diagnostics for:
Should I instead create one diagnostic per ESC?