Cleaned up robot startup and cleanup/shutdown code (#77)

Cleaned up RobotBase, removed singleton list from SensorBase, and removed unused typedefs and NULL_TASK macro from HAL's Task.hpp. Making the robot class instance static fixed non-POD statics used by the instance during destruction from being destroyed first.
This commit is contained in:
Tyler Veness
2016-06-19 00:13:18 -07:00
committed by Peter Johnson
parent ecc210f99a
commit d66c61a36e
10 changed files with 16 additions and 184 deletions

View File

@@ -7,15 +7,18 @@
#pragma once
#include <cstdio>
#include "Base.h"
#include "DriverStation.h"
#include "simulation/MainNode.h"
#include "simulation/simTime.h"
#define START_ROBOT_CLASS(_ClassName_) \
int main() { \
(new _ClassName_())->StartCompetition(); \
return 0; \
#define START_ROBOT_CLASS(_ClassName_) \
int main() { \
static _ClassName_ robot; \
std::printf("\n********** Robot program starting **********\n"); \
robot.StartCompetition(); \
}
/**
@@ -29,12 +32,7 @@
* then killed at the end of the Autonomous period.
*/
class RobotBase {
friend class RobotDeleter;
public:
static RobotBase& getInstance();
static void setInstance(RobotBase* robot);
bool IsEnabled() const;
bool IsDisabled() const;
bool IsAutonomous() const;
@@ -51,7 +49,4 @@ class RobotBase {
DriverStation& m_ds;
transport::SubscriberPtr time_sub;
private:
static RobotBase* m_instance;
};