Go to Post Darn IFI and AndyMark for making quality products! :) - Gabe [more]
Home
Go Back   Chief Delphi > Technical > Programming > Python
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rating: Thread Rating: 3 votes, 5.00 average. Display Modes
  #1   Spotlight this post!  
Unread 30-01-2015, 20:59
Pramizle Pramizle is offline
Registered User
FRC #3145
 
Join Date: Jan 2015
Location: United States
Posts: 5
Pramizle is an unknown quantity at this point
CAN Jaguar

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.
Reply With Quote
  #2   Spotlight this post!  
Unread 30-01-2015, 22:15
ozrien's Avatar
ozrien ozrien is offline
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 521
ozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant future
Re: CAN Jaguar

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.

Last edited by ozrien : 30-01-2015 at 22:18.
Reply With Quote
  #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,040
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
  #4   Spotlight this post!  
Unread 31-01-2015, 01:38
NegaNexus NegaNexus is offline
Registered User
AKA: Thys Ballard
FRC #2130 (Alpha+)
Team Role: Programmer
 
Join Date: Oct 2012
Rookie Year: 2012
Location: Coeur d'Alene, Idaho
Posts: 16
NegaNexus is an unknown quantity at this point
Re: CAN Jaguar

I am also from the TeraViks. I knew that 'self' was implied, but how does one specify the use of the different Control Modes without this method.
Reply With Quote
  #5   Spotlight this post!  
Unread 31-01-2015, 01:56
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,040
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

I imagine you'd probably want to call the appropriate method. Maybe... changeControlMode?

To be fair, the documentation is a bit confusing in its format. The ControlMode displayed at the top is just enumerating what types are available, and does not indicate that it's a parameter you can pass to the constructor.
__________________
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
  #6   Spotlight this post!  
Unread 31-01-2015, 16:00
ozrien's Avatar
ozrien ozrien is offline
Omar Zrien
AKA: Omar
no team
Team Role: Mentor
 
Join Date: Sep 2006
Rookie Year: 2003
Location: Sterling Heights, MI
Posts: 521
ozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant futureozrien has a brilliant future
Re: CAN Jaguar

Quote:
Originally Posted by virtuald View Post
This is the python forum.
Haha oops, sorry Dustin...doing to many things at once. I'll shut up now...
Reply With Quote
  #7   Spotlight this post!  
Unread 01-02-2015, 20:06
NegaNexus NegaNexus is offline
Registered User
AKA: Thys Ballard
FRC #2130 (Alpha+)
Team Role: Programmer
 
Join Date: Oct 2012
Rookie Year: 2012
Location: Coeur d'Alene, Idaho
Posts: 16
NegaNexus is an unknown quantity at this point
Re: CAN Jaguar

Now, when I try this:

Code:
self.jaguar = wpilib.CANJaguar(1)
self.jaguar.setVoltageModeEncoder(360)
self.jaguar.enableControl()
I get:
Code:
raise frccan.CANMessageNotFound("message not found")
hal.exceptions.CANMessageNotFound: message not found
How do I prevent this?
Reply With Quote
  #8   Spotlight this post!  
Unread 01-02-2015, 23:47
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,040
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

That sounds like a bug in RobotPy's WPILib. Do you have a stack trace you can paste?
__________________
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
  #9   Spotlight this post!  
Unread 01-02-2015, 23:55
NegaNexus NegaNexus is offline
Registered User
AKA: Thys Ballard
FRC #2130 (Alpha+)
Team Role: Programmer
 
Join Date: Oct 2012
Rookie Year: 2012
Location: Coeur d'Alene, Idaho
Posts: 16
NegaNexus is an unknown quantity at this point
Re: CAN Jaguar

