Class FloatPropertiesChannel
Side channel that is comprised of a collection of float variables.
Inherited Members
Namespace: Unity.MLAgents.SideChannels
Syntax
public class FloatPropertiesChannel : SideChannel
Constructors
FloatPropertiesChannel(Guid)
Initializes the side channel with the provided channel ID.
Declaration
public FloatPropertiesChannel(Guid channelId = default(Guid))
Parameters
Type | Name | Description |
---|---|---|
Guid | channelId | ID for the side channel. |
Methods
GetWithDefault(String, Single)
Get an Environment property with a default value. If there is a value for this property, it will be returned, otherwise, the default value will be returned.
Declaration
public float GetWithDefault(string key, float defaultValue)
Parameters
Type | Name | Description |
---|---|---|
String | key | The string identifier of the property. |
Single | defaultValue | The default value of the property. |
Returns
Type | Description |
---|---|
Single |
Keys()
Returns a list of all the string identifiers of the properties currently present.
Declaration
public IList<string> Keys()
Returns
Type | Description |
---|---|
IList<String> | The list of string identifiers |
OnMessageReceived(IncomingMessage)
Is called by the communicator every time a message is received from Python by the SideChannel. Can be called multiple times per simulation step if multiple messages were sent.
Declaration
protected override void OnMessageReceived(IncomingMessage msg)
Parameters
Type | Name | Description |
---|---|---|
IncomingMessage | msg | The incoming message. |
Overrides
RegisterCallback(String, Action<Single>)
Registers an action to be performed everytime the property is changed.
Declaration
public void RegisterCallback(string key, Action<float> action)
Parameters
Type | Name | Description |
---|---|---|
String | key | The string identifier of the property. |
Action<Single> | action | The action that ill be performed. Takes a float as input. |
Set(String, Single)
Sets one of the float properties of the environment. This data will be sent to Python.
Declaration
public void Set(string key, float value)
Parameters
Type | Name | Description |
---|---|---|
String | key | The string identifier of the property. |
Single | value | The float value of the property. |