Open
Conversation
Updated environment variable name for gripper mode from 'GRIPPER_MODE' to 'gripperMode' and added the function call
tomqext
reviewed
Apr 2, 2026
| SCISSOR = 3 | ||
|
|
||
| class Robotiq3FGripperControlNode: | ||
| def __init__(self, mode): |
There was a problem hiding this comment.
I like the use of the enum structure here, but on closer inspection the whole Robotiq3FGripperControlNode class might get a fair bit simpler if you swapped it for a class-level dictionary
class Robotiq3FGripperControlNode:
ROBOTIQ_3F_GRIPPER_MODES = {'BASIC': 0, 'PINCH': 1, 'WIDE': 2, 'SCISSOR': 3}
def __init__(self, mode):
your current_mode_provider method then becomes:
def current_mode_provider(self, request):
response = GetStringResponse()
response.data = self.ROBOTIQ_3F_GRIPPER_MODES[self.current_mode]
return response
Your mode_select method would become:
def mode_select(self, mode):
gripper_control_msg = Robotiq3FGripperRobotOutput()
gripper_control_msg.rACT = 1
gripper_control_msg.rMOD = self.ROBOTIQ_3F_GRIPPER_MODES[self.current_mode]
self.pub_robotiq_control.publish(gripper_control_msg)
etc...
There was a problem hiding this comment.
maybe use a better variable name than what I suggested though
ROBOTIQ_3F_GRIPPER_MODES_ENUM_DICT or something
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This has not been tested yet. To be tested at customer premises.