Customization scripts

Customization scripts are embedded scripts that can be used to customize a simulation scene to a great extent. They are attached to (or associated with) scene objects, and they can be easily recognized from their dark script icon in the scene hierarchy:

[A customization script associated with object Robot]

Double-clicking the script icon allows opening the script editor. You can change properties of a given script, or associate it with another object via the script dialog. You can attach a new customization script to an object by selecting the object, then navigating to [menu bar --> Add --> Associated customization script].

Following are customization script's main properties:

  • they are executed all the time (within a same scene): when simulation is running, as well as when simulation is not running.
  • they are attached to (or associated with) scene objects (i.e. they are associated scripts). Associated scripts form the basis of CoppeliaSim's distributed control architecture, and share the convenient property to be automatically duplicated if their associated object is duplicated.
  • Above properties allow customization scripts to share some of the best features of add-ons and child scripts. Customization scripts allow the creation of customizable models for instance: imagine a model that was dropped into a scene, and that is able to configure or adapt itself, even when simulation is not running. This could be a robot where the user can adjust the various link lengths with a single slider repositioning.

    Customization scripts should contain a collection of callback functions. Those should not be blocking. This means that every time they are called, they should perform some task and then return control. If control is not returned, then the whole application halts. Customization script functions are called by the system often, but also by the main script, and follow a precise execution order in relation with other script types.

    A customization script can run threaded or non-threaded, and should be segmented in several system callback functions. If possible, do not use customization scripts to run simulation code, which is anyway best handled via child scripts.