Skip to content
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

Gripper #26

Open
anhtuduong opened this issue Jun 11, 2023 · 2 comments
Open

Gripper #26

anhtuduong opened this issue Jun 11, 2023 · 2 comments
Assignees

Comments

@anhtuduong
Copy link
Owner

anhtuduong commented Jun 11, 2023

3 fingers gripper is currently controlled by a ROS service:

ros.Service('move_gripper', generic_float, self.move_gripper_callback)

But it seems to move parallelly with robot joint, which is a bug.

@anhtuduong anhtuduong self-assigned this Jun 11, 2023
@anhtuduong
Copy link
Owner Author

Current gripper function:

def move_gripper(self, diameter):
        rate = ros.Rate(1/self.dt)
        self.controller_manager.gm.move_gripper(diameter)
        target = self.controller_manager.gm.q_des_gripper

        # Loop until the gripper is closed
        while True:
            self.controller_manager.sendReference(self.q_des)
            current = self.controller_manager.gm.getDesGripperJoints()
            if (abs(current - target) < 0.01):
                break
            rate.sleep()

Which trying to loop sending the current joint states with moving 3 finger of the gripper. This causes an error when calling the gripper service in Motion node.

@anhtuduong
Copy link
Owner Author

Gripper fixed:

def move_gripper(self, diameter):
        """
        """
        rate = ros.Rate(1/self.dt)
        self.controller_manager.gm.move_gripper(diameter)
        target = self.controller_manager.gm.q_des_gripper
        count = 0

        while True:
            current = self.controller_manager.gm.getDesGripperJoints()
            self.controller_manager.sendReference(self.q_des)
            count += 1
            rate.sleep()
            if np.any(np.abs(target - current) < 0.001):
                break
        
        current = self.controller_manager.gm.getDesGripperJoints()
        log.info(f'Gripper moved: {count} steps')
        log.debug(f'Gripper target\t{target}')
        log.debug(f'Gripper current\t{current}')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

No branches or pull requests

1 participant