![]() |
SendableChoosers are causing me grief!
Hello! My name is Eric, and I am the lead programmer for team 3236. This is my first year, and so far, things are going good!
I am attempting to add radio buttons to my SmartDashboard so that I can choose the autonomous mode to run at a specific time. I am running it through a Command based system, as it seemed the easiest and most logical to my head. In Eclipse, functions like "AddDefault" or "AddObject" do not work when written like this: Code:
private:Code:
private:I know that this is not because of an issue of "AutoDefault()" not existing, or anything along those lines. If anyone has a possible solution or explanation, we'd greatly appreciate it! Thank you! -Eric |
Re: SendableChoosers are causing me grief!
This worked for us:
In Robot.h Code:
private:Code:
Robot::RobotInit() {Best Wishes, Drew |
Re: SendableChoosers are causing me grief!
Are you including any other libraries? I get some errors with that setup.
Thanks for the quick reply btw! |
Re: SendableChoosers are causing me grief!
I'm including
#include "WPILib.h" #include "RobotMap.h" in Robot.h and #include "Robot.h" in Robot.cpp What is the error your getting? |
Re: SendableChoosers are causing me grief!
Quote:
|
Re: SendableChoosers are causing me grief!
Quote:
I've actually gone and fixed these issues. When I write the code as you did, I get an error on SmartDashboard::PutData("Auto modes", &autonomousChooser); The error I have is: invalid arguments Candidates are: void PutData(llvm::StringRef, frc::Sendable *) void PutData(frc::NamedSendable *) |
Re: SendableChoosers are causing me grief!
Quote:
while the other team's example was NOT a pointer (no * before the variable name). As such, PutData is looking for a pointer to be sent to it... so you should not preceed it with & but instead just give the name of the variable (the pointer). The other team needs the & in order to give an address (pointer) to PutData. I believe if you remove the & you'll be good there. BTW, don't forget to 'new' any pointers before using them and 'delete' them at the end in some destructor like ~Robot() |
| All times are GMT -5. The time now is 09:56. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi