Quote:
Originally Posted by slibert
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....
|
FWIW, the issue seems to be that the virtual table for the static NetworkTableMode::Server object (an instance of NetworkTableServerMode class) is not yet initialized when NetworkTables::Initialize() is invoked; when NetworkTables::Initialize() attempts to use the NetworkTableServerMode object to invoke the virtual member function CreateNode(), the virtual table for the Server object hasn't yet been initialized because the NetworkTableServerMode constructor hasn't yet been invoked. So as Greg said, it's unordered static object construction that's causing it. However, it's happening within the WPILibrary itself (from within the RobotBase constructor), rather than in our robot code.