Code:
16:07:23:251 INFO    : wpilib              : WPILib version 2015.0.8
16:07:23:253 INFO    : wpilib              : HAL base version 2015.0.8; roboRIO platform version 2015.0.8
16:07:23:254 INFO    : wpilib              : HAL library version jenkins-stable-2015.326
16:07:23:549 WARNING : robotpy             : Robots don't quit!
16:07:23:551 ERROR   : robotpy             : ---> The startCompetition() method (or methods called by it) should have handled the exception.
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/site-packages/wpilib/robotbase.py", line 185, in main
    robot.startCompetition()
  File "/usr/local/lib/python3.4/site-packages/wpilib/iterativerobot.py", line 75, in startCompetition
    self.robotInit()
  File "robot.py", line 21, in robotInit
    self.jaguar = wpilib.CANJaguar(1)
  File "/usr/local/lib/python3.4/site-packages/wpilib/canjaguar.py", line 293, in __init__
    raise frccan.CANMessageNotFound("message not found")
hal.exceptions.CANMessageNotFound: message not found


Locals at innermost frame:

{ 'data': [225, 31, 0, 0],
  'deviceNumber': 1,
  'i': 49,
  'receivedFirmwareVersion': True,
  'self': <wpilib.canjaguar.CANJaguar object at 0x42c2c810>}
Reply With Quote
  #10   Spotlight this post!  
Unread 02-02-2015, 00:12
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,040
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

Interesting. That error message is terrible -- but the code seems to indicate that it can't find the CANJaguar. Are you sure ID 1 is the right ID for the Jaguar -- or that perhaps there's another device on ID 1? Most of the time it is recommended to not use ID 1, as that's the default ID for a lot of devices.
__________________
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
  #11   Spotlight this post!  
Unread 02-02-2015, 01:46
NegaNexus NegaNexus is offline
Registered User
AKA: Thys Ballard
FRC #2130 (Alpha+)
Team Role: Programmer
 
Join Date: Oct 2012
Rookie Year: 2012
Location: Coeur d'Alene, Idaho
Posts: 16
NegaNexus is an unknown quantity at this point
Re: CAN Jaguar

Though I can't truly verify it, I checked it today and it said on the web interface that the PCM was assigned to Device ID #0 and the PDP was Device #2 and the Jaguar was assigned to Device #1. I will be back there on Tuesday.
Reply With Quote
  #12   Spotlight this post!  
Unread 02-02-2015, 07:05
RufflesRidge RufflesRidge is offline
Registered User
no team
 
Join Date: Jan 2012
Location: USA
Posts: 988
RufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant futureRufflesRidge has a brilliant future
Re: CAN Jaguar

Quote:
Originally Posted by NegaNexus View Post
Though I can't truly verify it, I checked it today and it said on the web interface that the PCM was assigned to Device ID #0 and the PDP was Device #2 and the Jaguar was assigned to Device #1. I will be back there on Tuesday.
If you do find the PDP is ID = 2, I would change the PDP back to ID = 0 in case you want to use any of the CAN features of it. ID = 0 is all that is currently supported in C++, Java and Python: http://robotpy.readthedocs.org/en/la...tionPanel.html

Devices of different types do not conflict so having the PCM and PDP both at 0 is not an issue.

Another thing to check would be your CAN error counts on the last tab on the left side of the DS.
Reply With Quote
  #13   Spotlight this post!  
Unread 08-02-2015, 00:45
NegaNexus NegaNexus is offline
Registered User
AKA: Thys Ballard
FRC #2130 (Alpha+)
Team Role: Programmer
 
Join Date: Oct 2012
Rookie Year: 2012
Location: Coeur d'Alene, Idaho
Posts: 16
NegaNexus is an unknown quantity at this point
Re: CAN Jaguar

A week ago it decided to work. One of the problems was that the Jaguar Device ID # couldn't ever be changed. We pressed the user button within 5 seconds. We just mucked with stuff, and eventually, the Jaguar worked, though we still were unable to change the ID.

I don't have any idea why it did that, but I just know to muck around with some semblance of method from what I learned and it might work.
Reply With Quote
  #14   Spotlight this post!  
Unread 16-02-2015, 19:04
Pramizle Pramizle is offline
Registered User
FRC #3145
 
Join Date: Jan 2015
Location: United States
Posts: 5
Pramizle is an unknown quantity at this point
Re: CAN Jaguar

Thank you so much for all of your help. We were able to get it moving and moved on to bigger and better things... Like using PID
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 19:50.

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