Skip to content

Enable child GameObjects to have a SensorComponent as well #3095

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
merged 1 commit into from
Dec 16, 2019

Conversation

ervteng
Copy link
Contributor

@ervteng ervteng commented Dec 16, 2019

In many cases, we want to add Sensors to child GameObjects of the Agent - this could be when the Agent is made up of many GameObjects, or if we want to apply a transform to e.g. a RayPerception component.

However, in the case of hierarchical agents, we don't necessarily want this. This PR makes whether or not we search children for Sensors optional.

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.

LGTM

@ervteng ervteng merged commit ebad90f into master Dec 16, 2019
@delete-merged-branch delete-merged-branch bot deleted the develop-childsensors branch December 16, 2019 22:41
@ervteng
Copy link
Contributor Author

ervteng commented Dec 20, 2019

Hi @Blueeyesjt1, are you using the UnitySDK folder from the master branch of ML-Agents? What's the hierarchy of GameObjects under your Agent look like?

@ervteng
Copy link
Contributor Author

ervteng commented Dec 20, 2019

Interesting - and you have "UseChildSensors" checked? I've been able to add such a sensor to an empty child gameobject and it does work. What's the error you're getting?

@ervteng
Copy link
Contributor Author

ervteng commented Dec 20, 2019

Awesome! Glad you figured it out.

@Blueeyesjt1
Copy link

image
image
image

(I deleted my other question because it was unrelated to the topic.)

But now, I'm having an issue when try to test my agent AFTER training and adding the model to the inspector. Adding more observations does not fix this. What should I do? If I add an extra 33, then the error also adds another 33. It keeps asking for +33 over and over again the more I add on!

@ervteng
Copy link
Contributor Author

ervteng commented Dec 23, 2019

Hi @Blueeyesjt1, it's a little confusing but you shouldn't add the RayPerceptionSensor obs to the VectorObservationSpaceSize.

When you quit Python training, the terminal should print out something like this:

Converting ./models/booger-0/PushBlock/frozen_graph_def.pb to ./models/booger-0/PushBlock.nn
GLOBALS: 'is_continuous_control', 'version_number', 'memory_size', 'action_output_shape'
IN: 'vector_observation': [-1, 1, 1, 224] => 'main_graph_0/hidden_0/BiasAdd'
IN: 'action_masks': [-1, 1, 1, 7] => 'strided_slice_1'
OUT: 'action_probs', 'concat_2', 'action'
DONE: wrote ./models/booger-0/PushBlock.nn file.
INFO:mlagents.trainers:Exported ./models/booger-0/PushBlock.nn file

Can you post your output? It'll help a lot in debugging. Thanks!

@Blueeyesjt1
Copy link

Blueeyesjt1 commented Dec 23, 2019

image

@ervteng

@ervteng
Copy link
Contributor Author

ervteng commented Dec 23, 2019

This looks correct - are you absolutely sure that you're using the right model file?

The model file that's exported shows 328 observations, which is the right number.

@Blueeyesjt1
Copy link

Blueeyesjt1 commented Dec 23, 2019

@ervteng Yes, I am. Now, I have the rayPerceptionSensorComp3D set as an observation. Is that a bad idea? I have heard it works on its own.

@ervteng
Copy link
Contributor Author

ervteng commented Dec 23, 2019

Yes it does. If you're using only RayPerceptionSensor, the VectorObservations parameter in the agent should be 0. What're the other 295 vector obs?

@Blueeyesjt1
Copy link

Blueeyesjt1 commented Dec 23, 2019

Update: Removing the raySensor3D component from the observation list fixed it. Thanks for the help. (Again!) @ervteng

@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.

4 participants