Thread: CAN Jaguar
View Single Post
  #3   Spotlight this post!  
Unread 31-01-2015, 00:10
virtuald's Avatar
virtuald virtuald is offline
RobotPy Guy
AKA: Dustin Spicuzza
FRC #1418 (), FRC #1973, FRC #4796, FRC #6367 ()
Team Role: Mentor
 
Join Date: Dec 2008
Rookie Year: 2003
Location: Boston, MA
Posts: 1,043
virtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant futurevirtuald has a brilliant future
Re: CAN Jaguar

Quote:
Originally Posted by Pramizle View Post
My team is having extreme difficulty in regards to using the CAN Jaguar class. The current code that we are using to initialize it is:

self.jaguar = wpilib.CANJaguar(1,4)

From this line of code we get an error saying that two values are needed but that the code is entering in three.

Please help. We are completely lost and are losing hair as well as sleep.
The error message is correct. In python there is an implicit first parameter called 'self', so when you pass it 2 parameters, you actually passed it three.

Instead, you should initialize the CANJaguar like so:

Code:
self.jaguar = wpilib.CANJaguar(1)
As referenced in the RobotPy CANJaguar documentation, there's only a single parameter you need to pass to the CANJaguar object, which is the deviceNumber.

Make sure that you're using the very latest version of RobotPy, as the CANJaguar object has had a lot of bugfixes this season!

Quote:
Originally Posted by ozrien View Post
did you mean...
self.jaguar = new CANJaguar(1);
... your using java right?

Also I only see one param for the constructor. What is '4' supposed to be. I assume '1' is the device ID.
This is the python forum.
__________________
Maintainer of RobotPy - Python for FRC
Creator of pyfrc (Robot Simulator + utilities for Python) and pynetworktables/pynetworktables2js (NetworkTables for Python & Javascript)

2017 Season: Teams #1973, #4796, #6369
Team #1418 (remote mentor): Newton Quarterfinalists, 2016 Chesapeake District Champion, 2x Innovation in Control award, 2x district event winner
Team #1418: 2015 DC Regional Innovation In Control Award, #2 seed; 2014 VA Industrial Design Award; 2014 Finalists in DC & VA
Team #2423: 2012 & 2013 Boston Regional Innovation in Control Award


Resources: FIRSTWiki (relaunched!) | My Software Stuff
Reply With Quote