37 Module baseRobotiq3FGripper: defines a base class for handling command and status of the Robotiq 3F gripper gripper. 39 After being instanciated, a 'client' member must be added to the object. This client depends on the communication protocol used by the Gripper. As an example, the ROS node 'Robotiq3FGripperTcpNode.py' instanciate a robotiqbaseRobotiq3FGripper and adds a client defined in the module comModbusTcp. 42 from robotiq_3f_gripper_articulated_msgs.msg
import Robotiq3FGripperRobotInput
46 """Base class (communication protocol agnostic) for sending commands and receiving the status of the Robotic 3F gripper gripper.""" 55 """Function to verify that the value of each variable satisfy its limits.""" 58 command.rACT = max(0, command.rACT)
59 command.rACT = min(1, command.rACT)
61 command.rMOD = max(0, command.rMOD)
62 command.rMOD = min(3, command.rMOD)
64 command.rGTO = max(0, command.rGTO)
65 command.rGTO = min(1, command.rGTO)
67 command.rATR = max(0, command.rATR)
68 command.rATR = min(1, command.rATR)
70 command.rGLV = max(0, command.rGLV)
71 command.rGLV = min(1, command.rGLV)
73 command.rICF = max(0, command.rICF)
74 command.rICF = min(1, command.rICF)
76 command.rICS = max(0, command.rICS)
77 command.rICS = min(1, command.rICS)
79 command.rPRA = max(0, command.rPRA)
80 command.rPRA = min(255, command.rPRA)
82 command.rSPA = max(0, command.rSPA)
83 command.rSPA = min(255, command.rSPA)
85 command.rFRA = max(0, command.rFRA)
86 command.rFRA = min(255, command.rFRA)
88 command.rPRB = max(0, command.rPRB)
89 command.rPRB = min(255, command.rPRB)
91 command.rSPB = max(0, command.rSPB)
92 command.rSPB = min(255, command.rSPB)
94 command.rFRB = max(0, command.rFRB)
95 command.rFRB = min(255, command.rFRB)
97 command.rPRC = max(0, command.rPRC)
98 command.rPRC = min(255, command.rPRC)
100 command.rSPC = max(0, command.rSPC)
101 command.rSPC = min(255, command.rSPC)
103 command.rFRC = max(0, command.rFRC)
104 command.rFRC = min(255, command.rFRC)
106 command.rPRS = max(0, command.rPRS)
107 command.rPRS = min(255, command.rPRS)
109 command.rSPS = max(0, command.rSPS)
110 command.rSPS = min(255, command.rSPS)
112 command.rFRS = max(0, command.rFRS)
113 command.rFRS = min(255, command.rFRS)
119 """Function to update the command which will be sent during the next sendCommand() call.""" 128 self.message.append(command.rACT + (command.rMOD << 1) + (command.rGTO << 3) + (command.rATR << 4))
129 self.message.append(command.rGLV + (command.rICF << 2) + (command.rICS << 3))
130 self.message.append(0)
131 self.message.append(command.rPRA)
132 self.message.append(command.rSPA)
133 self.message.append(command.rFRA)
134 self.message.append(command.rPRB)
135 self.message.append(command.rSPB)
136 self.message.append(command.rFRB)
137 self.message.append(command.rPRC)
138 self.message.append(command.rSPC)
139 self.message.append(command.rFRC)
140 self.message.append(command.rPRS)
141 self.message.append(command.rSPS)
142 self.message.append(command.rFRS)
145 """Send the command to the Gripper.""" 147 self.client.sendCommand(self.
message)
150 """Request the status from the gripper and return it in the Robotiq3FGripper_robot_input msg type.""" 153 status = self.client.getStatus(16);
156 message = Robotiq3FGripperRobotInput()
159 message.gACT = (status[0] >> 0) & 0x01;
160 message.gMOD = (status[0] >> 1) & 0x03;
161 message.gGTO = (status[0] >> 3) & 0x01;
162 message.gIMC = (status[0] >> 4) & 0x03;
163 message.gSTA = (status[0] >> 6) & 0x03;
164 message.gDTA = (status[1] >> 0) & 0x03;
165 message.gDTB = (status[1] >> 2) & 0x03;
166 message.gDTC = (status[1] >> 4) & 0x03;
167 message.gDTS = (status[1] >> 6) & 0x03;
168 message.gFLT = status[2]
169 message.gPRA = status[3]
170 message.gPOA = status[4]
171 message.gCUA = status[5]
172 message.gPRB = status[6]
173 message.gPOB = status[7]
174 message.gCUB = status[8]
175 message.gPRC = status[9]
176 message.gPOC = status[10]
177 message.gCUC = status[11]
178 message.gPRS = status[12]
179 message.gPOS = status[13]
180 message.gCUS = status[14]
def refreshCommand(self, command)
def verifyCommand(self, command)