# Drill head calibration
> Сurrent calibration procedure require qualified engineer
> and manual setting of the parameters and edition of drill onboard configuration files.
> Please be patient and careful!
>
> New user-friendly calibration software module is under development.
## Goal

The goal of this procedure is to find
1) The lower and upper dead-band values for drill head CW rotation
2) The lower dead-band value for drill head CCW rotation.
> :warning: **Finding the maximum CCW rotation speed and upper dead-band value is unsafe and can cause drill rod or drill bit unscrewing, can harm the machine and people.**
## Pre-requirements
Expected preconditions to perform cats_calibration:
- the vehicle is on a flat surface of stable terrain without known voids and cracks;
- the vehicle is leveled with jacks;
- software is run as usual;
- you and drill are free from any other tasks: no demonstrations, checks and so on;
- operator must control than no obstacles exist and prevent collisions by switch to manual control.
## Step 1: Connect to Drill Terminal
Connect to drill terminal via ssh:
```commandline
ssh vist@10.23.9.7
```
Enter password `12345678` if required.
## Reset calibration data
In command line type:
```commandline
rosparam set /CanNode/IOs/rot/min_value -1000
rosparam set /CanNode/IOs/rot/max_value 1000
rosparam set /CanNode/IOs/rot/deadband_value_pos 0
rosparam set /CanNode/IOs/rot/deadband_value_neg 0
```
## Start monitoring
In command line type:
```commandline
rostopic echo /remote_drill_actuator
```
## Calibrating
### CW calibrating in air
Switch to remote control and start very slowly increasing rotation until the drilling bit starts very slow rotation (check it by camera). Write down the minumal rotation_speed value in the console.
Repeate experiment 3-5 times and check the smallest value.
Then start increasing the rotatition speed untill reaches the maximum permited value (120..140 RPM), write down rotation_speed value
### CW calibrating in terrain
Start drilling the hole manually or autonomos and after the first pull-up.
Set the pull down pressure to normal drilling value for this type of terrain.
Repeat the proccess described in previous paragraph.
### CCW calibration in air
Do the same steps as in CW calibrating in air, excluding max RPM!
## Save the parameters
In terminal go to the path with config files:
```commandline
roscd drill_launch_pack/params/drill/
```
```commandline
nano nodes.yaml
```
In parameter file section set the following values at section rot:
```
min_value: -CW_in_terrain_max_value
max_value: CW_in_terrain_max_value
deadband_value_pos: CW_in_air_min_value
deadband_value_neg: CCW_in_air_min_value
```
## Restart and check
Save, restart, check. If rotation is still out of range - set the current default values and repeate the calibration
```
rot:
can_channel: '/can_5/rx'
value_field: 'rot'
protocol: 'x90RotSupCtrl'
min_value: -1000
max_value: 1000
deadband_value_pos: 0
deadband_value_neg: 0
deadband_threshold: 0.001
```