View Single Post
  #2   Spotlight this post!  
Unread 29-01-2017, 13:16
bob.wolff68's Avatar
bob.wolff68 bob.wolff68 is offline
Da' Mentor Man
FRC #1967
Team Role: Mentor
 
Join Date: Jan 2012
Rookie Year: 2007
Location: United States
Posts: 158
bob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nicebob.wolff68 is just really nice
Re: SendableChoosers are causing me grief!

Quote:
Originally Posted by ebernerrd View Post
I've actually gone and fixed these issues. When I write the code as you did, I get an error on SmartDashboard:utData("Auto modes", &autonomousChooser);

The error I have is:

invalid arguments
Candidates are:
void PutData(llvm::StringRef, frc::Sendable *)
void PutData(frc::NamedSendable *)
autonomousChoose was defined as a pointer already "SendableChooser<Command *> *autonomousChooser"

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()
__________________
~~~~~~~~~~~~~~~~~~~
Bob Wolff - Software from the old-school
Mentor / C / C++ guy
Team 1967 - The Janksters - San Jose, CA
Reply With Quote