Kinovarobotics / ros_kortex

ROS packages for KINOVA® KORTEX™ robotic arms
Other
153 stars 155 forks source link

Adding a Custom End-Effector to the Robot #305

Open tuqah opened 12 months ago

tuqah commented 12 months ago

Hello! I am working on a project that involves using a Kinova Gen3 robot with a custom end-effector. I would like to add the end-effector into the robot's description such that when I launch the kortex driver, I can specify my own end-effector (much like how I can specify the Robotiq's grippers -- for example, I currently launch the kortex driver with roslaunch kortex_driver kortex_driver.launch gripper:=robotiq_2f_85)

I initially wanted to create a modified URDF file of the gen3 robot with the custom end-effector included, but I have noticed in kortex_driver.launch and the .xacro files that the gripper is added separately (the default launch file for a gen3 robot does not include a gripper, unless specified). If I am not mistaken, this means that I need to create a folder for the custom end effector in the kortex_description/grippers directory, and a gen3_custom_endeffector.xacro file for the kortex driver launch file to run appropriately.

The custom end-effector does not have any degrees of freedom (it’s a fixed end-effector), and I have already generated its URDF file. I wanted to inquire about the steps required to add it to the ros_kortex package. Is what I suggested correct? Otherwise, what should I do to launch the kortex driver with the custom end-effector?

Any assistance will be greatly appreciated!

felixmaisonneuve commented 12 months ago

Hi @tuqah,

What you suggested is correct. kortex_driver.launch selects xacro file according to this : https://github.com/Kinovarobotics/ros_kortex/blob/085b694280a77eb7be14ff2af86958ba18b633cf/kortex_driver/launch/kortex_driver.launch#L38-L55

If you specify a gripper option, it means it looks for this : $(find kortex_description)/robots/$(arg arm)_$(arg gripper).xacro. So you need to create a file like this : kortex_description/robots/gen3_custom_endeffector.xacro (which is what you said)

It will then go all the way to kortex_robot.xacro, where it loads your gripper https://github.com/Kinovarobotics/ros_kortex/blob/085b694280a77eb7be14ff2af86958ba18b633cf/kortex_description/robots/kortex_robot.xacro#L40-L43

This must be defined in your custom xacro file, similar to this : https://github.com/Kinovarobotics/ros_kortex/blob/noetic-devel/kortex_description/grippers/robotiq_2f_85/urdf/robotiq_2f_85_macro.xacro#L3

you see that, in that file, it includes the xacro file based on the urdf of the actual gripper, but it could be in the same file like this : https://github.com/Kinovarobotics/ros_kortex/blob/noetic-devel/kortex_description/grippers/gen3_lite_2f/urdf/gen3_lite_2f_macro.xacro#L4

After that, you will need to edit the driver as well. The gripper param is used by the node : https://github.com/Kinovarobotics/ros_kortex/blob/085b694280a77eb7be14ff2af86958ba18b633cf/kortex_driver/launch/kortex_driver.launch#L60-L80

You might have issue with joint limits : https://github.com/Kinovarobotics/ros_kortex/blob/noetic-devel/kortex_driver/src/non-generated/driver/kortex_arm_driver.cpp#L249-L274

You will have issues with EndEffectorType https://github.com/Kinovarobotics/ros_kortex/blob/085b694280a77eb7be14ff2af86958ba18b633cf/kortex_driver/src/non-generated/driver/kortex_arm_driver.cpp#L368-L409

Be carefull for GripperActionServer as well https://github.com/Kinovarobotics/ros_kortex/blob/085b694280a77eb7be14ff2af86958ba18b633cf/kortex_driver/src/non-generated/driver/kortex_arm_driver.cpp#L515-L528

Basically, go throught every occurence of isGripperPresent() in kortex_arm_driver.cpp and make sure it won't break with your new gripper. Then you compile everything with catkin_make.

Also, you won't be able to use MoveIt unless you create your own config. If you decide to do so, you can try to use the setup_assistant https://github.com/Kinovarobotics/ros_kortex/blob/085b694280a77eb7be14ff2af86958ba18b633cf/kortex_driver/launch/kortex_driver.launch#L83-L97

I think that should get you a long way. If ever you have other issues, I will be there to help

Best, Felix