ESC Telemetry plugin: add diagnostics support#1705
ESC Telemetry plugin: add diagnostics support#1705amilcarlucas wants to merge 3 commits intomavlink:masterfrom
Conversation
vooon
left a comment
There was a problem hiding this comment.
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.
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.
done, now I just need to find out how to run the cog compiler
There was a problem hiding this comment.
There was a problem hiding this comment.
Ah, sorry, please use for _ in fields. = range is a golangism.
There was a problem hiding this comment.
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.
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.
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?