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.:slight_smile:

We are having problems having the code loaded to robot

What problems, exactly? Does the code not compile? Does the robot program crash?

Commands are designed for autonomous. I would take another look at them.

The robot crashes.

No errors from the robot. Just no robot code at the Driver Station.

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.

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.


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...


It’s a matter of comparing the addresses of the choices since the SendableChooser template really wants to operate on pointers for some reason. Haven’t looked at their code to figure why.