Skip to content

Add setOperationMode to rw/panel - #35

Draft
mkatliar wants to merge 2 commits into
masterfrom
kubam_add_set_opmode_function
Draft

Add setOperationMode to rw/panel#35
mkatliar wants to merge 2 commits into
masterfrom
kubam_add_set_opmode_function

Conversation

@mkatliar

@mkatliar mkatliar commented May 10, 2022

Copy link
Copy Markdown

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
Copy Markdown
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