Go to Post Everyone here inspires each other and helps them out. That's why FIRST is amazing. - tiffany34990 [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 06-03-2015, 00:14
kylelanman's Avatar
kylelanman kylelanman is offline
Programming Mentor
AKA: Kyle
FRC #2481 (Roboteers)
Team Role: Mentor
 
Join Date: Feb 2008
Rookie Year: 2007
Location: Tremont Il
Posts: 185
kylelanman is a name known to allkylelanman is a name known to allkylelanman is a name known to allkylelanman is a name known to allkylelanman is a name known to allkylelanman is a name known to all
Re: Use of SmartDashboard::GetString()

A better solution would be to use a SenableChooser. The following is for command based but sendable chooser uses void* so the sky is the limit as to what you send. You can send a command, number, or some other pointer.

Code:
class Robot : public IterativeRobot
{
private:
    SendableChooser* autoChooser;

void RobotInit {
    autoChooser = new SendableChoose();
    autoChooser->AddDefault("Auto 1", new Auto1Command());
    autoChooser->AddObject("Auto 2", new Auto2Command());
    autoChooser->AddObject("Auto 3", new Auto3Command());
    SmartDashboard::PutData"Auto Chooser", autoChooser;
}

void AutonomousInit() {
    Command* auton = (Command*)autoChooser->GetSelected();
    if (auton) {
        auto->Start();
    }
}

void TeleopInit() {
    if (auton) {
        auto->Cancel();
    }
}
};
There is more documentation here.
http://wpilib.screenstepslive.com/s/...smartdashboard
__________________
"May the coms be with you"

Is this a "programming error" or a "programmer error"?

Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 09:57.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi