-
Notifications
You must be signed in to change notification settings - Fork 5
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
Add setOperationMode to rw/panel #35
base: master
Are you sure you want to change the base?
Conversation
This reverts commit 96d0d8f.
08a03d7
to
9e0be84
Compare
/** | ||
* @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); | ||
|
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 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
.
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: