Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Vector & Visual Observations?

Discussion in 'ML-Agents' started by leo2r, Jun 27, 2022.

  1. leo2r

    leo2r

    Joined:
    Mar 14, 2022
    Posts:
    10
    Hi,

    I've tried to find a clear answer to this but I haven't so far. Is it possible to provide the agent with vector observations and visual observations at the same time? It seems there have been some PRs about this on Github but I can't see it mentioned anywhere in the documentation so I'm wondering if it works?

    Thanks
     
  2. mbaske

    mbaske

    Joined:
    Dec 31, 2017
    Posts:
    473
    Yes, that's possible. All observations are collected in the context of sensors. So for vector observations, there is a dedicated vector sensor. It is being generated automatically if you set the vector observation size to any value > 0 in the behavior inspector. For using other sensors, like visual observations or raycasts, you need to add the corresponding components to your agent.
     
  3. leo2r

    leo2r

    Joined:
    Mar 14, 2022
    Posts:
    10
    Thanks for the reply! Ok, I see, so it's done automatically there's nothing to actually configure on my side? Just add the observations I want in my code, set the observation size iii the behaviour inspector to however values I'm logging and then also have my camera sensor set up? :)
     
  4. mbaske

    mbaske

    Joined:
    Dec 31, 2017
    Posts:
    473
    Yes, pretty much.
    (You'll notice that if you set the vector observation size to 0, and then try to add observations to the sensor, it'll throw a null reference exception.)
     
    leo2r likes this.
  5. leo2r

    leo2r

    Joined:
    Mar 14, 2022
    Posts:
    10
    Hey! So I've tried doing this but for some reason I'm getting the following error:

    Fewer observations (0) made than vector observation size (13). The observations will be padded.

    I can't really understand why this is happening as I've written it like they do in their example code (I've attached a screenshot). I've made sure that the useVecObs is ticked (ie true) in my component box... Any idea what could be going on here? Thanks
     

    Attached Files: