> For the complete documentation index, see [llms.txt](https://docs-origin.anvil.bot/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs-origin.anvil.bot/reference/technical-reference/controlling-the-customizable-gripper.md).

# Controlling the Customizable Gripper

The technical details you need to know when using Anvil's gripper

## Hardware

The gripper is open-source, and all the 3D files are here:

{% embed url="<https://github.com/anvil-robotics/anvil-gripper-hw>" %}

The gripper uses a Damiao `DM-J4310-2EC` motor, controlled via CAN using 1 Mbps bitrate, with Send ID `0x08` and Recv ID `0x18`.

## Software

### Using Anvil Devbox

With Anvil's Devbox and software, gripper control is as easy as publishing to the right ROS2 topic, see [Commanding Robot Movement](https://docs-origin.anvil.bot/reference/technical-reference/commanding-robot-movement.md) for more details.

#### Advanced Tuning

The software ships with sensible defaults that balance gentle manipulation with precise control. If you want to further tune your gripper's behavior specifically for your task, you can edit these terms in your config:

* `gripper_feedforward_torque` - measured in newton metres, this is the (maximum) torque the motor will use to close the gripper. If the gripper isn't closing all the way (eg. older, more worn out grippers) or isn't responsive enough for your task, you can increase this value. Doubling or tripling this value from its default is safe, but going above 3 Nm can lead to unintended consequences
* `gripper_error_threshold` - measures in metres, this is the threshold of position error within which the motor will ramp down torque application. Reducing this value can also produce snappier gripper controls, but we suggest increasing  `gripper_feedforward_torque` first.\
  If the gripper fingers are oscillating when commanded to intermediate states (neither fully open nor fully closed), try increasing this threshold (increase in intervals of 0.001). If you increase `gripper_feedforward_torque`, you should increase this value proportionally

### Using custom controls

If you're controlling the gripper yourself, you are likely interested in commanding the motor's angular position. The motor is at at 0° (0 rad) fully closed (0mm), and −163.8° (−2.858 rad) fully open (110mm).

{% hint style="info" %}
If you do traditional impedance control (eg. using MIT control mode on the motor) to open and close the gripper, be wary of the torques being commanded when holding a relatively large object with the gripper.\
\
This implies relatively large position error, and with a large enough value for stiffness gain this can lead to unintended consequences, like the gripper overheating over time. Anvil carefully tunes its controls to manage this kind of behavior, and strongly recommends using Anvil's Devbox and software stack to control the grippers.
{% endhint %}
