2013-12-15 18:30:16 -05:00
|
|
|
#include "WPILib.h"
|
|
|
|
|
#include "Commands/Command.h"
|
|
|
|
|
#include "Commands/ExampleCommand.h"
|
|
|
|
|
#include "CommandBase.h"
|
|
|
|
|
|
2014-02-25 18:43:40 -05:00
|
|
|
class Robot: public IterativeRobot
|
|
|
|
|
{
|
2013-12-15 18:30:16 -05:00
|
|
|
private:
|
2015-07-24 19:19:40 -04:00
|
|
|
std::unique_ptr<Command> autonomousCommand;
|
2014-02-25 18:43:40 -05:00
|
|
|
|
|
|
|
|
void RobotInit()
|
|
|
|
|
{
|
2013-12-15 18:30:16 -05:00
|
|
|
CommandBase::init();
|
2015-07-24 19:19:40 -04:00
|
|
|
autonomousCommand.reset(new ExampleCommand());
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
2015-07-24 19:19:40 -04:00
|
|
|
|
2015-06-02 10:00:34 -04:00
|
|
|
/**
|
|
|
|
|
* This function is called once each time the robot enters Disabled mode.
|
|
|
|
|
* You can use it to reset any subsystem information you want to clear when
|
|
|
|
|
* the robot is disabled.
|
|
|
|
|
*/
|
|
|
|
|
void DisabledInit()
|
|
|
|
|
{
|
|
|
|
|
}
|
2015-07-24 19:19:40 -04:00
|
|
|
|
2014-10-15 15:32:38 -04:00
|
|
|
void DisabledPeriodic()
|
|
|
|
|
{
|
Revert changes preventing old user code from compiling.
I'm not 100% sure whether we want these, but they are a quick
find and replace to do.
Basically, there are two primary things that we have done
this summer that break existing user code:
-Changing GetInstance() calls to return references instead
of pointers. This forces users to change from doing something
like LiveWindow::GetInstance()->AddSensor() to LiveWindow::GetInstance().AddSensor().
-Making PIDGet() and related calls const, forcing users to change
the function signatures wherever they override them.
The GetInstance() calls don't really matter to me either way,
especially since there are no real ownership issues going on there,
unlike the rest of the smart pointer-related changes.
For the const stuff, it is certainly more correct to mandate that
user PIDGet() functions be const and the such, but at the same time,
I'm not sure that there is any strong need for it, and the errors
generated are not the most helpful. While this wouldn't necessarily
be an issue for more experienced teams or completely new teams (who
don't have any old code to be reusing), it may cause issues for more
average teams who aren't familiar with the intricacies of C++ anything.
Change-Id: I6e7007982069292ea70e6d0fc8ca40203340df1b
2015-07-24 19:19:40 -04:00
|
|
|
Scheduler::GetInstance()->Run();
|
2014-10-15 15:32:38 -04:00
|
|
|
}
|
2014-02-25 18:43:40 -05:00
|
|
|
|
|
|
|
|
void AutonomousInit()
|
|
|
|
|
{
|
2014-11-23 18:47:00 -08:00
|
|
|
if (autonomousCommand != NULL)
|
|
|
|
|
autonomousCommand->Start();
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
2014-02-25 18:43:40 -05:00
|
|
|
|
|
|
|
|
void AutonomousPeriodic()
|
|
|
|
|
{
|
Revert changes preventing old user code from compiling.
I'm not 100% sure whether we want these, but they are a quick
find and replace to do.
Basically, there are two primary things that we have done
this summer that break existing user code:
-Changing GetInstance() calls to return references instead
of pointers. This forces users to change from doing something
like LiveWindow::GetInstance()->AddSensor() to LiveWindow::GetInstance().AddSensor().
-Making PIDGet() and related calls const, forcing users to change
the function signatures wherever they override them.
The GetInstance() calls don't really matter to me either way,
especially since there are no real ownership issues going on there,
unlike the rest of the smart pointer-related changes.
For the const stuff, it is certainly more correct to mandate that
user PIDGet() functions be const and the such, but at the same time,
I'm not sure that there is any strong need for it, and the errors
generated are not the most helpful. While this wouldn't necessarily
be an issue for more experienced teams or completely new teams (who
don't have any old code to be reusing), it may cause issues for more
average teams who aren't familiar with the intricacies of C++ anything.
Change-Id: I6e7007982069292ea70e6d0fc8ca40203340df1b
2015-07-24 19:19:40 -04:00
|
|
|
Scheduler::GetInstance()->Run();
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
2014-02-25 18:43:40 -05:00
|
|
|
|
|
|
|
|
void TeleopInit()
|
|
|
|
|
{
|
2013-12-15 18:30:16 -05:00
|
|
|
// This makes sure that the autonomous stops running when
|
2015-07-24 19:19:40 -04:00
|
|
|
// teleop starts running. If you want the autonomous to
|
2013-12-15 18:30:16 -05:00
|
|
|
// continue until interrupted by another command, remove
|
|
|
|
|
// this line or comment it out.
|
2014-11-23 18:47:00 -08:00
|
|
|
if (autonomousCommand != NULL)
|
|
|
|
|
autonomousCommand->Cancel();
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
2014-02-25 18:43:40 -05:00
|
|
|
|
|
|
|
|
void TeleopPeriodic()
|
|
|
|
|
{
|
Revert changes preventing old user code from compiling.
I'm not 100% sure whether we want these, but they are a quick
find and replace to do.
Basically, there are two primary things that we have done
this summer that break existing user code:
-Changing GetInstance() calls to return references instead
of pointers. This forces users to change from doing something
like LiveWindow::GetInstance()->AddSensor() to LiveWindow::GetInstance().AddSensor().
-Making PIDGet() and related calls const, forcing users to change
the function signatures wherever they override them.
The GetInstance() calls don't really matter to me either way,
especially since there are no real ownership issues going on there,
unlike the rest of the smart pointer-related changes.
For the const stuff, it is certainly more correct to mandate that
user PIDGet() functions be const and the such, but at the same time,
I'm not sure that there is any strong need for it, and the errors
generated are not the most helpful. While this wouldn't necessarily
be an issue for more experienced teams or completely new teams (who
don't have any old code to be reusing), it may cause issues for more
average teams who aren't familiar with the intricacies of C++ anything.
Change-Id: I6e7007982069292ea70e6d0fc8ca40203340df1b
2015-07-24 19:19:40 -04:00
|
|
|
Scheduler::GetInstance()->Run();
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
2014-02-25 18:43:40 -05:00
|
|
|
|
|
|
|
|
void TestPeriodic()
|
|
|
|
|
{
|
Revert changes preventing old user code from compiling.
I'm not 100% sure whether we want these, but they are a quick
find and replace to do.
Basically, there are two primary things that we have done
this summer that break existing user code:
-Changing GetInstance() calls to return references instead
of pointers. This forces users to change from doing something
like LiveWindow::GetInstance()->AddSensor() to LiveWindow::GetInstance().AddSensor().
-Making PIDGet() and related calls const, forcing users to change
the function signatures wherever they override them.
The GetInstance() calls don't really matter to me either way,
especially since there are no real ownership issues going on there,
unlike the rest of the smart pointer-related changes.
For the const stuff, it is certainly more correct to mandate that
user PIDGet() functions be const and the such, but at the same time,
I'm not sure that there is any strong need for it, and the errors
generated are not the most helpful. While this wouldn't necessarily
be an issue for more experienced teams or completely new teams (who
don't have any old code to be reusing), it may cause issues for more
average teams who aren't familiar with the intricacies of C++ anything.
Change-Id: I6e7007982069292ea70e6d0fc8ca40203340df1b
2015-07-24 19:19:40 -04:00
|
|
|
LiveWindow::GetInstance()->Run();
|
2013-12-15 18:30:16 -05:00
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
2015-07-24 19:19:40 -04:00
|
|
|
START_ROBOT_CLASS(Robot)
|
2013-12-15 18:30:16 -05:00
|
|
|
|