Hi sanderb,
using the class ControllerManager you can get a list of all controller referenced by RobotStudio at the moment. You can use the method IsStationController() to check if it is a Virtual Controller that is referenced because it is associated with a robot in a station, or if it is a controller added by the user on the Online Tab.
Unfortunately it is not possible to add or remove controllers via the API.
If you can explain your use case we are happy to consider adding an Add-method, or maybe a Connect-method to the API.
One of the reasons we did not expose it from scratch is that a simple Add-method seems to be something simple and almost atomic, but in this case a connection to a real controller may be setup, a lot of subscriptions on controller events are done by RobotStudio. It may take some time and so on. And I guess it is an asynchronous operation under the hood, so if we returned directly from the Add-method you would not really know what state RobotStudio are in.
I would like to give some advice on how to work with the Controller class from whithin RobotStudio. When you are developing an Add-In to RobotStudio, and want to do stuff with a controller, you shall not need to login from your code, as RobotStudio has already logged in. That happens when the user adds a controller to the Online Tab.
The user is responsible for managing mastership using the buttons of the Online Tab, and your Add-In shall just adopt. If the user has not requested mastership, you shall disable buttons in your user interface that needs mastership.