|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Porting Talon SRX
Like I said, If I knew how to add my code to a reply you could see what I am doing. I did, in fact, write it just like that. (CANTalon motorDescirption = new CANTalon(x)
|
|
#2
|
||||
|
||||
|
Re: Porting Talon SRX
Quote:
|
|
#3
|
||||
|
||||
|
Re: Porting Talon SRX
Quote:
Ether is right, just copy/paste the important part. Or zip it up and email to support@crosstheroadelectronics.com, and I'll bounce it back to this thread. |
|
#4
|
|||
|
|||
|
Re: Porting Talon SRX
public class RobotMap {
public static SpeedController frontLeft; public static CANTalon frontRight; public static CANTalon backLeft; public static CANTalon backRight; public static RobotDrive robotDrive; public static void init(){ frontLeft = new CANTalon(3, 0); // frontRight = new CANTalon(4); // backLeft = new CANTalon(1); // backRight = new CANTalon(0); robotDrive = new RobotDrive(frontLeft, frontRight, backLeft, backRight); robotDrive.setSafetyEnabled(false); } } |
|
#5
|
|||||
|
|||||
|
Re: Porting Talon SRX
Quote:
|
|
#6
|
|||
|
|||
|
Re: Porting Talon SRX
I realize that they are commented out. Currently I am only calling on the single motor and it still says that it is a NullPointer
|
|
#7
|
||||
|
||||
|
Re: Porting Talon SRX
Yeah but robotDrive is still created and used, which uses all four underneath.
|
|
#8
|
|||||
|
|||||
|
Re: Porting Talon SRX
The null pointer exception is probably being thrown by the new RobotDrive() constructor, which has three null pointers. If you just want to test one motor, use a manipulator sample code rather than drive code.
|
|
#9
|
||||
|
||||
|
Re: Porting Talon SRX
Yep GeeTwo is right. frontRight is being created but you are not assigning it to a new'd object instance, so it stays null.
Remember frontRight is just a reference. In java you must assign to the return of a new operator to actually create the relevent object. If you put a breakpoint just before the NullException occurs and add frontRight to your watch list, you'll see it's null. |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|