cloudpendulumclient.benchmark.evaluators.goal_height_evaluator

Classes

GoalHeightEvaluator([goal_height_scale, ...])

An evaluator that scores a controller based on the amount of time a pendulum manages to stay above a certain height.

class cloudpendulumclient.benchmark.evaluators.goal_height_evaluator.GoalHeightEvaluator(goal_height_scale: float = 0.9, goal_time_threshold: float = 1.0, verbose: bool = True)

An evaluator that scores a controller based on the amount of time a pendulum manages to stay above a certain height. Works for pendulums with any number of joints connected in sequence.

__init__(goal_height_scale: float = 0.9, goal_time_threshold: float = 1.0, verbose: bool = True)

Initialize the evaluator.

Parameters:
  • goal_height_scale – The fraction of the maximum height at which the pendulum is considered to be in the goal position.

  • goal_time_threshold – The minimum time the pendulum has to be above the goal height before it updates the score. For example: if goal_time_threshold = 0.9 and the pendulum stays above the goal height for 1 second before falling down the score will be increased by 1. If the goal_time_threshold = 1.1 then the score would not be updated.

  • verbose – Print to stdout whether or not the pendulum is in the goal position.

evaluate(state: list[MotorState], controller_output: list[float], time: float)

Evaluate the current state of the system. Should be called once per control loop iteration.

Parameters:
  • state – The state of the system for the current control loop iteration.

  • controller_output – The controller output torques for the current control loop iteration.

  • time – The time since the control loop started until the current control loop iteration.

get_score() float

Get the score for the benchmark. Should be called once after the benchmark has finished.

Returns:

The score for the benchmark.