Thought I'd share my trial_generator

If you we’re not aware you can call your own config.yaml file.

/entrypoint.sh ground_truth:=true start_aic_engine:=true
aic_engine_config_file:=/home/jollyroot/ws_aic/src/aic/aic_engine/config/nqr_nic_card_mount0_config.yaml

So I made this simple trial template generator it will create just the trials in a yaml file, just copy and paste into your config. It’s super simple to modify for task, just modify the template body.

from pathlib import Path


OUTPUT_FILE = "generated_nic_card_mount_0_trials.yaml"

X_MIN = 0.0
X_MAX = 0.3
Y_MIN = -0.35
Y_MAX = 0.20

GRID_X_COUNT = 3
GRID_Y_COUNT = 3

YAW_VALUES = [
    3.1415,
    3.05,
    3.23,
    2.95,
    3.33,
    2.75,
    3.53,
    2.55,
    3.73,
    2.35,
    3.9444,
]


def linspace(min_value, max_value, count):
    if count <= 1:
        return [round(min_value, 6)]

    step = (max_value - min_value) / (count - 1)

    return [
        round(min_value + (step * i), 6)
        for i in range(count)
    ]


def generate_grid_positions():
    x_values = linspace(X_MIN, X_MAX, GRID_X_COUNT)
    y_values = linspace(Y_MIN, Y_MAX, GRID_Y_COUNT)

    positions = []

    for x in x_values:
        for y in y_values:
            positions.append((x, y))

    return positions


def build_trial_block(trial_num, x, y, yaw):
    return f"""  trial_{trial_num}:
    scene:
        task_board:
          pose:
            x: {x}
            y: {y}
            z: 1.14
            roll: 0.0
            pitch: 0.0
            yaw: {yaw}
          nic_rail_0:
            entity_present: True
            entity_name: "nic_card_0"
            entity_pose:
              translation: 0.036
              roll: 0.0
              pitch: 0.0
              yaw: 0.0
          nic_rail_1:
            entity_present: False
          nic_rail_2:
            entity_present: False
          nic_rail_3:
            entity_present: False
          nic_rail_4:
            entity_present: False
          sc_rail_0:
            entity_present: True
            entity_name: "sc_mount_0"
            entity_pose:
              translation: 0.042
              roll: 0.0
              pitch: 0.0
              yaw: 0.1
          sc_rail_1:
            entity_present: False
          lc_mount_rail_0:
            entity_present: True
            entity_name: "lc_mount_0"
            entity_pose:
              translation: 0.02
              roll: 0.0
              pitch: 0.0
              yaw: 0.0
          sfp_mount_rail_0:
            entity_present: True
            entity_name: "sfp_mount_0"
            entity_pose:
              translation: 0.03
              roll: 0.0
              pitch: 0.0
              yaw: 0.0
          sc_mount_rail_0:
            entity_present: True
            entity_name: "sc_mount_0"
            entity_pose:
              translation: -0.02
              roll: 0.0
              pitch: 0.0
              yaw: 0.0
          lc_mount_rail_1:
            entity_present: True
            entity_name: "lc_mount_1"
            entity_pose:
              translation: -0.01
              roll: 0.0
              pitch: 0.0
              yaw: 0.0
          sfp_mount_rail_1:
            entity_present: False
          sc_mount_rail_1:
            entity_present: False
        cables:
          cable_0:
            pose:
              gripper_offset:
                x: 0.0
                y: 0.015385
                z: 0.04245
              roll: 0.4432
              pitch: -0.4838
              yaw: 1.3303
            attach_cable_to_gripper: True
            cable_type: "sfp_sc_cable"
    tasks:
      task_1:
        cable_type: "sfp_sc"
        cable_name: "cable_0"
        plug_type: "sfp"
        plug_name: "sfp_tip"
        port_type: "sfp"
        port_name: "sfp_port_0"
        target_module_name: "nic_card_mount_0"
        time_limit: 180
"""


def build_trials(start_trial=1):
    blocks = []
    trial_num = start_trial

    for x, y in generate_grid_positions():
        for yaw in YAW_VALUES:
            blocks.append(build_trial_block(trial_num, x, y, yaw))
            trial_num += 1

    return "\n".join(blocks), trial_num - start_trial


def main():
    yaml_text, trial_count = build_trials(start_trial=1)

    Path(OUTPUT_FILE).write_text(yaml_text, encoding="utf-8")

    print("=== MFS TRIAL GENERATOR ===")
    print(f"Grid:          {GRID_X_COUNT} x {GRID_Y_COUNT}")
    print(f"Yaw Trials:    {len(YAW_VALUES)} per grid space")
    print(f"Total Trials:  {trial_count}")
    print(f"Output File:   {OUTPUT_FILE}")
    print(f"X Values:      {linspace(X_MIN, X_MAX, GRID_X_COUNT)}")
    print(f"Y Values:      {linspace(Y_MIN, Y_MAX, GRID_Y_COUNT)}")


if __name__ == "__main__":
    main()