motionfiles

Recorded trajectories that the motion player replays on the machine, one file per motion, and how to select and play them.

The motionfiles folder holds recorded trajectories. The motion player reads them and replays them on the machine, one file per motion.

└── motionfiles
    ├── 00_ExampleFile.csv
    └── 01_ExampleFile.csv

The folder is named by the MotionPlayer block in config.json, and the feature is off until you enable it there:

"MotionPlayer": {
  "Enable": false,
  "Path": "motionfiles",
  "Linking": "linking/motion-player.link.json"
}

How the motion player works

The player loads every file of the folder into memory. You pick one by its number, and while it plays, its output follows the file row by row. A link file passes the output on to the machine. Click a part to go to its section.

Go to File names motionfiles/ 00_ExampleFile.csvID 0 01_ExampleFile.csvID 1 notes.txtskipped read at start-up and on reload Go to Control the player root/MotionPlayer profileIDwhich file: 0 command1 play, 2 pause, 3 stop, 4 reload timeScaleFactor1.0 outputone value per column Go to the link files motion-player.link.json › MachineControl/ hostInJointPosition1 While playing, the output takes the first row at or after the player time 0 0.01 0.02 0.03 0.04 s player time output = this row

In the standard robot configuration, motion-player.link.json links root/MotionPlayer/output to root/MachineControl/hostInJointPosition1, so the player drives the machine control axes.

File names

A file name starts with its ID, a number, followed by an underscore: 00_ExampleFile.csv has ID 0, 12_Pick.csv has ID 12. Only files ending in .csv are read. The player skips, with a message in the log:

  • a file with another extension,
  • a file whose name does not start with a number and an underscore,
  • a second file with an ID that is already taken.

File format

Despite the .csv extension, the columns are separated by spaces, not commas. A file has a loop line, a comment line naming the columns, and one row per sample:

loop = 0
# Time Axis1 Axis2 Axis3 Axis4 Axis5 Axis6
0 0.000113638411942 5.6819205971163E-05 -0.000106073529199 0.00113638411942 0.000568192059712 -0.00106073529199
0.01 0.000113638411942 5.6819205971163E-05 -0.000106073529199 0.00113638411942 0.000568192059712 -0.00106073529199
0.02 0.000113638411942 5.6819205971163E-05 -0.000106073529199 0.00113638411942 0.000568192059712 -0.00106073529199
Line What it does Default
loop = 0 0 plays the file once and stops. Any other number starts it again from the beginning when it ends 0
# … A comment: the line is skipped
Rows The time in seconds, then one value for each output element, so output[0] is the second column. Up to 50 values per row

The time starts at 0 and must go up. The rows do not have to be evenly spaced: the player takes the first row whose time is at or after its own time, so the output steps from row to row without interpolating. The two shipped example files step time in 0.01 s increments over 30.28 s, which is 3 029 samples at 100 Hz. Exponent notation (5.68E-05) is accepted.

Control the player

The player’s parameters are under root/MotionPlayer/:

Parameter What it does Default
profileID The ID of the file to play 0
command Write 1 to play, 2 to pause, 3 to stop, 4 to reload the files from the folder
timeScaleFactor The playback speed: 0.5 plays at half speed, 2 at double speed 1.0
state 0 stopped, 1 playing, 2 paused, 3 finished, 4 and 5 reloading
error 0 no error, 1 no file selected, 2 no file with the selected ID
activeProfileID The ID of the file that is selected now
activeProfileTimestamp The time of the row on the output
activeProfileEndTime The time of the file’s last row
fractionComplete How far the file has played, from 0 to 1
numberOfProfiles How many files were loaded

A new profileID takes effect when the player is stopped or at the end of a file. Set the next ID while one plays, and the player switches to it when the current file ends. It plays the new file straight away only if that file’s loop is not 0; otherwise it stops at the new file’s first row and waits for the next play command.

To add or change a file on a running controller, copy it into the folder and write 4 to command.