Add setOperationMode to rw/panel - #35
Draft
mkatliar wants to merge 2 commits into
Draft
Conversation
mkatliar
marked this pull request as draft
May 10, 2022 17:58
This reverts commit 96d0d8f.
Kubamot
force-pushed
the
kubam_add_set_opmode_function
branch
from
May 12, 2022 06:20
08a03d7 to
9e0be84
Compare
mkatliar
commented
May 12, 2022
Comment on lines
+76
to
+94
| /** | ||
| * @brief Set robot operation mode. | ||
| * | ||
| * The documentation strings are taken from | ||
| * https://developercenter.robotstudio.com/api/RWS?urls.primaryName=Panel%20Service -> POST rw/panel/mode | ||
| */ | ||
| enum class SetOperationMode | ||
| { | ||
| // State manual mode | ||
| man, | ||
| // State manual mode & full speed | ||
| manF, | ||
| // State automatic mode | ||
| automatic, | ||
| }; | ||
|
|
||
|
|
||
| std::ostream& operator<<(std::ostream& os, SetOperationMode mode); | ||
|
|
Author
There was a problem hiding this comment.
This is not a good idea to have two separate types representing the same thing. "Controller operation modes" is one thing. Imagine you have a code:
void foo(RWSClient& client, OperationMode mode)
{
if (getOperationMode(client) != mode)
{
do_something();
setOperationMode(client, mode);
}
}what would you do if getOperationMode() and setOperationMode() used different types?
Not every OperationMode is a valid argument value for setOperationMode(), but this is perfectly fine -- you can throw std::invalid_argument.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Implemented
panel::setOperationMode()to fix this issue: https://nomagic.atlassian.net/browse/RMSTRNG-860@MathuxNY-73 we had to revert 96d0d8f because it broke the container build: