|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Strange lag issue
My team is currently testing out kitbots and bots from previous years, but we have encountered a really strange CPU lag issue where the following pattern emerges every time the robot is rebooted and restarted:
The CPU starts off at nearly zero, but gradually increases to 100%. This problem is causing a great lag for the robot. The most likely candidate for the lag issue is this: Code:
void Adjust(float& left, float& right)
{
float difference = abs(abs(left) - abs(right));
if (difference < tolerance)
{
float average = (abs(left) + abs(right)) / 2;
if (left != 0)
left = average * (left / abs(left));
if (right != 0)
right = average * (right / abs(right));
}
left = left * left * left * left_sensitivity;
right = right * right * right * right_sensitivity;
if (left > 1)
left = 1;
else if (left < -1)
left = -1;
if (right > 1)
right = 1;
else if (right < -1)
right = -1;
}
|
|
#2
|
||||
|
||||
|
Re: Strange lag issue
I don't know how this could cause the lag either. Then why did you say this is the most likely culprit? In any case, since you are using float, you should use fabs() instead of abs(). I don't know what abs() will do to float. But if it truncates it to integer, you could still be dividing by zero.
|
|
#3
|
|||
|
|||
|
Re: Strange lag issue
We found out that the jaguars were not given the right ports, and after we switched it, everything worked fine.
![]() Thank you! |
|
#4
|
|||
|
|||
|
Re: Strange lag issue
Does that explain why the CPU usage increased over time?
Greg McKaskle |
|
#5
|
|||
|
|||
|
Re: Strange lag issue
No, I guess it doesn't.
Well, now there's another issue whereby the robot loses communication by itself. Here's a look at the charts. The robot has vision tracking implemented, so the CPU is really high. When the robot starts, there seems to be a huge number of messages, but then drops back down again. Furthermore, there is a constant number of dropped packets. When the number of messages became lower, I enabled the robot, and tried moving it, but it immediately lost communication and disabled itself Can anyone suggest what may be the cause of this problem? Thank you. P.S. This happens with pretty much all of our robots. Do you think batteries might be the problem? |
|
#6
|
|||
|
|||
|
Re: Strange lag issue
|
|
#7
|
|||
|
|||
|
Re: Strange lag issue
Have you tried opening up the WTX console to see if any errors are being output there that might be relevant?
|
|
#8
|
|||
|
|||
|
Re: Strange lag issue
Couple of things:
One- Your wireless router is connected to the correct power port, right? Maybe you are enabling and it its losing power? Two- Have you tried running just the crio? No jaguars or anything, and see if it still crashes. There- Could you post the rest of your code, and we can help find the problem. Four- Are you doing any camera tracking? That could cause the problem also. |
|
#9
|
|||||
|
|||||
|
Re: Strange lag issue
From that graph it looks like you are dropping a lot of packets have you tried moving your router around on the robot, away from the jaguars and motors and seeing if that fixes the problem?
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|