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

Am I doing this right? (Quadruped sim)

Discussion in 'ML-Agents' started by i-make-robots, Jul 8, 2022.

  1. i-make-robots

    i-make-robots

    Joined:
    Aug 27, 2017
    Posts:
    17
  2. mbaske

    mbaske

    Joined:
    Dec 31, 2017
    Posts:
    473
    Hi - looking at your behavior parameters screenshot, I'd say the stacking value is way too high. You're feeding 2208 (69 x 32) input values to a 3 x 128 unit network! What exactly is your agent observing? If it's joint rotation angles, a stacking value of 2 or 3 at the most should suffice for inferring motion. You might not even need stacking, if the agent observes joint velocities.
     
    i-make-robots likes this.
  3. i-make-robots

    i-make-robots

    Joined:
    Aug 27, 2017
    Posts:
    17
    @mbaske thanks! It certainly trains faster that way!

    I'm trying a process of incremental changes to approach the right network design that will solve the problem. Is there a better way?
     
  4. i-make-robots

    i-make-robots

    Joined:
    Aug 27, 2017
    Posts:
    17
    @mbaske Based on your feedback, I've eliminated stacking.

    whole project is https://github.com/MarginallyClever/DogML/

    My inputs are:
    - 12 vector3s for position of each joint relative to the ArticulationBody root using
    Code (CSharp):
    1. Torso.transform.InverseTransformPoint(limits[i].obj.transform.position);
    - 12 floats joint positions (getJointPositions)
    - 12 floats joint velocities (GetJointVelocities)
    - 12 floats joint accelerations (GetJointAccelerations)
    - 1 bool for each foot (if contact with floor). I'd rather have amount of pressure against floor but IDK how yet.
    - 1 float = height off floor / maximum standing height
    - 1 vector3 which way is up
    Code (CSharp):
    1. Torso.transform.InverseTransformDirection(new Vector3(0,1,0));
    - 1 vector3 body velocity normalized
    Code (CSharp):
    1. Torso.transform.InverseTransformDirection(Torso.velocity);
    - 1 float body velocity clamped(0,10) and then / 10.
    - 1 vector3 local angular velocity
    Code (CSharp):
    1. Torso.transform.InverseTransformDirection(Torso.angularVelocity).normalized * Torso.angularVelocity.magnitude;
    My outputs are desired angles for each joint via SetDriveTargets. I do not mess with joint forces the way the Crawler and Walker demos do. I *think* ArticulationBody uses JointDrives for each axis ArticulationBody.xDrive.forceLimit is a different name from JointDrive.maximumForce used in Crawler/Walker so... not certain.

    Any ideas?
     

    Attached Files:

  5. mbaske

    mbaske

    Joined:
    Dec 31, 2017
    Posts:
    473
    Hi - I usually base my config on the example projects. In this case, the crawler seems to be the best fit. And then, yes, I would tweak things incrementally. Observations look good.