Go to Post *POP!* I suppose I'll have to change my hair style to the John V-Neun now. - Billfred [more]
Home
Go Back   Chief Delphi > Technical > Programming > C/C++
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
 
 
Thread Tools Rate Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Spotlight this post!  
Unread 01-03-2012, 16:14
Supernovapsy Supernovapsy is offline
Registered User
FRC #1334
 
Join Date: Feb 2012
Location: Canada
Posts: 18
Supernovapsy is an unknown quantity at this point
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:

Click image for larger version

Name:	Untitled.png
Views:	38
Size:	36.8 KB
ID:	12171Click image for larger version

Name:	Untitled2.png
Views:	32
Size:	37.3 KB
ID:	12172

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;
}
even though I don't know how this would cause any lag.
Reply With Quote
 


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 17:42.

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
Copyright © Chief Delphi