Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Question How to AddReward the smaller torque and angular velocity given in Hingejoint

Discussion in 'ML-Agents' started by tarisetsuna, Jan 13, 2021.

  1. tarisetsuna

    tarisetsuna

    Joined:
    Dec 23, 2020
    Posts:
    6
    Now i do learning for a robot arm by this tool.
    I have a question about how to give rewards
    The smaller the torque and angular velocity given, the more reward i want to give.
    How should I write if(~){AddReward(~);} statement?

    This is a translation, so the explanation may be difficult to understand.
     
  2. vincentpierre

    vincentpierre

    Joined:
    May 5, 2017
    Posts:
    160
    I am not sure I understand the question, but if you are asking how do I add a reward that depends on some input, you can do:

    float r = ComputeReward(inputLikeAngularVelocity);
    Agent.AddReward(r);

    Where ComputeReward is a decreasing function like f: x --> a - b * x where a > 0 and b > 0