-
Notifications
You must be signed in to change notification settings - Fork 128
Added support for std::vector strings in UrDriver #408
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
base: master
Are you sure you want to change the base?
Added support for std::vector strings in UrDriver #408
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #408 +/- ##
==========================================
- Coverage 42.87% 42.84% -0.04%
==========================================
Files 99 99
Lines 8636 8657 +21
Branches 1171 1179 +8
==========================================
+ Hits 3703 3709 +6
- Misses 4654 4664 +10
- Partials 279 284 +5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
|
Thank you for the contribution! I also wanted to do that a couple of times already, it just never wasn't important enough. I'll have to think a bit about potential side effects and we would need to add some tests for this. |
|
I will think about the tests for starters, specially since with this change we are avoiding the error messages occurring when there is no recipe file defined for the driver (which throws an error with a |
Yes, exactly. I think, there should be an error raised when
A warning should be raised if
Do we want to allow e.g. defining the output recipe from a file, but the input recipe from a vector (or vice versa)? My initial answer would be "yes". Tests should then cover all the different permutations and check for the expected success / error. Edit: The above behavior should also be documented in the Configuration struct, so it is clear to users without looking at the tests or the implementation. |
|
improved the logic with your suggestions @urfeex . Only the tests are left. Will try to get them done before the end of this week, but cannot promise it 😅 I made the readRecipe function static public, which design-wise it isn't the most appealing, probably an interface that is in charge of all the system IO (referring to files, not the networking) might be better, but since there aren't many other things that need to be parsed it might be an overkill. |
80ab78a to
7d9ba11
Compare
|
@urfeex Okay, I added some tests to the UrDriver to use the new functionality of the input parsing. Since they are not affecting each other, I made only 1 test for each of the following cases since the input/output are handled independently: only recipe files, only recipe vectors, and both at the same time. |
7d9ba11 to
58a35fe
Compare
| const std::string& input_recipe_file, const bool headless_mode = true, | ||
| const std::string& input_recipe_file, const std::vector<std::string> output_recipe, | ||
| const std::vector<std::string> input_recipe, const bool headless_mode = true, |
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.
This is definitively a breaking API change, which you also experienced changing all of the examples. May I suggest adding a second constructor accepting the vectors instead of the filenames? Alternatively, add this signature as second constructor and maybe deprecate the existing one.
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 do that, but one particular case won't be tested (both the files and the vectors are defined). Since this is only used for testing, I thought about adding a constructor that supports both inputs simultaneously (besides the current constructor). But to keep it consistent, I will add a third constructor that only has the vectors of strings
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 know, I did suggest the deprecation myself, but I think, we don't want to go down that route. Having two constructors, one with recipe files and one with recipe vectors should be sufficient. Then users can pick. Please also leave the examples as is for the scope of this PR.
For testing both being defined we don't need the example wrapper, the UrDriver can be used directly.
4ae9219 to
e11e60b
Compare
urfeex
left a comment
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 think we can simplify the logic by always using the vector-based constructor internally. Also note, that an empty / no input recipe is allowed.
You seem to have removed the tests. Adding tests to the UrDriverTest suite should be quite straightforward.
Co-authored-by: Felix Exner <feex@universal-robots.com>
Co-authored-by: Felix Exner <feex@universal-robots.com>
Co-authored-by: Felix Exner <feex@universal-robots.com>
|
Indeed, logic does look cleaner and more correct with your suggestion. I created some test with the UrDriverInit test class type |
565d742 to
37f300f
Compare
Since it is a functionality allowed by the RTDEClient, seems reasonable to also add it to the UrDriver.