|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
CPU usage 100% & twitchy robot?
When we enable our robot the code seems to run fine for a couple of seconds then it becomes twitchy and/or laggy. What I mean by twitchy is the light on the motor controllers flicker periodically and the motors controlled by joystick buttons do not respond quickly. Also, the CPU usage on the DS graph changes from 65% to 100% at the same time that the robot seems to become twitchy. In previous years we have had much larger code without problem.
In addition, when I put probes in the teleop vi the probes indicate that the code is running perfectly. However, the motors on the robot do not. I have included a picture of our teleop code. Any ideas? |
|
#2
|
|||
|
|||
|
Re: CPU usage 100% & twitchy robot?
The attached image is tiny, so I can't help much.
Greg McKaskle |
|
#3
|
|||
|
|||
|
Re: CPU usage 100% & twitchy robot?
Here is a bigger picture.
|
|
#4
|
|||||
|
|||||
|
Re: CPU usage 100% & twitchy robot?
You can also attach a .vi file.
|
|
#5
|
|||
|
|||
|
Re: CPU usage 100% & twitchy robot?
I don't think the behavior has much to do with the teleop code. To see how often it is being called, you may want to put the Elapsed Times VI into teleop. You can find it in the support folder in your project window.
I think the twitch is likely caused by the robot drive motors being updated less than every 100ms. The next issue is to find the code that runs so often or takes so long that it slows down teleop. One place to look is vision, the other is periodic tasks. Finally, Since I can't see the code run in the other case of the button 5 switch, it could be that it is sleeping for a long time and causing the issue, but I suspect this isn't the case. Greg McKaskle |
|
#6
|
|||||
|
|||||
|
Re: CPU usage 100% & twitchy robot?
Your problem could also be caused by unhandled errors within your code - this often takes up a lot of CPU resources (the watchpuppies are a good example of this). On your driver station, go to the "Diagnostics" tab and look at the errors. If it's telling you about an error somewhere in your code, see how fixing it affects your robot response times.
|
|
#7
|
|||
|
|||
|
Re: CPU usage 100% & twitchy robot?
Thanks for the help. I'm not at the shop to hook up to the test bot. I'll run the teleop code with the Elapsed time VI tomorrow. What should I be looking for? If it is not calling the teleop vi fast/slow enough what else should I look for?
PS- I attached a picture of button 5. |
|
#8
|
|||||
|
|||||
|
Re: CPU usage 100% & twitchy robot?
I'd check that all your refnums all match and are correct. That's a common error. And I'd check that your safety isn't tripping (like Greg suggested). Check for code that takes a long time to execute (one iteration of your Teleop VI should take ~20 ms, the amount of time it takes for a new DS packet to reach the robot).
And once you get access to your robot, if there's an error, the error message should tell you exactly what is wrong and which VI it's located in. |
|
#9
|
|||||
|
|||||
|
Re: CPU usage 100% & twitchy robot?
I don't think your bridge manipulator motor is going to work the way you want it to. You're setting it in two places, and the second one (on the right) is going to win.
|
|
#10
|
|||
|
|||
|
Re: CPU usage 100% & twitchy robot?
Quote:
Regardless, the result will be a twitchy bridge manipulator. It will toggle between the two set commands unpredictably. My prediction is that you actually have two problems: The twitchiness is caused by the two set commands racing eachother, and your CPU is being pegged to 100% by a separate error (likely a while loop with no wait in it). |
|
#11
|
|||||
|
|||||
|
Re: CPU usage 100% & twitchy robot?
Oops, you're right. I thought the device reference went from the output of one to the input of the other. I guess I was distracted by the odd placing of the functions, with a bunch of right-to-left wires running along with the left-to-right ones.
|
|
#12
|
|||
|
|||
|
Re: CPU usage 100% & twitchy robot?
Rookie Mistake!
Phil you were right. We named two of our motors with the same refnum name. DUH! Alan- We did have to fix the bridge manipulator motor. We are new to programming and rely on this forum to get a robot running. Thanks for the help |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|