Goals API
Goals API
MaintainGoal
from composabl import MaintainGoal
# Maintain temperature
temp_goal = MaintainGoal(
sensor_name="temperature",
description="Keep temperature at 25°C",
target=25.0,
stop_distance=0.5 # Tolerance band
)
# Maintain with specific reward shaping
class CustomMaintainGoal(MaintainGoal):
def __init__(self):
super().__init__("pressure", "Maintain pressure", target=1.0, stop_distance=0.05)
async def compute_reward(self, obs, action, sim_reward):
base_reward = await super().compute_reward(obs, action, sim_reward)
# Add penalty for control effort
effort_penalty = -0.1 * np.sum(np.abs(action))
return base_reward + effort_penaltyApproachGoal
AvoidGoal
MaximizeGoal
MinimizeGoal
Last updated