View Single Post
  #5   Spotlight this post!  
Unread 24-01-2009, 20:25
Joshamuffin Joshamuffin is offline
Programmer
FRC #1723 (FBI)
Team Role: Programmer
 
Join Date: Jan 2008
Rookie Year: 2006
Location: Missouri
Posts: 24
Joshamuffin will become famous soon enough
Send a message via MSN to Joshamuffin
Re: Splitting RobotDriveDevRef into separate motor references.

I got it to work finally. I was having trouble with something else, also. Once I fixed the program, I ran out of the school with a chair above my head and shook it at passing cars for a couple minutes without a coat. I eventually went back in, frozen. It was something that shouldn't have made a difference. I was combining the values into a tank drive statement with the original Drive Reference connected. I went through at least 5 different methods of increasing complexity to get the motors to transition towards what the joystick was telling it to do. I eventually came up with a way that was far simpler than my first. It was unquestionably logically sound. I still couldn't get it to work. I decided it was LabVIEW's fault. I started messing around with other statements to make sure it was fine. It should have been. I eventually, in a fit of desperation, deleted the Tank Drive and replaced it with two Motor/Set-Speed's. It worked. The Tank Drive should have done the same thing.

Also, here is what I did in the C++ equivalent. I actually write it in C++ before I do it in LabVIEW because I pretty much think in C(++). Note that the variables are not copy/pasteable.

Code:
speedMax = speed + maxChange;
speedMin = speed - maxChange;

if(command > speedMax)
{
	motor = speedMax;
}
else
{
	if(command < speedMin)
	{
		motor = speedMin;
	}
	else
	{
		motor = command;
	}
}
Reply With Quote