|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools |
Rating:
|
Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
||||
|
||||
|
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. |
|
#3
|
||||
|
||||
|
Re: CAN Jaguar
Quote:
Instead, you should initialize the CANJaguar like so: Code:
self.jaguar = wpilib.CANJaguar(1) 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:
![]() |
|
#4
|
|||
|
|||
|
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.
|
|
#5
|
||||
|
||||
|
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. |
|
#6
|
||||
|
||||
|
Re: CAN Jaguar
Haha oops, sorry Dustin...doing to many things at once. I'll shut up now...
|
|
#7
|
|||
|
|||
|
Re: CAN Jaguar
Now, when I try this:
Code:
self.jaguar = wpilib.CANJaguar(1) self.jaguar.setVoltageModeEncoder(360) self.jaguar.enableControl() Code:
raise frccan.CANMessageNotFound("message not found")
hal.exceptions.CANMessageNotFound: message not found
|
|
#8
|
||||
|
||||
|
Re: CAN Jaguar
That sounds like a bug in RobotPy's WPILib. Do you have a stack trace you can paste?
|
|
#9
|
|||
|
|||
|
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>}
|
|
#10
|
||||
|
||||
|
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.
|
|
#11
|
|||
|
|||
|
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.
|
|
#12
|
|||
|
|||
|
Re: CAN Jaguar
Quote:
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. |
|
#13
|
|||
|
|||
|
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. |
|
#14
|
|||
|
|||
|
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
![]() |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|