Thread: Problems -_-
View Single Post
  #2   Spotlight this post!  
Unread 18-01-2013, 15:22
Johnbot's Avatar
Johnbot Johnbot is offline
Es Brokein!
AKA: John Westhoff
FRC #4791 (Pandroids)
Team Role: Mentor
 
Join Date: Feb 2012
Rookie Year: 2010
Location: Horsham, PA
Posts: 92
Johnbot is just really niceJohnbot is just really niceJohnbot is just really niceJohnbot is just really niceJohnbot is just really nice
Re: Problems -_-

In the constructor for RobotDrive, if you pass it numbers, it will construct Jaguars for you.
So, but constructing your own, you created two Jaguar objects for the Jaguar on PWM 1, but you can only have one object for each Jaguar, so it crashed.

Just replace
Code:
RobotDrive drive = new RobotDrive(1, 2);
with
Code:
RobotDrive drive = new RobotDrive(leftdrive , rightdrive);
Edit: Also, if you never use leftdrive or rightdrive, you can just remove the code that says
Code:
Jaguar leftdrive = new Jaguar(1);
       Jaguar rightdrive = new Jaguar(2);
because the RobotDrive constructor will make them for you, though I like having the Jaguar/Victor/Talon objects declared, it just looks nicer.
__________________

2011-2014 - FRC 2607 - Student
2012-2012 - FLL 2249 - Coach
2015- ???? - FRC 4791 - Mentor

Last edited by Johnbot : 18-01-2013 at 15:28.
Reply With Quote