![]() |
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.
|
Re: Code running slow
What format of code are you using? The command-based?
|
Re: Code running slow
Yes, command-based.
|
Re: Code running slow
Have you checked to see if its a networking issue, are you losing packets?
|
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.
|
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. |
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.
|
Re: Code running slow
We tried running it without the CAN plugin, no luck, we're reimaging the entire thing.
|
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() {http://wpilib.screenstepslive.com/s/...and-subsystems Brad |
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.
|
Re: Code running slow
Quote:
|
Re: Code running slow
Quote:
Brad |
Re: Code running slow
We tried running a simple robot; the problem does not occur. We tried putting the print in the teleopPeriodic; it was being called about once every 10 seconds.
|
Re: Code running slow
I think the issue is you are using loops in your code.
Iterative and Command based robots should NOT be using "while" or "for" loops (generally) in their code. The methods are already looped for you, and long loops will mean that any "simultaneous" commands will be put on hold until the loop is complete. The Simple template handles looping code by interrupting it periodically, and so you won't see any issues there. |
Re: Code running slow
We double checked, there are absolutely no for or while loops anywhere in the program...
|
Re: Code running slow
Quote:
|
Re: Code running slow
It might be helpful if you posted your project.
|
Re: Code running slow
1 Attachment(s)
I have absolutely not idea what's slowing it down. The good news is that the delay is now only about 2 seconds (no idea why) but that's still too long. The entire project is attached.
|
Re: Code running slow
The starting of a command in teleopInit is not conventional. I would suggest removing that as well as making another subsystem that implements all your drive motors. This command would be the one that has the default command of normDrive as well as being the subsystem normDrive requires. Also, after doing the above, make sure to remove all the require commands from your motor subsystems.
What I believe is happening is your starting 5 normDrive commands in your code, which are all trying to control the same thing at the same time, which could possibly be your delay issue. |
| All times are GMT -5. The time now is 11:49. |
Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi