---
# System prepended metadata

title: Cats calibration

---


# Cats calibration

> Current 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

![](https://habrastorage.org/webt/jl/ab/-c/jlab-cwy2tkluozerzp7p8rhli8.png)

The goal of this procedure is to find:
1) The dead-band values for left and right cats control. To define dead-bands we need to find minimum controls, when drill just start moving forward and backward. 
Thus, dead-band is a range `[deadband_value_neg, deadband_value_pos]` where control makes no sense.
2) The range of control possible `[min_value, max_value]`: maximum forward and backward control values for left and right cats. 
We need to find such a control value, that increasing it has no effect.

## Pre-requirements 

Expected preconditions to perform cats_calibration:
- the vehicle is on a flat surface with enough free space to move around;
- 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: Open 3 Terminals Connected to the Drill

### 1.1 Current Remote Controls View Terminal 

Open a new terminal.

Connect to drill terminal via ssh:
```commandline
ssh vist@10.23.9.7
```
Enter password `12345678` if required. 

Run the following command to view current remote controls:
```commandline
rostopic echo /remote_cats_control
```

This will continuously print current values. Use this terminal to view current remote controls with good precision.
Note: controls are in range [-1; 1], that means 1 is 100% control forward, -1 is 100% control backward.

### 1.2 Current Real Cats Speeds View Terminal 

Open a new terminal.

Connect to drill terminal via ssh:
```commandline
ssh vist@10.23.9.7
```
Enter password `12345678` if required. 

Run the following command to view current remote controls:
```commandline
rostopic echo /st/cat_fb
```

This will continuously print current values. Use this terminal to view current real cats speeds.
Note: left and right cats speeds (shown separately) are in m/s.

### 1.3 Commands Terminal 

Open a new terminal.

Connect to drill terminal via ssh:
```commandline
ssh vist@10.23.9.7
```

**Attention:** Use this terminal to run all the following commands.


## Step 2: Set Defaults for Cats Control Ranges
Run the following command in a previously opened `Commands Terminal` (you could copy the entire commands and paste in terminal):

### 2.1 Set Parameters

```commandline

rosparam set /CanNode/IOs/cat_left/deadband_value_pos 0
rosparam set /CanNode/IOs/cat_right/deadband_value_pos 0
rosparam set /CanNode/IOs/cat_left/deadband_value_neg 0
rosparam set /CanNode/IOs/cat_right/deadband_value_neg 0

rosparam set /CanNode/IOs/cat_left/max_value 1000
rosparam set /CanNode/IOs/cat_right/max_value 1000
rosparam set /CanNode/IOs/cat_left/min_value -1000
rosparam set /CanNode/IOs/cat_right/min_value -1000

```

### 2.2 Apply Parameters 

To apply parameters you need to restart CAN software module by running:

```commandline
rosnode kill /CanNode
```

You will see messages `killing /CanNode', 'killed` in terminal and error messages in RMO debug output starting from
```commandline
[INFO] [1660986712.670438]: CanNode: Shutting down
```
The RMO will report failure, don't worry, it's ok.  
Just clear errors by `Borrar error` button.

Now default parameters are set and applied.

## Step 3: Find Dead-bands

What we need to do next is to find dead-bands: minimum controls, when drill just start moving.

> Note:
> In Real Cats Speeds View Terminal you see current real cats_speeds in m/s. <br>
> Minimum cat speed is usually less 0.04 (4 cm per second). <br> 
> Try to move at a speed no faster than this.

### 3.1 Switch to Remote Driving Control
- Switch RMO to remote driving control, give move permission;
- During control, it could be convenient to switch the Nonlinear mode on/off for joysticks in RMO touch window;

### 3.2 Find Forward Dead-band Value for Left (Cabin-side) Cat

- Move the _left_ cat joystick slowly _forward_ until drill just starts moving; Check feedback (current real cats_speeds) in `Real Cats Speeds View Terminal`.
- Write down the control of the _left_ joystick (get it from `Current Remote Controls View Terminal`, field `cat_left`, 3 digits after `0.`) that starts the drill moving with the name `cat_left/deadband_value_pos`.
- You could repeat to be sure, that control value you found is minimum.

### 3.3 Find Forward Dead-band Value for Right (Non-cabin-side) Cat

- Move the _right_ cat joystick slowly _forward_ until drill just starts moving; Check feedback (current real cats_speeds) in `Real Cats Speeds View Terminal`
- Write down the control of the _right_ joystick (get it from `Current Remote Controls View Terminal`, field `cat_right`, 3 digits after `0.`) that starts the drill moving with the name `cat_right/deadband_value_pos`.
- You could repeat to be sure, that control value you found is minimum.

### 3.4 Find Backward Dead-band Value for Left (Cabin-side) Cat

- Move the _left_ cat joystick slowly _backward_ until drill just starts moving;
- Write down the control of the _left_ joystick (get it from `Current Remote Controls View Terminal`, field `cat_left`, 3 digits after `0.`) that starts the drill moving with the name `cat_left/deadband_value_neg`.
- You could repeat to be sure, that control value you found is minimum.

### 3.5 Find Backward Dead-band Value for Right (Non-cabin-side) Cat

- Move the _right_ cat joystick slowly _backward_ until drill just starts moving;
- Write down the control of the _right_ joystick (get it from `Current Remote Controls View Terminal`, field `cat_right`, 3 digits after `0.`) that starts the drill moving with the name `cat_right/deadband_value_neg`.
- You could repeat to be sure, that control value you found is minimum.

## Step 4: Find Maximum Control Range

> Note:
> In Real Cats Speeds View Terminal you see current real cats_speeds in m/s. <br>
> Maximum cat speed is usually about 0.4 — 0.5 (meters per second). <br>

