def forward_locomotion_success(stdout, parameter, val):
    """How close forward velocity is to target velocity, linearly measured."""
    lines = stdout.decode().split("\n")
    lines = [line for line in lines if "linear velocity" in line]

    target_forward_vel = 2.0
    average_success, average_forward_vel, counter = 0.0, 0.0, 0
    for line in lines:
        forward_vel = float(line.split(": ")[1].strip("[]").split()[0])
        average_success += -abs(forward_vel - target_forward_vel)
        average_forward_vel += forward_vel
        counter += 1
    average_success /= counter
    average_forward_vel /= counter
    print(f"Average success and forward vel for {parameter} = {val}: {average_success}, {average_forward_vel}")
    return average_success >= -1.0
How close forward velocity is to target velocity, linearly measured.
dr_eureka/rapp.py