Walker Demo| Adding 'BlockContact' observation- ValueError: setting an array element with a sequence

I tried adding an observation into the CollectObservationBodyPart function of the WalkerAgent demo by duplicating the GroundContact.cs file and checking for tags labeled ‘block’ instead.

After adding in this line and adding 16 (one for each bodypart) to the Vector Observation ‘Space Size’ I cannot run my training and am instead receiving an ‘ValueError: setting an array element with a sequence.’

Any suggestions here / what checklist should I be going through when I add new observations?

EDIT: Fixed this, cause was that one of my agents had a different set space size than the rest as I had edited it independently of the other prefabs.




Glad you got it figured out. I was able to reproduce the same error, but I also see a “Sensor sizes must match.” assert in the Editor console.

Anyway, we should have a more informative error in the trainer too; I’ve got it logged as MLA-1809 in our internal tracker.

It sometimes said “Sensor Sizes much match” sometimes it did not. I had two levels of variants I had to apply the changes to which fixed both issues.

Thanks for feedback. I have a PR to make a more informative error message here: [MLA-1809] catch mismatched observation sizes by chriselion · Pull Request #5030 · Unity-Technologies/ml-agents · GitHub. It would now say something like

ValueError: Observation at index=0 for agent with id=7 didn’t match the ObservationSpec. Expected shape (8,) but got (9,).