Next part is about maximum ranges of control.
We need to find such a control value, that increasing it has no effect.
Be careful, drill should move fast.

### 4.1 Find Maximum Forward Control for Left (Cabin-side) Cat

- Move _left_ cat joystick slowly forward until you feel control increasing has no effect. 
- Write down the control of the _left_ joystick (get it from `Current Remote Controls View Terminal`, field `cat_left`, 3 digits after `0.`), when increasing has no effect, with the name `cat_left/max_value`.

> You should also control the _right_ cat forward for straight motion, but at this step, you should find the _left_ control maximum.

> **Attention!** If one track has maximum velocity bigger then another, move with the lowest maximum velocity to avoid turning. 
> `max_value` should be set taking into account this condition (it could be less than actual maximum for one track to keep it balanced). 

### 4.2 Find Maximum Forward Control for Right (Non-cabin-side) Cat

- Move _right_ cat joystick slowly forward until you feel control increasing has no effect. 
- Write down the control of the _right_ joystick (get it from `Current Remote Controls View Terminal`, field `cat_right`, 3 digits after `0.`), when increasing has no effect, with the name `cat_right/max_value`.

> You should also control the _left_ cat forward for straight motion, but at this step, you should find the _right_ control maximum.

> **Attention!** If one track has maximum velocity bigger then another, move with the lowest maximum velocity to avoid turning. 
> `max_value` should be set taking into account this condition (it could be less than actual maximum for one track to keep it balanced). 

### 4.3 Find Maximum Backward Control for Left (Cabin-side) Cat

- Move _left_ cat joystick slowly backward until you feel control increasing has no effect. 
- Write down the control of the _left_ joystick (get it from `Current Remote Controls View Terminal`, field `cat_left`, 3 digits after `0.`), when increasing has no effect, with the name `cat_left/min_value`.

> You should also control the _right_ cat backward for straight motion, but at this step, you should find the _left_ control maximum.

> **Attention!** If one track has maximum velocity bigger then another, move with the lowest maximum velocity to avoid turning. 
> `max_value` should be set taking into account this condition (it could be less than actual maximum for one track to keep it balanced). 

### 4.4 Find Maximum Backward Control for Right (Non-cabin-side) Cat

- Move _right_ cat joystick slowly backward until you feel control increasing has no effect. 
- Write down the control of the _right_ joystick (get it from `Current Remote Controls View Terminal`, field `cat_right`, 3 digits after `0.`), when increasing has no effect, with the name `cat_right/min_value`.

> You should also control the _left_ cat backward for straight motion, but at this step, you should find the _right_ control maximum.

> **Attention!** If one track has maximum velocity bigger then another, move with the lowest maximum velocity to avoid turning. 
> `max_value` should be set taking into account this condition (it could be less than actual maximum for one track to keep it balanced). 

### Result
Now you should have 8 values of the following parameters:

| cat          | param                    | value |
|--------------|--------------------------|-------|
| cat_left     | deadband_value_pos       |       |
| cat_right    | deadband_value_pos       |       |
| cat_left     | deadband_value_neg       |       |
| cat_right    | deadband_value_neg       |       |
| cat_left     | max_value                |       |
| cat_right    | max_value                |       |
| cat_left     | min_value                |       |
| cat_right    | min_value                |       |


> The control range is `[-1000, 1000]`, so multiply the controls viewed in `Current Remote Controls View Terminal` by 1000.
> 
> Usual values for min/max params are in the range ±600-900, dead-band values ±250-550.

Switch move permission at RMO to Off.


## 5 Apply and Test New Parameters

### 5.1 Set New Parameters

As during step 2, set parameters, filling with values you got:

```commandline

rosparam set /CanNode/IOs/cat_left/deadband_value_pos value_you_found * 1000
rosparam set /CanNode/IOs/cat_right/deadband_value_pos value_you_found * 1000
rosparam set /CanNode/IOs/cat_left/deadband_value_neg value_you_found * 1000
rosparam set /CanNode/IOs/cat_right/deadband_value_neg value_you_found * 1000

rosparam set /CanNode/IOs/cat_left/max_value value_you_found * 1000
rosparam set /CanNode/IOs/cat_right/max_value value_you_found * 1000
rosparam set /CanNode/IOs/cat_left/min_value value_you_found * 1000
rosparam set /CanNode/IOs/cat_right/min_value value_you_found * 1000

```

**Attention** don't forget to multiply your values by 1000, because the range here is `[-1000; 1000]` and control range was `[-1; 1]`.

### 5.2 Apply Parameters 

To apply parameters you need to restart the CAN software module by running:

```commandline
rosnode kill /CanNode
```

Clear errors by `Borrar error` button in RMO.

### 5.3 Test

- Switch RMO to remote driving control, give move permission;
- Drive via remote control as usual. Evaluate the smoothness of the caterpillar control.
- If satisfied, go to the next step, if not, repeat steps 2 — 4.

## Step 6: Permanently Save Parameters

### 6.1 Go to Configs Dir
In terminal go to the path with config files:
```commandline
roscd drill_launch_pack/params/drill/
```

### 6.2 Open Config File with Editor

```commandline
nano nodes.yaml
```


### 6.3 Find cats configs 
Press 'ctrl + w', type 'cat_left'

You'll see:
```text
    cat_left:
      can_channel: '/can_5/rx'
      value_field: 'cat_left'
      protocol: 'x90CatCtrl'
      min_value: ...
```

Edit all 8 values: min/max, dead-band neg/pos for left/right caterpillar tracks.

### 6.4 Save File
Press `ctrl + x`. You'll get a save dialog
```commandline
Save modified buffer?
 Y Yes
 N No           ^C Cancel
```
Press `Y` to save.

### 6.5 Test

Perform soft drill reset.
Test remote moving control.


