Quote:
Originally Posted by BradAMiller
There's an issue where statically initialized classes are not created in any specific order. So that means that variables, in particular, lists of the sensors and speed controllers might not have been initialized when the static classes are created.
The best solution is to try to not create WPILib objects statically and instead make them class members. Then you can initialize them from the heap using new or as class members. This makes sure that they don't get initialized before the underlying WPILib code starts up.
But we're looking at the problem now. May be an update.
|
I ran into this issue making a very simple robot program using the "SimpleTemplate". So it has a class (RobotDemo) derived from SimpleRobot that's initialized via START_ROBOT_CLASS(RobotDemo).
SimpleRobot's constructor invokes base class RobotBase constructor, which invokes DriverStation::GetInstance(), which ultimately leads to NetworkTables::Initialize() which crashes for the reasons described herein.
So unless I'm missing something obvious, the current C++ RobotBase is unusable, since it has to be statically initialized via START_ROBOT_CLASS.
I'd love to know if there's a work around for this; it seems like a pretty serious problem that's got me stopped in my tracks....