Skip to content

controlBoard_nws_yarp: expose IControlMode getters on the RPC interface - #3406

Open
RoboX2020 wants to merge 3 commits into
robotology:masterfrom
RoboX2020:fix/3405-control-mode-rpc-getters
Open

RoboX2020 wants to merge 3 commits into
robotology:masterfrom
RoboX2020:fix/3405-control-mode-rpc-getters

Conversation

@RoboX2020

Copy link
Copy Markdown

Fixes #3405.

After the switch to IDL-based RPC, the ControlBoard NWS only exposed the IControlMode setters over RPC, so yarp rpc could set modes but not read them back.

This mirrors the existing IInteractionMode getters: it adds getControlModeOneRPC, getControlModeAllRPC and getControlModeGroupRPC to ControlBoardMsgs.thrift, implements them in ControlBoardRPCd on top of IControlMode::getControlMode(s), and regenerates the committed IDL code. Returned modes use yarp::dev::ControlModeEnum so non-selectable states (hardware fault, calibrating, unknown) are reported faithfully.

Adds a regression test that talks to the NWS RPC port like yarp rpc does: it sets a mode through the existing setter, then reads it back through the new getters (per-axis, all and group).

After the switch to IDL-based RPC, the ControlBoard NWS only exposed the
IControlMode setters over RPC. Add getControlModeOneRPC, getControlModeAllRPC
and getControlModeGroupRPC to ControlBoardMsgs.thrift, mirroring the existing
IInteractionMode getters, and implement them in ControlBoardRPCd on top of
IControlMode::getControlMode(s). Returned modes use yarp::dev::ControlModeEnum,
so non-selectable states (e.g. hardware fault, calibrating) are reported
faithfully.

Regenerate the committed IDL code and add a regression test that talks to the
NWS RPC port like `yarp rpc` does: set a mode through the existing setter,
then read it back through the new getters (per-axis, all and group).

Fixes robotology#3405
@update-docs

update-docs Bot commented Oct 23, 2026

Copy link
Copy Markdown

Thanks for opening this pull request! The maintainers of this repository would appreciate it if you would update the release notes by adding a file in doc/release/<target_branch>, based on your changes.

@RoboX2020
RoboX2020 deployed to code-analysis October 23, 2026 17:28 — with GitHub Actions Active
@RoboX2020
RoboX2020 deployed to code-analysis October 23, 2026 17:28 — with GitHub Actions Active
@RoboX2020
RoboX2020 deployed to code-analysis October 23, 2026 17:28 — with GitHub Actions Active
@RoboX2020
RoboX2020 deployed to code-analysis October 23, 2026 21:03 — with GitHub Actions Active
@RoboX2020
RoboX2020 deployed to code-analysis October 23, 2026 21:03 — with GitHub Actions Active
@RoboX2020
RoboX2020 deployed to code-analysis October 23, 2026 21:03 — with GitHub Actions Active
@codacy-production

codacy-production Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 719 complexity · 132 duplication

Metric Results
Complexity 719
Duplication 132

View in Codacy

🟢 Coverage ∅ diff coverage

Metric Results
Coverage variation Report missing for 763a4fb1
Diff coverage ✅ ∅ diff coverage

View coverage diff in Codacy

Coverage variation details
Coverable lines Covered lines Coverage
Common ancestor commit (763a4fb) Report Missing Report Missing Report Missing
Head commit (86954cb) 361803 42104 11.64%

Coverage variation is the difference between the coverage for the head and common ancestor commits of the pull request branch: <coverage of head commit> - <coverage of common ancestor commit>

Diff coverage details
Coverable lines Covered lines Diff coverage
Pull request (#3406) 0 0 ∅ (not applicable)

Diff coverage is the percentage of lines that are covered by tests out of the coverable lines that the pull request added or modified: <covered lines added or modified>/<coverable lines added or modified> * 100%

1 Codacy didn't receive coverage data for the commit, or there was an error processing the received data. Check your integration for errors and validate that your coverage setup is correct.

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@randaz81 randaz81 left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The use of yarp::os::Bottle should be always avoided in examples, clients and tests if a safe alternative is available.
In file controlBoard_nws_yarp_test.cpp please remove them and use something similar to:

        ControlBoardMsgs rpc_client;
        REQUIRE(rpc_client.yarp().attachAsClient(rpc));

        {
            return_getControlModeOne reply = rpc_client.getControlModeOneRPC(0);
            CHECK(reply.ret == ReturnValue_ok);
            CHECK(static_cast<std::int32_t>(reply.mode) == pos_direct);
        }

...

As requested in review: avoid yarp::os::Bottle in tests when a safe
alternative is available. The RPC section now talks to the device
through the generated ControlBoardMsgs client, and the test links the
ControlBoardMsgs messages library.
@RoboX2020

Copy link
Copy Markdown
Author

Thanks for the review, Marco. The RPC section of the test now talks to the device through the generated ControlBoardMsgs client (attachAsClient on the port) with typed calls for the setter and all three getters, and the test target links ControlBoardMsgs. yarp::os::Bottle is gone from the file. Verified locally: the full dev::controlBoard_nws_yarp test passes.

This branch had an error being deployed

1 failed deployment
code-analysis — 86954cb4 Deployed Oct 27, 2026 by RoboX2020 via SonarCloud - Build & Prepare #5162
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ControlBoard NWS is missing IControlMode getters in its RPC interface

2 participants