Using internal pid in UC and AsyncPosPIDController in autonomous

So, I want to use an AsyncPosPIDController in auto to control my tray, but I want to use the internal pid for UC. How would I accomplish this?

In the builder: https://okapilib.github.io/OkapiLib/classokapi_1_1AsyncPosControllerBuilder.html
If you specify gains, it will make an AsyncPosPIDController (uses OkapiLib’s PID). If you don’t, it will make an AsyncPosIntegratedController (uses the integrated control).

If you want to use one for autonomous and another for opcontrol, you could follow point three here to make sure the objects are destructed properly: https://okapilib.github.io/OkapiLib/md_docs_tutorials_concepts_builders-and-tasks.html

Use the builder in a local scope and save the built object to a variable also in the same local scope

2 Likes