why is my reward function outputting such a small number [closed]

asked 2021-10-28 16:27:08 -0500

PGTKing gravatar image

updated 2021-10-28 16:43:47 -0500

jayess gravatar image

I have this loop

            while True:
            current_time = time.time()
            elapsed_time = current_time - start_time
            z = r.give_force()
            print("z is", z)
            score += r.what_is_reward()
            print("the score during game is", score)
            time.sleep(1.0)
            print(elapsed_time)
            if elapsed_time > seconds:
                break

And here is my reward function

def what_is_reward(self):
    start_time = time.time()
    if self.target1 - 3 < self.joint1 < self.target1 + 3:
        self.reward = time.time() - start_time

It keeps outputting an extremely small number like to the 0.1e-5 even though the joint position in radians should be within the target zone. target zone is target-3 radians to target zone+3 radians

edit retag flag offensive reopen merge delete

Closed for the following reason question is off-topic or not relevant. Please see http://wiki.ros.org/Support for more details. by stevemacenski
close date 2021-10-28 17:50:09.735667