Go to Post You really can't have a bad year. The only way you can is to come out of it and not learn anything. - Dan Petrovic [more]
Home
Go Back   Chief Delphi > Technical > Programming > Java
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 22-09-2016, 09:59
PM_ME_UR_ROBOT PM_ME_UR_ROBOT is offline
Registered User
FRC #4206
 
Join Date: Sep 2016
Location: Texas
Posts: 7
PM_ME_UR_ROBOT is an unknown quantity at this point
Missing CANTalon class

Obligatory "I'm not very experienced with Java nor programming robots in FRC," so feel free to be as critical as you want, everything is a learning process after all.

We've recently decided to use CAN on our robot to connect our Talon SRX controllers, only problem is that the original code we had done used the Talon class to initialize the speed controllers to build our RobotDrive. No big deal though, we just have to change Talon to CANTalon and remove the port numbers from the constructor since CAN doesn't use PWM and -- oh dear why is there so much red on my screen now?

So the errors came from our program not having CANTalon imported into it, but when I try to import it using the following path, it says it does not exist:

import edu.wpi.first.wpilibj.CANTalon;

We're really not sure how to resolve this issue, all our other classes have imported just fine, but this one just doesn't seem to exist. There isn't much documentation saying I'd have to install some other plugins or update to a certain version for it to be available, so what am I doing wrong?

Thanks in advance to anyone reading.

tl;dr
edu.wpi.first.wpilibj.CANTalon isn't being imported because it's missing, how can I make that not happen?
Reply With Quote
  #2   Spotlight this post!  
Unread 22-09-2016, 10:32
Bkeeneykid's Avatar
Bkeeneykid Bkeeneykid is offline
#wheatcoastneatcoast
AKA: Devin Keeney
FRC #1982 (Cougar Robotics); Season Long Fantasy FIRST (F3)
Team Role: Student
 
Join Date: Feb 2015
Rookie Year: 2015
Location: Lenexa, Kansas
Posts: 307
Bkeeneykid has much to be proud ofBkeeneykid has much to be proud ofBkeeneykid has much to be proud ofBkeeneykid has much to be proud ofBkeeneykid has much to be proud ofBkeeneykid has much to be proud ofBkeeneykid has much to be proud ofBkeeneykid has much to be proud ofBkeeneykid has much to be proud of
Re: Missing CANTalon class

As always, it really helps if we can see your full code. There could be confounding variables everywhere, and we can't see all the ways things can change. Can you perhaps upload it to GitHub?

Also, make sure you are using CANTalon, not CANTalonSRX, as that class was removed in 2016.
__________________

F4 Network Website Designer

2010-2012: A Whole Buncha FLL Teams; Team Spirit, Gracious Professionalism Award winner
2015-Current: FRC 1982, Captain, Electrical Lead
Beginning FIRST Volunteer

Moderator on the FIRSTwiki
Reply With Quote
  #3   Spotlight this post!  
Unread 22-09-2016, 11:11
Tyler Scheuble Tyler Scheuble is offline
Programming Lead
FRC #2471 (Team Mean Machine)
Team Role: Programmer
 
Join Date: Feb 2014
Rookie Year: 2013
Location: Vancouver, WA
Posts: 15
Tyler Scheuble is an unknown quantity at this point
Re: Missing CANTalon class

Side note: Are your CANTalon constructors empty? If you removed the ports and didn't replace it with their integer CAN IDs then that would cause a compile-time error on its own.

Last edited by Tyler Scheuble : 22-09-2016 at 11:14.
Reply With Quote
  #4   Spotlight this post!  
Unread 22-09-2016, 11:52
PM_ME_UR_ROBOT PM_ME_UR_ROBOT is offline
Registered User
FRC #4206
 
Join Date: Sep 2016
Location: Texas
Posts: 7
PM_ME_UR_ROBOT is an unknown quantity at this point
Re: Missing CANTalon class

Quote:
Originally Posted by Bkeeneykid View Post
As always, it really helps if we can see your full code. There could be confounding variables everywhere, and we can't see all the ways things can change. Can you perhaps upload it to GitHub?

Also, make sure you are using CANTalon, not CANTalonSRX, as that class was removed in 2016.
I wasn't able to push our project to GitHub for some reason, it kept giving errors so I just resorted to compressing it and putting the zipped file up for download. Sorry about that inconvenience.

https://github.com/carson-fitzgibbon/Robotics-Test

