I use TwinCAT to code a robot with many joints, each of which has some unique features. Some joints have absolute encoders, while someones need to be initialized in a specific way, etc.
I used a joint base class(function block), containing common methods. And inherited it into derived classes for all kinds of joints with unique methods. It works fine.
I really want to loop through the instances of different classes. Putting them into an array is my first thought. I know C++'s vector or Python's list suits this job perfectly. But it seems impossible in TwinCAT.
I tried the interface, however, the unique methods are unavailable through the interface.
I tried to use a method to return the instance according to the input index, but it can only return the instance of one predefined class (function block).