Rewards#
- protocol enki_env.reward.RewardFunction#
A callable that generates rewards at each step of the environment.
For example
def my_reward(robot: pyenki.DifferentialWheeled, success: bool | None) -> float: return -1 if abs(robot.position[0]) > 1 else 0
Classes that implement this protocol must have the following methods / attributes:
- __call__(robot: pyenki.DifferentialWheeled, success: bool | None) float#
Generate a reward for a robot.
- Parameters:
robot – The robot
success – Whether the robot has completed the task with success (
True) or failure (False), or has yet to complete the task or there is no task (None).
- Returns:
The reward assigned to the robot