Pref files and sub pref files

Overview | API | Tutorial

Introduction

Warning

This chapter is about configuration files. Changing one configuration value may damage your robot. Do not change anything unless it’s necessary.

The DCM has 2 preference (or configuration) files: Device.xml with the robot electronic description, and DCM.xml that holds parameters specific to the DCM.

These two files are the same for all robots, with all default parameters. They are in the naoqi/preferences folder.

But there are needs of specific parameters (mainly for calibration purposes) linked to some parts of the robot. These parameters are stored in the removable part of the robot, so that even if the part change, the new one will have its own good parameters.

Currently the robot can be divided in two parts: head and body.

So there are two files called “subPref” and names Device_Head.xml , and Device_Body.xml that are specific to each robot (and even more to the part of the robot they describe).

Device_Head.xml is stored in the internal geode board flash (in /media/internal).

Device_Body.xml is stored (in a compressed version) in the flash of the chest board. A copy is dumped in the naoqi/preference folder when the DCM read it.

Both files could be changed by a method to the DCM or simply by changing the file and ask the DCM to reload it.

Note

There is also an optional file named Device_Local.xml that can also be used. It is read at startup from the naoqi/preference folder.

When these subPref files are read at startup, the value for each of their keys replace the value of the same keys in Device.xml (it’s also possible for DCM.xml), even if the DCM keeps in memory a copy of each separate file.

Note

Most of the keys in these preference files are read at startup only, and even if they change with a request to the D.C.M while it’s running, the change won’t have any effect until the next start. The joint calibration is one of the only exception.

Note

Many parameters for the motor boards are sent to them at startup. It won’t be sent again until next start.

Description

../../../_images/dcm_pref_files.png

Device.xml and DCM.xml are read from the naoqi/preference directory. The DCM keeps a copy of them in its RAM, and send them to ALMemory.

Then the DCM reads the sub pref files:

  • Device_Head.xml is read from the same directory, kept in memory, and its key/value are send to ALMemory over the key/values that already exist.
  • The DCM reads the Device_Body from the chest board flash memory, writes a copy (Device_Body.xml) in the naoqi/preference directory, and sends key/value to ALMemory over the key/values that already exists.

Whatever happened then, ALMemory always has a copy of what the DCM has in memory, with the difference that the DCM keeps all Pref and SubPref as separate files.

Note

If the same key is on both Device_Head and Device_Body with a different value, the result will be unpredictable.

Possible actions

You can see a description of the APIs in the chapter 6.

  • Load: You can ask the DCM to (re)load a file, either Chest or Head or both. In both case, the DCM loads again the files from the NAOqi/preference (and not from the chest board flash), copy them in its memory, and also in ALMemory.

  • Save: For the Head file, the save will write again the Device_Head.xml file from the copy in the DCM RAM. For the Chest file, the save command will write in the chest board flash the copy in the DCM RAM and also in the Device_Body.xml file. You can also write the Device.xml file using “save”. But this file is not supposed to change.

    Note

    During the save in the chest board, every USB communication is lost with the robot for 1 or 2 seconds. Do not use this when the robot is moving, and even when the control loop of joint is activated (the robot may fall).

    Note

    Do not use Save just after a load/add/calibration. Wait a while (one second for example) before using it.

  • Add You can add a specific key/value in a specific file with a special request. This key is only stored in ram, and copy to ALMemory. Use after the “save” command to save it in the chest or in files. If the key already exists, you can change its value using this command.

  • Calibration The calibration stores the new calibration value using the same method that the “Add”. You have to do a “Save” after it.