|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Code running slow
We've set up our robot's code using java to run Jaguar motor controllers via a DriveTrain subsystem. Thing is, the DriveTrain's execute() method is only being called once every 10-15 seconds. This means that we push the joystick forward, wait a few seconds, and the wheel starts spinning, then, when we release the joystick, we have to wait another 10-15 seconds for it to update again to stop. If you need code/other information, let me know and I'll post it. Thanks in advance.
|
|
#2
|
||||
|
||||
|
Re: Code running slow
What format of code are you using? The command-based?
|
|
#3
|
|||
|
|||
|
Re: Code running slow
Yes, command-based.
|
|
#4
|
||||
|
||||
|
Re: Code running slow
Have you checked to see if its a networking issue, are you losing packets?
|
|
#5
|
|||
|
|||
|
Re: Code running slow
We put some print statements next to the command statements; they're running just as slowly on the computer, so I don't think it's a network thing. Also, he computer is wired directly to the dlink at the moment (wireless cut out for some reason). If you have other suggestions on how else to test the network, let me know and I'll try it.
|
|
#6
|
||||
|
||||
|
Re: Code running slow
You don't have two driverstations open do you?
This happens sometimes when there's one open on the driver account and one open on the developer account. |
|
#7
|
|||
|
|||
|
Re: Code running slow
No, I even restarted the computer just to make sure. Only one driver station running. We're going to try reimaging the cRIO without the CAN drivers to see if that is having some effect.
|
|
#8
|
|||
|
|||
|
Re: Code running slow
We tried running it without the CAN plugin, no luck, we're reimaging the entire thing.
|
|
#9
|
|||
|
|||
|
Re: Code running slow
The commands are run by repeated calls to Scheduler.run(). Make sure that it's being called in the teleopPeriodic() or autonomousPeriodic() methods in the main robot project like this:
Code:
public void teleopInit() {
// This makes sure that the autonomous stops running when
// teleop starts running. If you want the autonomous to
// continue until interrupted by another command, remove
// this line or comment it out.
if (autonomousCommand != null) autonomousCommand.cancel();
}
/**
* This function is called periodically during operator control
*/
public void teleopPeriodic() {
Scheduler.getInstance().run();
}
http://wpilib.screenstepslive.com/s/...and-subsystems Brad |
|
#10
|
|||
|
|||
|
Re: Code running slow
We have the Scheduler.getInstance().run() in the code already. I tried the SmartDashboard thing, its says it's running. I have print statements in the execute() method, they running, but only once every 10-15 seconds.
|
|
#11
|
||||
|
||||
|
Re: Code running slow
Try deploying a blank SimpleRobot project with a print statement in the operator control method
|
|
#12
|
|||
|
|||
|
Re: Code running slow
Quote:
Brad |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|