Skip to content

[RSDK-10923] Add IsHoldingSomething to Gripper API #454

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

Open
wants to merge 2 commits into
base: workflow/update-protos
Choose a base branch
from

Conversation

gvaradarajan
Copy link
Member

No description provided.

@gvaradarajan gvaradarajan requested review from acmorrow and stuqdog June 18, 2025 14:34
@gvaradarajan gvaradarajan requested a review from a team as a code owner June 18, 2025 14:34
@gvaradarajan gvaradarajan requested review from lia-viam and removed request for a team June 18, 2025 14:34
@gvaradarajan gvaradarajan force-pushed the RSDK-10923-is-holding-something branch from f726daf to aba2ec8 Compare June 18, 2025 14:37
Copy link
Member

@stuqdog stuqdog left a comment

Choose a reason for hiding this comment

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

Request to add a test and also fix compilation failures, otherwise lgtm!

Comment on lines 31 to 37
Gripper::holding_status MockGripper::is_holding_something(const ProtoStruct&) {
Gripper::holding_status res;
res.is_holding_something = false;
res.meta = {};
return res;
}

Copy link
Member

Choose a reason for hiding this comment

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

can we set res.meta to the protoStruct that's passed into the function, and then write a test of this method in test_gripper?

@@ -5,6 +5,7 @@

#include <string>

#include <viam/sdk/common/proto_convert.hpp>
Copy link
Member

Choose a reason for hiding this comment

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

You can probably just include proto_value.hpp here.

/// @brief whether the gripper is holding something (along with other contextual info)
struct holding_status {
bool is_holding_something;
ProtoStruct meta;
Copy link
Member

Choose a reason for hiding this comment

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

Do you want to be able to distinguish the case of "no meta was returned" from "meta was returned but it is empty"? If so, consider boost::optional<ProtoStruct> meta.

Comment on lines 39 to 41
else {
holding_status.meta = {};
}
Copy link
Member

Choose a reason for hiding this comment

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

Do you actually need this else?

holding_status.is_holding_something = response.is_holding_something();
if response
.has_meta() {
holding_status.meta = from_proto(response.meta());
Copy link
Member

Choose a reason for hiding this comment

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

This file can include the proto_convert.hpp header.

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.

3 participants