![]() |
Problems -_-
so our robot has been fitted for talons and we had it working for jaguars and we switched them back to jaguars with jaguar code and isn't working like it should. anything visible,
Code:
package edu.wpi.first.wpilibj.templates;Code:
ant -f C:\\Users\\Sebastian\\Documents\\NetBeansProjects\\Project2012 deploy run |
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);Code:
RobotDrive drive = new RobotDrive(leftdrive , rightdrive);Code:
Jaguar leftdrive = new Jaguar(1); |
Re: Problems -_-
----Edit------
John beat me too it:) The post above is correct. For future reference you may want to look into handling exceptions in Java. This article in the Java documentation explains exceptions pretty well:http://docs.oracle.com/javase/tutori...efinition.html --------------- This is your problem: Quote:
Quote:
Quote:
|
Re: Problems -_-
is this any better
Code:
Joystick leftStick = new Joystick(1); |
Re: Problems -_-
OK, a few things...
You should create instances of the objects that you are going to use in the RobotInit method (or some other code that will only be executed once). In your original post at the top of the thread, you are creating the RobotDrive instances in TeleopInit() which means it won't be available in your Autonomous code since it hasn't been created yet. So I would move all the sensor and actuator creation code to the RobotInit method since that will only be called once per run of the robot. That ensures you won't be trying to recreate something or forgetting to create it on either the autonomous or teleop path. Also in the last post you did something like this: Jaguar leftdrive; Jaguar rightdrive; RobotDrive drive = new RobotDrive(leftdrive, rightdrive); In this case you are allocating two references to Jaguar objects, but you have not yet allocated the objects themselves. This is done using the new operator. So what you need is something like this: Jaguar leftDrive = new Jaguar(1); Jaguar rightDrive = new Jaguar(2); RobotDrive drive = new RobotDrive(leftDrive, rightDrive); Here the leftDrive and rightDrive Jaguar objects are allocated before using them to create the RobotDrive object. You also might want to look at RobotBuilder to create this part of the program since it will create the structure of the program for you with all this housekeeping already done in the generated program. There are some videos that describe how to use it in: http://www.youtube.com/user/bradamiller. and more documentation: http://wpilib.screenstepslive.com/s/3120/m/7882 Good luck! Brad |
Re: Problems -_-
Thank you :( we've been having large problems, we are all new to java and haven't touched code before so i really appreciate the help. I'm a hands on learner so once i learn it i can go off it and learn more. Thank you
|
| All times are GMT -5. The time now is 09:49. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi