|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Smart Dashboard Sendable
Our team thinks that using commands is overkill for autonomous. We are trying to have SendableChooser take an int instead of a command? We are having problems having the code loaded to robot. Everything else except choosing the routine works. Is it possible for Sendable Chooser to use an int, since it takes in a T template? Thanks in advance.
Operating System: Linux Mint. Programming Language: C++ Code in Question: autoChooser->AddDefault("Do nothing (Default)", 0); autoChooser->AddObject("Drive", 1); autoChooser->AddObject("Shoot", 2); (P.S) This is my first post, so please give me feedback unlike the RoboRio when I deploy. ![]() |
|
#2
|
||||
|
||||
|
Re: Smart Dashboard Sendable
Quote:
|
|
#3
|
||||
|
||||
|
Re: Smart Dashboard Sendable
Commands are designed for autonomous. I would take another look at them.
|
|
#4
|
|||
|
|||
|
Re: Smart Dashboard Sendable
The robot crashes.
|
|
#5
|
|||
|
|||
|
Re: Smart Dashboard Sendable
No errors from the robot. Just no robot code at the Driver Station.
|
|
#6
|
|||
|
|||
|
Re: Smart Dashboard Sendable
We would have to redesign the whole autonomous structure, besides, since the SendableChooser takes in a Template T, why can't we pass in an int.
|
|
#7
|
||||
|
||||
|
Re: Smart Dashboard Sendable
You're really close to the right solution. Yes - you can use integers instead of Command* ... but SendableChooser (despite it being a templated class) doesn't like <int> as a type to use. Sigh. Dunno why. However, you can use an <int*> instead.
Code:
SendableChooser<int*> snd;
int auto1;
int auto2;
snd.AddDefault("default", &auto1);
snd.AddObject("Second", &auto2);
.....
// Later make the comparison
if (snd.GetSelected() == &auto1) // default one was chosen...
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|