Skip to content

Added the side channel for the Engine Configuration. #2958

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged

Conversation

vincentpierre
Copy link
Contributor

Note that this change does not require modifying a lot of files :

  • Adding a sender in Python
  • Adding a receiver in C#
  • subscribe the receiver to the communicator (here is a one liner in the Academy)
  • Add the side channel to the Python UnityEnvironment (not represented here)

Adding the side channel to the environment would look like such :

from mlagents.envs.environment import UnityEnvironment
from mlagents.envs.side_channel.raw_bytes_channel import RawBytesChannel
from mlagents.envs.side_channel.engine_configuration_channel import EngineConfigurationChannel

channel0 = RawBytesChannel()
channel1 = EngineConfigurationChannel()

env = UnityEnvironment(base_port = 5004, side_channels = [channel0, channel1])

Note that this change does not require modifying a lot of files :
 - Adding a sender in Python
 - Adding a receiver in C#
 - subscribe the receiver to the communicator (here is a one liner in the Academy)
 - Add the side channel to the Python UnityEnvironment (not represented here)

Adding the side channel to the environment would look like such :

```python
from mlagents.envs.environment import UnityEnvironment
from mlagents.envs.side_channel.raw_bytes_channel import RawBytesChannel
from mlagents.envs.side_channel.engine_configuration_channel import EngineConfigurationChannel

channel0 = RawBytesChannel()
channel1 = EngineConfigurationChannel()

env = UnityEnvironment(base_port = 5004, side_channels = [channel0, channel1])
```
@vincentpierre vincentpierre requested review from ervteng and removed request for harperj and surfnerd November 25, 2019 17:50
"""

def __init__(self):
self.received_messages = []
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't need self.received_messages?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right

Copy link
Contributor

@chriselion chriselion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I think if this is only going to be set once, we don't need any more structure around the args for set_configuration() (I thought initially we might need a NamedTuple)

@vincentpierre vincentpierre merged commit b98cf97 into develop-side-channel Nov 25, 2019
@delete-merged-branch delete-merged-branch bot deleted the develop-side-channel-engine-config branch November 25, 2019 21:11
vincentpierre added a commit that referenced this pull request Nov 26, 2019
* [WIP] Side Channel initial layout

* Working prototype for raw bytes

* fixing format mistake

* Added some errors and some unit tests in C#

* Added the side channel for the Engine Configuration. (#2958)

* Added the side channel for the Engine Configuration.

Note that this change does not require modifying a lot of files :
 - Adding a sender in Python
 - Adding a receiver in C#
 - subscribe the receiver to the communicator (here is a one liner in the Academy)
 - Add the side channel to the Python UnityEnvironment (not represented here)

Adding the side channel to the environment would look like such :

```python
from mlagents.envs.environment import UnityEnvironment
from mlagents.envs.side_channel.raw_bytes_channel import RawBytesChannel
from mlagents.envs.side_channel.engine_configuration_channel import EngineConfigurationChannel

channel0 = RawBytesChannel()
channel1 = EngineConfigurationChannel()

env = UnityEnvironment(base_port = 5004, side_channels = [channel0, channel1])
```

* renamings

* addressing comments

* Logging a message when an unknown side channel number has been received by Unity

* Addressing comments

* renamings

* renamings

* Adding FloatProperties to the side channels (#2968)

* renaming m_SideChannelsDict to m_SideChannel

* renaming and some comments

* renaming and adding a GetAndClearReceivedMessages() in the RawBytesSideChannel

* micro-optimization

* more errors and some nit

* addressing comments

* Using little-endian format in Python

* adding some comments

* Code comments

* some changes and added the unit tests on both Python and C#

* removing default default in get default

* Update UnitySDK/Assets/ML-Agents/Scripts/SideChannel/SideChannel.cs

Co-Authored-By: Chris Elion <chris.elion@unity3d.com>

* Update ml-agents-envs/mlagents/envs/side_channel/raw_bytes_channel.py

Co-Authored-By: Chris Elion <chris.elion@unity3d.com>

* addressing comments

* fixing tests
vincentpierre added a commit that referenced this pull request Dec 4, 2019
* [WIP] Side Channel initial layout

* Working prototype for raw bytes

* fixing format mistake

* Added some errors and some unit tests in C#

* Added the side channel for the Engine Configuration. (#2958)

* Added the side channel for the Engine Configuration.

Note that this change does not require modifying a lot of files :
 - Adding a sender in Python
 - Adding a receiver in C#
 - subscribe the receiver to the communicator (here is a one liner in the Academy)
 - Add the side channel to the Python UnityEnvironment (not represented here)

Adding the side channel to the environment would look like such :

```python
from mlagents.envs.environment import UnityEnvironment
from mlagents.envs.side_channel.raw_bytes_channel import RawBytesChannel
from mlagents.envs.side_channel.engine_configuration_channel import EngineConfigurationChannel

channel0 = RawBytesChannel()
channel1 = EngineConfigurationChannel()

env = UnityEnvironment(base_port = 5004, side_channels = [channel0, channel1])
```

* renamings

* addressing comments

* Logging a message when an unknown side channel number has been received by Unity

* Addressing comments

* renamings

* renamings

* Adding FloatProperties to the side channels (#2968)

* renaming m_SideChannelsDict to m_SideChannel

* renaming and some comments

* renaming and adding a GetAndClearReceivedMessages() in the RawBytesSideChannel

* micro-optimization

* more errors and some nit

* addressing comments

* Using little-endian format in Python

* adding some comments

* Code comments

* some changes and added the unit tests on both Python and C#

* removing default default in get default

* Update UnitySDK/Assets/ML-Agents/Scripts/SideChannel/SideChannel.cs

Co-Authored-By: Chris Elion <chris.elion@unity3d.com>

* Update ml-agents-envs/mlagents/envs/side_channel/raw_bytes_channel.py

Co-Authored-By: Chris Elion <chris.elion@unity3d.com>

* addressing comments

* fixing tests

* removing the arguments to reset and the property reset_parameters on the UnityEnvironment

* curriculum works but removed the check for reset parameters in the scene

* processing side channels before the reset command

* Removing engine configuration from C#

* Engine configuration removed

* fixing the tests

* Update ml-agents-envs/mlagents/envs/subprocess_env_manager.py

Co-Authored-By: Chris Elion <chris.elion@unity3d.com>

* Removing register callbacks with empty calls in FloarProperties

* Clamp instead of min max

* removing the brain names from the environment.py print

* renaming reset_parameters to get
properties

* made a default engine config

* bug fix

* Empty commit

* Docs changes for the Side Channels feature (#3011)

* Docs changes for the Side Channels feature

* replace deprecated with removed on the CustomResetPratmeters`

* Update docs/Python-API.md

Co-Authored-By: Chris Elion <chris.elion@unity3d.com>

* Update docs/Training-Generalized-Reinforcement-Learning-Agents.md

Co-Authored-By: Chris Elion <chris.elion@unity3d.com>

* Removing the console outputs in the docs

* Update docs/Training-ML-Agents.md

Co-Authored-By: Chris Elion <chris.elion@unity3d.com>

* replace does not work with ignored

* adding a note on side channels

* adding some steps to migrate

* addressing comments

* adding more docs to the LL-API

* added a blob on how to access the properties in C#

* adding space between ResetParameters

* fix typo

* bug fixes

* addressing comments
@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants