|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Robot getting disabled?
I just managed to deploy the code to the cRIO. For some reason, my sample code doesn't seems to be firing.
Code:
package edu.wpi.first.wpilibj.templates;
import edu.wpi.first.wpilibj.SimpleRobot;
import edu.wpi.first.wpilibj.RobotDrive;
import edu.wpi.first.wpilibj.Timer;
/**
* The VM is configured to automatically run this class, and to call the
* functions corresponding to each mode, as described in the SimpleRobot
* documentation. If you change the name of this class or the package after
* creating this project, you must also update the manifest file in the resource
* directory.
*/
public class RobotTemplate extends SimpleRobot {
/**
* This function is called once each time the robot enters autonomous mode.
*/
public void autonomous() {
RobotDrive drive = new RobotDrive(1, 2);
for (int i=0; i<4; i++){
System.out.println("Running drive " + i);
drive.drive(0.5, 0);
Timer.delay(2);
}
}
/**
* This function is called once each time the robot enters operator control.
*/
public void operatorControl() {
}
}
Code:
[cRIO] Default robotInit() method running, consider providing your own [cRIO] Default disabled() method running, consider providing your own Also BTW how do I compile on linux and deploy on windows? (I'm fine with ant) |
|
#2
|
||||
|
||||
|
Re: Robot getting disabled?
I don't see what the problem is - you didn't define the methods robotInit() or disabled(), so the default ones are used, which just print the messages you're seeing. From what I'm seeing, the robot shouldn't do anything until autonomous is enabled, and then it drive forward at half power for 8 seconds.
As for compiling on linux and deploying on windows, I believe that deploying simply entails FTPing onto the robot (which is simpler than it sounds, you just use windows explorer) and putting the correct file in the correct place. So, once you figure out the correct file, you can just copy that from linux to windows. |
|
#3
|
|||
|
|||
|
Re: Robot getting disabled?
How would I enable autonomous mode?
|
|
#4
|
||||
|
||||
|
Re: Robot getting disabled?
Once the code is loaded onto the robot, you start up the driver station, press the autonomous switch, then press enable.
Check out here for more info about how to "do" the control system. The "installing the driver station software on a non-classmate" may be helpful if you don't have it. This may also be helpful. |
|
#5
|
||||
|
||||
|
Re: Robot getting disabled?
As a side note, I recommend making drive an instance variable so that it can be accessed from other methods as well.
|
|
#6
|
|||
|
|||
|
Re: Robot getting disabled?
we usually use iterative mode, but isnt there supposed to be a main method that calls the mode? Making a guess here, being that its been a while since ive looked at simplerobot
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|