Skip to content
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

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mkatliar
Copy link

@mkatliar mkatliar commented May 10, 2022

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:

CMake Error in CMakeLists.txt:
  Target "abb_librws" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "/root/ROS_Gripper/src/abb_librws/Boost::log"

  which is prefixed in the source directory.


CMake Error in CMakeLists.txt:
  Target "abb_librws" INTERFACE_INCLUDE_DIRECTORIES property contains path:

    "/root/ROS_Gripper/src/abb_librws/Boost::log_setup"

  which is prefixed in the source directory.

@mkatliar mkatliar requested review from Kubamot and MathuxNY-73 May 10, 2022 17:57
@mkatliar mkatliar marked this pull request as draft May 10, 2022 17:58
@Kubamot Kubamot force-pushed the kubam_add_set_opmode_function branch from 08a03d7 to 9e0be84 Compare May 12, 2022 06:20
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);

Copy link
Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants