Custom controller using moveit GripperCommand not working

asked 2020-09-17 07:41:10 -0500

venkys gravatar image

updated 2020-09-17 23:27:09 -0500

I am using ROS Melodic on Ubuntu 18.04.

I tried creating a custom controller for the gripper as I was facing the issue of the gripper not stopping to close when grasping an object

I run my python script to open the gripper

gripper_group = moveit_commander.MoveGroupCommander("panda_hand")    
gripper_client = actionlib.SimpleActionClient('grioper_controller/gripper_action', GripperCommandAction)

gripper_client.wait_for_server()

but the code just keeps waiting for the server forever. It does not go further into my functions where I actually try to open the gripper using GripperCommandGoal. Please help me with this as I have no clue what is happening. Please let me know if I made an error in defining the controller yaml files itself.

Additional Details:

After running my code and checking

rostopic list | grep gripper_controllers

I get this

/grioper_controller/gripper_action/cancel
/grioper_controller/gripper_action/feedback
/grioper_controller/gripper_action/goal
/grioper_controller/gripper_action/result
/grioper_controller/gripper_action/status

My moveit_controller.yaml is as follows

joint_state_controller:
  type: joint_state_controller/JointStateController
  publish_rate: 50
controller_list:
  - name: panda_arm_controller
    action_ns: follow_joint_trajectory
    default: True
    type: FollowJointTrajectory
    joints:
      - panda_joint1
      - panda_joint2
      - panda_joint3
      - panda_joint4
      - panda_joint5
      - panda_joint6
      - panda_joint7

  - name: panda_hand_controller
    action_ns: follow_joint_trajectory
    type: FollowJointTrajectory
    default: True
    joints:
      - panda_finger_joint1
      - panda_finger_joint2

  - name: gripper_controller
    action_ns: gripper_action
    type: GripperCommand
    default: True
    joints:
      - panda_finger_joint1
      - panda_finger_joint2

My ros_controller.yaml is as follows

joint_state_controller:
    type: joint_state_controller/JointStateController
    publish_rate: 100

panda_arm_controller:
    type: position_controllers/JointTrajectoryController
    joints:
        - panda_joint1
        - panda_joint2
        - panda_joint3
        - panda_joint4
        - panda_joint5
        - panda_joint6
        - panda_joint7

    constraints:
        goal_time: 2.0

    state_publish_rate: 100

panda_hand_controller:
    type: position_controllers/JointTrajectoryController
    joints:
        - panda_finger_joint1
        - panda_finger_joint2
    state_publish_rate: 25

gripper_controller:
    type: effort_controllers/GripperActionController
    joint:
        - panda_finger_joint1
        - panda_finger_joint2
    state_publish_rate: 25

joint_position_controller:
    type: panda_simulation/JointPositionController
    arm_id: panda
    joint_names:
        - panda_joint1
        - panda_joint2
        - panda_joint3
        - panda_joint4
        - panda_joint5
        - panda_joint6
        - panda_joint7
    gains: [
        1, 1, 1, 1, 1, 1, 1,]
edit retag flag offensive close merge delete