Search Unity

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