Quote:
Originally Posted by wireties
The command-based robot does not link to any extra libraries, only to WPILib.a, so that is not the problem. Do you include a customized version of CommandBase.cpp in your project? I see that class has 3 static members - init, OI and examplesubsystem)? Do you have instances of all 3 declared somewhere?
|
CommandBase.cpp has been modified to look like:
Code:
#include "CommandBase.h"
#include "Commands/Scheduler.h"
CommandBase::CommandBase(const char *name) : Command(name) {
}
CommandBase::CommandBase() : Command() {
}
// Initialize a single static instance of all of your subsystems to NULL
OI* CommandBase::oi = NULL;
DriveTrain *CommandBase::chassis = NULL;
Elevator *CommandBase::elevator = NULL;
Intake *CommandBase::intake = NULL;
Shooter *CommandBase::shooter = NULL;
void CommandBase::init() {
// Create a single static instance of all of your subsystems. The following
// line should be repeated for each subsystem in the project.
//examplesubsystem = new ExampleSubsystem();
chassis = new DriveTrain();
elevator = new Elevator();
intake = new Intake();
shooter = new Shooter();
oi = new OI();
}
Code:
#ifndef COMMAND_BASE_H
#define COMMAND_BASE_H
#include "Commands/Command.h"
#include "Subsystems/DriveTrain.h"
#include "Subsystems/Elevator.h"
#include "Subsystems/Intake.h"
#include "Subsystems/Shooter.h"
#include "OI.h"
/**
* The base for all commands. All atomic commands should subclass CommandBase.
* CommandBase stores creates and stores each control system. To access a
* subsystem elsewhere in your code in your code use CommandBase.examplesubsystem
*/
class CommandBase: public Command {
public:
CommandBase(const char *name);
CommandBase();
static void init();
// Create a single static instance of all of your subsystems
static DriveTrain *chassis;
static Elevator *elevator;
static Intake *intake;
static Shooter *shooter;
static OI *oi;
};
#endif