本文整理汇总了C++中DriverStationLCD类的典型用法代码示例。如果您正苦于以下问题:C++ DriverStationLCD类的具体用法?C++ DriverStationLCD怎么用?C++ DriverStationLCD使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了DriverStationLCD类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: TeleopInit
void Machine :: TeleopInit()
{
DriverStationLCD *lcd = DriverStationLCD::GetInstance();
lcd->PrintfLine(DriverStationLCD::kUser_Line2, "Ben is here");
lcd->UpdateLCD();
drive.enableVoltageControl();
//drive.enableSpeedControl();
}
示例2: RobotDemo
RobotDemo(void):
myRobot(1, 2), // these must be initialized in the same order
stick(1) // as they are declared above.
{
dsLCD = DriverStationLCD::GetInstance();
dsLCD->Clear();
dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "XboxController2");
dsLCD->UpdateLCD();
myRobot.SetExpiration(0.1);
}
示例3: Hohenheim
Hohenheim(void) {
driverStation = DriverStation::GetInstance();
dsLCD = DriverStationLCD::GetInstance();
pneumaticsControl = PneumaticsControl::getInstance();
shooterControl = ShooterControl::getInstance();
dsLCD->Clear();
dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "Hohenheim 2014 V 3.1");
dsLCD->UpdateLCD();
GetWatchdog().SetEnabled(false);
}
示例4: OperatorControl
// Code to be run during the remaining 2:20 of the match (after Autonomous())
//
// OperatorControl
// * Calls all the above methods
void OperatorControl()
{
// SAFETY AND SANITY - SET ALL TO ZERO
intake.Set(0.0);
rightWinch.Set(0.0);
leftWinch.Set(0.0);
arm.Set(DoubleSolenoid::kReverse);
/* TODO: Investigate. At least year's (GTR East) competition, we reached the conclusion that disabling this was
* the only way we could get out robot code to work (reliably). Should this be set to false?
*/
robotDrive.SetSafetyEnabled(false);
Timer clock;
int sanity = 0;
int bigSanity = 0;
loading = false;
loaded = winchSwitch.Get();
RegisterButtons();
gamepad.Update();
leftStick.Update();
compressor.Start();
while (IsOperatorControl() && IsEnabled())
{
clock.Start();
HandleDriverInputs();
HandleShooter();
HandleArm();
// HandleEject();
while (!clock.HasPeriodPassed(LOOP_PERIOD)); // add an IsEnabled???
clock.Reset();
sanity++;
if (sanity >= 100)
{
bigSanity++;
sanity = 0;
dsLCD->PrintfLine(DriverStationLCD::kUser_Line4, "%d", bigSanity);
}
gamepad.Update();
leftStick.Update();
dsLCD->UpdateLCD();
}
// SAFETY AND SANITY - SET ALL TO ZERO
intake.Set(0.0);
rightWinch.Set(0.0);
leftWinch.Set(0.0);
}
示例5:
void
DriverMessages::SendTextLines()
{
DriverStationLCD *lcd =DriverStationLCD::GetInstance();
for(int i = 0; i < 3;i++){
lcd->Printf((DriverStationLCD::Line)i, 1, "%s", (char *)lineText[i]);
}
lcd->UpdateLCD();
}
示例6: OperatorControl
/**
* Runs the motors with arcade steering.
*/
void OperatorControl(void) {
while (IsOperatorControl()) {
dsLCD->PrintfLine(DriverStationLCD::kUser_Line2, "Voltage: %f",
signal.GetVoltage());
dsLCD->PrintfLine(DriverStationLCD::kUser_Line3, "CVoltage: %f",
signalControlVoltage.GetVoltage());
dsLCD->UpdateLCD();
Wait(0.005); // wait for a motor update time
}
}
示例7: DashBoardInput
void DashBoardInput() {
int i = 0;
GetWatchdog().SetEnabled(true);
while (IsAutonomous() && IsEnabled()) {
i++;
GetWatchdog().Feed();
dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "%f, %i",
driverStation->GetAnalogIn(1), i);
dsLCD->UpdateLCD();
}
}
示例8: OperatorControl
/**
* Runs the motors with arcade steering.
*/
void OperatorControl(void)
{
myRobot.SetSafetyEnabled(true);
while (IsOperatorControl())
{
myRobot.ArcadeDrive(stick.getAxisLeftY(), stick.getAxisLeftX()); // drive with arcade style (use left stick)
dsLCD->Printf(DriverStationLCD::kUser_Line2, 1, "Move: %f4", stick.getAxisLeftY());
dsLCD->Printf(DriverStationLCD::kUser_Line3, 1, "Rotate: %f4", stick.getAxisLeftX());
dsLCD->UpdateLCD();
Wait(0.005); // wait for a motor update time
}
}
示例9: DriveThenShootAuto
void DriveThenShootAuto() {
//initizlizes all parts of robot
pneumaticsControl->initialize();
shooterControl->initializeAuto();
driveControl.initializeAuto();
bool destinationPrevious = false;
bool autoShot = false; //true if autoShoot
//creates a timer for the ball grabber motors
Timer feeding;
bool started = false;
while (IsAutonomous() && IsEnabled()) {
GetWatchdog().Feed();
//drives forward to shooting point
bool atDestination = destinationPrevious || driveControl.autoPIDDrive2(); //autoDrive returns true when robot reached it's goal
if (atDestination) {
// The robot has reached the destination on the floor and is now ready to open and shoot
if (!started) {
started = true;
destinationPrevious = true;
//starts feeding-timer controls feeder motors so the ball doesn't get stuck
feeding.Start();
}
pneumaticsControl->ballGrabberExtend();
//waits for feeding to be done
if (feeding.Get() < 2.0) {//3.0 was
shooterControl->feed(true);
} else if (feeding.Get() >= 2.0) { // 3.0 was
shooterControl->feed(false);
feeding.Stop();
}
if (pneumaticsControl->ballGrabberIsExtended() && !autoShot) {
shooterControl->autoShoot();
dsLCD->PrintfLine(DriverStationLCD::kUser_Line1,
"The robot is(should be) shooting");
if (shooterControl->doneAutoFire()) {//works only after shoot is done firing
autoShot = true;
}
} else if (autoShot) {//runs only after shoot is done
dsLCD->PrintfLine(DriverStationLCD::kUser_Line1,
"AutoMode Finished");
}
}
dsLCD->PrintfLine(DriverStationLCD::kUser_Line2, "Feeder Time: %f",
feeding.Get());
dsLCD->UpdateLCD();
}
}
示例10: SebastianRobot
SebastianRobot(void) {
dsLCD = DriverStationLCD::GetInstance();
dsLCD->Clear();
dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "Sebastian V24.2");
dsLCD->UpdateLCD();
GetWatchdog().SetEnabled(false);
led0 = new Relay(2);
led1 = new Relay(3);
flashCount = 0;
led0->Set(Relay::kOff);
led1->Set(Relay::kOff);
isFlashing=false;
}
示例11: RobotDemo
RobotDemo(void)
{
motor = new Jaguar(9);
stick = new Joystick(1);
compressor = new Compressor(1, 1);
valve = new Solenoid(8);
// Construct the dashboard sender object used to send hardware state
// to the driver station
// dds = new DashboardDataSender();
dsLCD = DriverStationLCD::GetInstance();
dsLCD->Printf(DriverStationLCD::kUser_Line1, 1, "Plyboy test code: 6:46PM 1/2/2012");
dsLCD->UpdateLCD();
}
示例12: Disabled
void Disabled()
{
while(IsDisabled())
{
LEDLight->Set(Relay::kForward);
rpi->Read();
lcd->Clear();
lcd->Printf(DriverStationLCD::kUser_Line3, 1, "R: %i", rpi->GetMissingPacketcount());
lcd->Printf(DriverStationLCD::kUser_Line1, 1, "x: %i", rpi->GetXPos());
lcd->Printf(DriverStationLCD::kUser_Line2, 1, "y: %i", rpi->GetYPos());
lcd->UpdateLCD();
}
}
示例13: Print
void Print ()
{
if (PrintTime.Get() > PRINT_TIME)
{
lcd->Clear();
lcd->Printf(DriverStationLCD::kUser_Line1, 1, "Left Speed = %5.4f", PrimaryController.GetRawAxis(LEFT_JOYSTICK));
lcd->Printf(DriverStationLCD::kUser_Line2, 1, "Right Speed = %5.4f", PrimaryController.GetRawAxis(RIGHT_JOYSTICK));
lcd->Printf(DriverStationLCD::kUser_Line3, 1, "Charge State = %d", (int)Shooter.chargestate);
//lcd->Printf(DriverStationLCD::kUser_Line4, 1, "Collector speed= %d", Collector.CollectorSpeed());
lcd->UpdateLCD();
PrintTime.Reset();
PrintTime.Start();
}
}
示例14: OperatorControl
void OperatorControl(void) {
XboxController *xbox = XboxController::getInstance();
bool isEndGame = false;
GetWatchdog().SetEnabled(true);
_driveControl.initialize();
//_poleVaultControl.initialize();
shooterControl.InitializeOperator();
while (IsEnabled() && IsOperatorControl()) {
GetWatchdog().Feed();
dsLCD->Clear();
if (xbox->isEndGame()) {
isEndGame = !isEndGame;
}
if (!isEndGame) {
shooterControl.Run();
//_poleVaultControl.act();
_driveControl.act();
dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "Normal");
led0->Set((shooterControl.getLED1())?Relay::kOn: Relay::kOff);
led1->Set((shooterControl.getLED2())?Relay::kOn: Relay::kOff);
}
else {
shooterControl.RunEndGame();
//_poleVaultControl.actEndGame();
_driveControl.actEndGame();
dsLCD->PrintfLine(DriverStationLCD::kUser_Line1, "End Game");
flashCount--;
if (flashCount<=0){
isFlashing = !isFlashing;
flashCount=FLASHTIME;
}
led0->Set((isFlashing)?Relay::kOn: Relay::kOff);
led1->Set((isFlashing)?Relay::kOn: Relay::kOff);
}
// dsLCD->PrintfLine(DriverStationLCD::kUser_Line6, "Flash: %i", flashCount);
dsLCD->UpdateLCD();
Wait(WAIT_TIME); // wait for a motor update time
}
GetWatchdog().SetEnabled(false);
}
示例15: AutonomousPeriodic
void AutonomousPeriodic(void) {
m_autoPeriodicLoops++;
#if 0
static int Clock=0;
bool correct = DriveStick->GetButton(Joystick::kTriggerButton);
bool Reset = DriveStick->GetButton (Joystick::kTopButton);
ds->PrintfLine(DriverStationLCD::kUser_Line1, "%s %s",
correct ? "correct on" : "correct off",
Reset ? "Reset": "No Reset");
//ds->PrintfLine(DriverStationLCD::kUser_Line6, "%d %c %c", Clock, correct? "C" : "c", Reset? "R" : "r");
if (Reset)
Clock=0, MyRobot.ResetCounters();
else
{
++Clock;
if(Clock<=100) MyRobot.DriveRobot(1.0,0.0, ds, correct); // drive forward
else if (Clock<=200) MyRobot.DriveRobot(-1.0,0.0, ds, correct); // stop
else if (Clock<=250) MyRobot.DriveRobot(-1.0,0.0, ds, correct); // drive back halfway
else if (Clock<=300) MyRobot.DriveRobot(1.0,0.0, ds, correct); // stop
else
{
// Real teleop mode: use the JoySticks to drive
MyRobot.DriveRobot(DriveStick->GetY(),(DriveStick->GetX()), ds);
}
}
#endif
}