Class DemonstrationRecorder
The Demonstration Recorder component facilitates the recording of demonstrations used for imitation learning.
Inherited Members
Namespace: Unity.MLAgents.Demonstrations
Syntax
[RequireComponent(typeof(Agent))]
[AddComponentMenu("ML Agents/Demonstration Recorder", 0)]
public class DemonstrationRecorder : MonoBehaviour
Remarks
Add this component to the GameObject containing an Agent to enable recording the agent for imitation learning. You must implement the Heuristic(ActionBuffers) function of the agent to provide manual control in order to record demonstrations.
See Imitation Learning - Recording Demonstrations for more information.
Fields
DemonstrationDirectory
Directory to save the demo files. Will default to a "Demonstrations/" folder in the Application data path if not specified.
Declaration
[FormerlySerializedAs("demonstrationDirectory")]
[Tooltip("Directory to save the demo files. Will default to {Application.dataPath}/Demonstrations if not specified.")]
public string DemonstrationDirectory
Field Value
Type | Description |
---|---|
String |
DemonstrationName
Base demonstration file name. If multiple files are saved, the additional filenames will have a sequence of unique numbers appended.
Declaration
[FormerlySerializedAs("demonstrationName")]
[Tooltip("Base demonstration file name. If multiple files are saved, the additional filenames will have a unique number appended.")]
public string DemonstrationName
Field Value
Type | Description |
---|---|
String |
NumStepsToRecord
Number of steps to record. The editor will stop playing when it reaches this threshold. Set to zero to record indefinitely.
Declaration
[Tooltip("Number of steps to record. The editor will stop playing when it reaches this threshold. Set to zero to record indefinitely.")]
public int NumStepsToRecord
Field Value
Type | Description |
---|---|
Int32 |
Record
Whether or not to record demonstrations.
Declaration
[FormerlySerializedAs("record")]
[Tooltip("Whether or not to record demonstrations.")]
public bool Record
Field Value
Type | Description |
---|---|
Boolean |
Methods
AddDemonstrationWriterToAgent(DemonstrationWriter)
Add additional DemonstrationWriter to the Agent. It is still up to the user to Close this DemonstrationWriters when recording is done.
Declaration
public void AddDemonstrationWriterToAgent(DemonstrationWriter demoWriter)
Parameters
Type | Name | Description |
---|---|---|
DemonstrationWriter | demoWriter |
Close()
Close the DemonstrationWriter and remove it from the Agent. Has no effect if the DemonstrationWriter is already closed (or wasn't opened)
Declaration
public void Close()
RemoveDemonstrationWriterFromAgent(DemonstrationWriter)
Remove additional DemonstrationWriter to the Agent. It is still up to the user to Close this DemonstrationWriters when recording is done.
Declaration
public void RemoveDemonstrationWriterFromAgent(DemonstrationWriter demoWriter)
Parameters
Type | Name | Description |
---|---|---|
DemonstrationWriter | demoWriter |