As for the CANTalon vs CANTalonSRX thing, we are trying to use CANTalon.

Quote:
Originally Posted by Tyler Scheuble View Post
Side note: Are your CANTalon constructors empty? If you removed the ports and didn't replace it with their integer CAN IDs then that would cause a compile-time error on its own.
I made sure to give each constructor their own unique integer from 0 to 3 since we have four motor controllers. Problem isn't so much with the construction as it is the import not being found :/
Reply With Quote
  #5   Spotlight this post!  
Unread 22-09-2016, 11:57
mikets's Avatar
mikets mikets is offline
Software Engineer
FRC #0492 (Titan Robotics)
Team Role: Mentor
 
Join Date: Jan 2010
Rookie Year: 2008
Location: Bellevue, WA
Posts: 667
mikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of lightmikets is a glorious beacon of light
Re: Missing CANTalon class

Quote:
Originally Posted by PM_ME_UR_ROBOT View Post
I made sure to give each constructor their own unique integer from 0 to 3 since we have four motor controllers. Problem isn't so much with the construction as it is the import not being found :/
The CAN ID is not a random number. It needs to match the ID you assigned to the actual motor controller. I don't think 0 is a valid CAN ID. You need to connect to the web interface of the RoboRIO and check the CAN ID of each CANTalon motor controller.
__________________
Reply With Quote
  #6   Spotlight this post!  
Unread 22-09-2016, 12:13
astronautlevel's Avatar
astronautlevel astronautlevel is offline
Registered User
FRC #2537
 
Join Date: Feb 2016
Location: Maryland
Posts: 4
astronautlevel is an unknown quantity at this point
Re: Missing CANTalon class

