I am working on an RL Problem that drives me nuts. My goal is to control a robot arm in a simulator that has to do 2 things:
- Hold the arm in a certain position (that is easy and done)
- If I apply an external force, I want the arm to displace a certain amount, which I have defined beforehand as the "stiffness goal".
The problems forms a 2 objective optimization problem and I handle that as a sum of weighted rewards, meaning my total reward should be $R = w_b*r_b+w_s*r_s$ with $r$ and $w$ being the rewards and weights for balancing and stiffness. However, that function is difficult to give to the agent in practice.
A reward for the stiffness can only be given at every n
timesteps, because in order to do that I have to interact with the system (-> apply external force) and observe the arm's displacement for some other m
timesteps. After that I can compute the reward for this displacement with respect to my desired displacement. That is only once per episode in my training setup.
On the other hand I can easily give the balancing reward at every simulation timestep. That is only based on the current position and that information is always available. But the stiffness reward is only available after I apply external force. So I have a very dense balancing reward, and a very sparse stiffness reward.
I feel like no matter what I do, the agent just cannot learn the stiffness goal.
I have tried setting $r_s$ to 0 at the timesteps where I don't have it, and tried all kinds of different weights if $r_s > 0$. I have also tried using the last measured stiffness as stiffness for the following timesteps. None of this worked.
Does anybody have any suggestions how to handle such a problem? Right now I am using PPO and an MLP network, with the standard parameters from SB3, except for the learning rate and KL Divergence which I set to $10^-5$ and $10^-4$ respectively.