Log in

View Full Version : Strange lag issue


Supernovapsy
01-03-2012, 16:14
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:

1217112172

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:


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;
}


even though I don't know how this would cause any lag.

mikets
01-03-2012, 17:46
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.

Supernovapsy
02-03-2012, 16:09
We found out that the jaguars were not given the right ports, and after we switched it, everything worked fine. :o

Thank you!

Greg McKaskle
03-03-2012, 09:17
Does that explain why the CPU usage increased over time?

Greg McKaskle

Supernovapsy
12-03-2012, 16:52
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 :confused:

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?

Supernovapsy
12-03-2012, 16:54
Here's the image

12293

frdrake
13-03-2012, 13:51
Have you tried opening up the WTX console to see if any errors are being output there that might be relevant?

nighterfighter
13-03-2012, 20:23
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.

AllenGregoryIV
13-03-2012, 20:40
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?