Unfortunately I'm not in a position to test it right now, but try removing
Code:
import edu.wpi.first.wpilibj.*;
Importing everything in the wpilibj package is bad practice, and it may be the issue here (as by the time you import CANTalon, it's already "imported" due to the wild card)
Reply With Quote
  #7   Spotlight this post!  
Unread 22-09-2016, 12:21
PM_ME_UR_ROBOT PM_ME_UR_ROBOT is offline
Registered User
FRC #4206
 
Join Date: Sep 2016
Location: Texas
Posts: 7
PM_ME_UR_ROBOT is an unknown quantity at this point
Re: Missing CANTalon class

Quote:
Originally Posted by astronautlevel View Post
Unfortunately I'm not in a position to test it right now, but try removing
Code:
import edu.wpi.first.wpilibj.*;
Importing everything in the wpilibj package is bad practice, and it may be the issue here (as by the time you import CANTalon, it's already "imported" due to the wild card)
Thanks for the suggestion, I went ahead and manually imported all necessary items for this file, but it still did not resolve the issue. NetBeans still does not recognize CANTalon as a valid class to import, even after updating and restarting the IDE.
Reply With Quote
  #8   Spotlight this post!  
Unread 22-09-2016, 12:39
AllenGregoryIV's Avatar
AllenGregoryIV AllenGregoryIV is offline
Engineering Coach
AKA: Allen "JAG" Gregory
FRC #3847 (Spectrum)
Team Role: Coach
 
Join Date: Jul 2008
Rookie Year: 2003
Location: Texas
Posts: 2,549
AllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond repute
Send a message via AIM to AllenGregoryIV
Re: Missing CANTalon class

Quote:
Originally Posted by PM_ME_UR_ROBOT View Post
Thanks for the suggestion, I went ahead and manually imported all necessary items for this file, but it still did not resolve the issue. NetBeans still does not recognize CANTalon as a valid class to import, even after updating and restarting the IDE.
Are you using the most updated WPILIB? The recommended IDE is eclipse so you would have had to follow special instructions to get it working with netbeans. If you are using an old WPILIB from the cRIO days that wouldn't have a CANTalon class. From your build.xml file I believe you are, all the old sunspot references are still in there.
__________________

Team 647 | Cyber Wolf Corps | Alumni | 2003-2006 | Shoemaker HS
Team 2587 | DiscoBots | Mentor | 2008-2011 | Rice University / Houston Food Bank
Team 3847 | Spectrum | Coach | 2012-20... | St Agnes Academy
LRI | Alamo Regional | 2014-20...
"Competition has been shown to be useful up to a certain point and no further, but cooperation, which is the thing we must strive for today, begins where competition leaves off." - Franklin D. Roosevelt
Reply With Quote
  #9   Spotlight this post!  
Unread 22-09-2016, 13:32
GoldenGollem's Avatar
GoldenGollem GoldenGollem is offline
Java Programmer
FRC #2509 (Hutchinson Tigerbots)
Team Role: Programmer
 
Join Date: Dec 2015
Rookie Year: 2015
Location: Minnesota
Posts: 24
GoldenGollem is an unknown quantity at this point
Re: Missing CANTalon class

Quote:
Originally Posted by mikets View Post
The CAN ID is not a random number. It needs to match the ID you assigned to the actual motor controller. I don't think 0 is a valid CAN ID. You need to connect to the web interface of the RoboRIO and check the CAN ID of each CANTalon motor controller.
0 is a valid CAN ID and is the defult of most Talon SRX's unless changed in the RoboRIO interface.

Also try it with eclipse. From my understanding NetBeans works only with older versions of WPILIB and the CRIO. The version of WPILIB that netbeans uses I don't believe to have been updated.
__________________
GoldenGollem -Hutchinson Tigerbots 2509
2015 - Mini-MN Regional 2nd Place Finalist
2016 - Mini-MN Regional 1st Place Finalist
Reply With Quote
  #10   Spotlight this post!  
Unread 22-09-2016, 16:40
PM_ME_UR_ROBOT PM_ME_UR_ROBOT is offline
Registered User
FRC #4206
 
Join Date: Sep 2016
Location: Texas
Posts: 7
PM_ME_UR_ROBOT is an unknown quantity at this point
Re: Missing CANTalon class

Quote:
Originally Posted by AllenGregoryIV View Post
Are you using the most updated WPILIB? The recommended IDE is eclipse so you would have had to follow special instructions to get it working with netbeans. If you are using an old WPILIB from the cRIO days that wouldn't have a CANTalon class. From your build.xml file I believe you are, all the old sunspot references are still in there.
I installed Eclipse and I think the problem is fixed, but I can't tell because it has no real time error marking like NetBeans, so it won't show me missing imports or other errors. Know how to fix this? If it starts working that will completely answer my question.
Reply With Quote
  #11   Spotlight this post!  
Unread 22-09-2016, 17:43
AllenGregoryIV's Avatar
AllenGregoryIV AllenGregoryIV is offline
Engineering Coach
AKA: Allen "JAG" Gregory
FRC #3847 (Spectrum)
Team Role: Coach
 
Join Date: Jul 2008
Rookie Year: 2003
Location: Texas
Posts: 2,549
AllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond reputeAllenGregoryIV has a reputation beyond repute
Send a message via AIM to AllenGregoryIV
Re: Missing CANTalon class

Quote:
Originally Posted by PM_ME_UR_ROBOT View Post
I installed Eclipse and I think the problem is fixed, but I can't tell because it has no real time error marking like NetBeans, so it won't show me missing imports or other errors. Know how to fix this? If it starts working that will completely answer my question.
Did you install the WPILIB plugins? It should do it. Follow the instructions at screenstepslive. You will need to make a new WPILIB project.
__________________

Team 647 | Cyber Wolf Corps | Alumni | 2003-2006 | Shoemaker HS
Team 2587 | DiscoBots | Mentor | 2008-2011 | Rice University / Houston Food Bank
Team 3847 | Spectrum | Coach | 2012-20... | St Agnes Academy
LRI | Alamo Regional | 2014-20...
"Competition has been shown to be useful up to a certain point and no further, but cooperation, which is the thing we must strive for today, begins where competition leaves off." - Franklin D. Roosevelt
Reply With Quote
  #12   Spotlight this post!  
Unread 22-09-2016, 19:34
PM_ME_UR_ROBOT PM_ME_UR_ROBOT is offline
Registered User
FRC #4206
 
Join Date: Sep 2016
Location: Texas
Posts: 7
PM_ME_UR_ROBOT is an unknown quantity at this point
Re: Missing CANTalon class

Quote:
Originally Posted by AllenGregoryIV View Post
Did you install the WPILIB plugins? It should do it. Follow the instructions at screenstepslive. You will need to make a new WPILIB project.
After a very long series of frustrating events, I figured out the issue. I went directly from NetBeans to Eclipse, which created problems that Eclipse didn't like (no build library or whatever it's called).

I recreated our project in Eclipse and copied the code over and now the error marking works, but more importantly: CANTalon works!

Thank you all for the help.
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 10:47.

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