Team-OKC-Robotics / FRC-2022-CPP

a c++ port of our FRC-2022 code as training in C++
Other
0 stars 2 forks source link

Scripted Autonomous Functionality #18

Open jkleiber opened 1 year ago

jkleiber commented 1 year ago

Summary In preparation for the 2023 season, we should up our autonomous game. The biggest improvement we can make is by not using hard-coded autonomous C++ files, but rather load dynamically from a script.

In the past I've seen this done via CSV or JSON, but I'd like to try this in TOML using arrays of tables.

Work to Do

Verification

danielbrownmsm commented 1 year ago

How do you make the step from "command written in TOML" to "actual autonomous code"? Or would the auto just look like some kind of:

public Auto() {
    ArrayList<Command> commandList = new ArrayList<>();
    for command in commands:
        if command.type == SetShooterCommand:
            commandList.append(new SetShooterCommand(*command.args)
        elif command.type == DriveForwardCommand:
            commandList.append(new DriveForwardCommand(*command.args)
    super(commandList);
}

?

jkleiber commented 1 year ago

Yeah, so it would probably be something like what you're describing. The TOML side would pass in command type, parameters, and time. Then we'd need to schedule these commands in AutonomousPeriodic based on time elapsed in auto