To start with, create a new RobotConfigFileManager
.
You'll need to pass in the main activity if you want the UI to update when the config changes (which you should so no one gets confused).
However, if you pass null, that shouldn't cause any problems. There are null checks whereever the parameter is used internally.
To get the main activity, use (FtcRobotControllerActivity)hardwareMap.appContext
(only guaranteed to work on version 3.5)
Next, create a new RobotConfigFile
. You'll need to pass in the file manager you created before, as well as the name of the config you want to switch to.It should work with or without the .xml
extension, but it will strip out the extension behind the scenes.
Then call setActiveConfigAndUpdateUI(false, myRobotConfigFile)
on your instance of RobotConfigFileManager. (replace myRobotConfigFile with whatever you named your instance of RobotConfigFile)
There are variations on that method, but that is the one you want. It will tell the Driver Station about the new config.