---
title: "Detect what changed on a Yaskawa robot"
description: "Back up the jobs, TOOL.CND, UFRAME.CND and data files of every Yaskawa robot of a line each night, and see in a Git history which tool, frame or job changed."
---

# Detect what changed on a Yaskawa robot

A robot of the line does not behave like yesterday. Which job, tool or user frame changed, when, and what was the old value? This page shows a small program that backs up the text files of every Yaskawa Motoman controller of a line each night, and keeps them in Git: the history then answers these questions line by line.

## Which files to compare

| File | What a change means | Compare |
| --- | --- | --- |
| Jobs (`*.JBI`) | A point touched up, an instruction added | Yes, line by line |
| `TOOL.CND` | A TCP or a tool load changed | Yes, one line per value |
| `UFRAME.CND` | A user frame taught again | Yes |
| `VAR.DAT` | Variables changed by the jobs or by an operator | Yes, but it changes in production |
| `SC.PRM`, `ALL.PRM` | A parameter changed in management mode | Yes, may need the `rcmaster` account |
| `CIOPRG.LST` | The ladder changed | Yes |
| `ALMHIST.DAT` | New alarms | It changes after every alarm |
| `CMOS.BIN` | Anything | No: a binary image shows no difference you can read |

All these files are text, except `CMOS.BIN`. See [Yaskawa controller files](/yaskawa/documentation/yaskawa-controller-backup-files) for the content of each one.

## A nightly backup in Git

The program connects to each robot with FTP, downloads its jobs, condition files and data files into one folder per robot, then makes one Git commit for the whole line. Create the repository once with `git init`, then start the program each night from the task scheduler of Windows, or from cron.

**C# : BackupFleetGit**
```csharp
using System.Diagnostics;
using UnderAutomation.Yaskawa;
using UnderAutomation.Yaskawa.Common;

public class BackupFleetGit
{
    static void Main()
    {
        /**/
        string[] robots = { "192.168.0.1", "192.168.0.2", "192.168.0.3" };
        string root = @"C:\RobotBackups"; // a Git repository: run "git init" there once

        foreach (string ip in robots)
        {
            var parameters = new ConnectParameters(ip);
            parameters.Ftp.Enable = true;
            parameters.Ftp.FtpUser = "ftp";
            var robot = new YaskawaRobot();
            robot.Connect(parameters);

            // Start from an empty folder: a job deleted on the robot is then deleted in Git too
            string folder = Path.Combine(root, ip);
            if (Directory.Exists(folder)) Directory.Delete(folder, true);

            foreach (FileExtension type in new[] { FileExtension.JOB, FileExtension.CND, FileExtension.DAT })
                robot.Ftp.DownloadFilesToLocal(robot.Ftp.GetFileList(type), Path.Combine(folder, type.ToString()));

            robot.Disconnect();
        }

        // One commit per run: "git log -p" then shows what changed, robot by robot and line by line
        Process.Start(new ProcessStartInfo("git", "add -A") { WorkingDirectory = root }).WaitForExit();
        Process.Start(new ProcessStartInfo("git", $"commit -m \"Backup {DateTime.Now:yyyy-MM-dd}\"") { WorkingDirectory = root }).WaitForExit();
        /**/
    }
}
```

**Python : BackupFleetGit**
```python
import os
import shutil
import subprocess
from datetime import date
from underautomation.yaskawa.yaskawa_robot import YaskawaRobot
from underautomation.yaskawa.connect_parameters import ConnectParameters
from underautomation.yaskawa.common.file_extension import FileExtension

##
robots = ["192.168.0.1", "192.168.0.2", "192.168.0.3"]
root = r"C:\RobotBackups"  # a Git repository: run "git init" there once

for ip in robots:
    parameters = ConnectParameters(ip)
    parameters.ftp.enable = True
    parameters.ftp.ftp_user = "ftp"
    robot = YaskawaRobot()
    robot.connect(parameters)

    # Start from an empty folder: a job deleted on the robot is then deleted in Git too
    folder = os.path.join(root, ip)
    shutil.rmtree(folder, ignore_errors=True)

    for file_type in [FileExtension.JOB, FileExtension.CND, FileExtension.DAT]:
        names = robot.ftp.get_file_list(file_type)
        robot.ftp.download_files_to_local(names, os.path.join(folder, file_type.name))

    robot.disconnect()

# One commit per run: "git log -p" then shows what changed, robot by robot and line by line
subprocess.run(["git", "add", "-A"], cwd=root)
subprocess.run(["git", "commit", "-m", f"Backup {date.today()}"], cwd=root)
##
```

Add `FileExtension.PRM` and `FileExtension.LST` to the list for the parameters and the ladder, with an account that can read them (see [FTP](/yaskawa/documentation/ftp)). `DownloadFilesToLocal` downloads several files in one call: it is the fastest way for a full backup.

## Read the result

`git log -p`, or the history of any Git client, gives the changes of each night. A changed TCP is one line of `TOOL.CND`:

```plaintext
 //TOOL 3
 ///NAME WELD
-0.000,0.000,210.500,0.0000,0.0000,0.0000
+0.000,0.000,212.000,0.0000,0.0000,0.0000
```

Here the Z of tool 3 went from 210.5 mm to 212.0 mm. In the same way, a touched up point is a changed line of the job, and a user frame taught again is a changed `BUSER` line of `UFRAME.CND`.

## Go further

- **Alert.** Run `git diff --stat HEAD~1` after the commit and send the list of changed files by e-mail, or open a ticket in your maintenance system.
- **Restore.** An old version of a job is in the history: send it back with `LoadFile`, see [Transfer files and backups](/yaskawa/documentation/how-to-transfer-files).
- **Twin cells.** Compare the folders of two robots with the same tooling: a different TCP between them is visible at once.

Yaskawa has its own tools for scheduled backups. The SDK is the option when the result must go into your own system: Git, a MES, a ticket or an e-mail.

## Without code

TouchUp, the robot workbench for VS Code, backs up a controller in one click, compares two backups or a robot with its last backup, and hides the noise of each brand so that only the real changes are shown. See [Compare](/touchup/documentation/compare) and [Back up a controller](/touchup/documentation/backup).

## See also

- [Yaskawa controller files: what a backup contains](/yaskawa/documentation/yaskawa-controller-backup-files)
- [TOOL.CND: read the tool data](/yaskawa/documentation/yaskawa-tool-cnd-file)
- [UFRAME.CND: read the user frames](/yaskawa/documentation/yaskawa-uframe-cnd-user-frame-file)
- [FTP file transfers](/yaskawa/documentation/ftp-transfer)