Splitting RobotDriveDevRef into separate motor references.

Can you split RobotDriveDevRef into separate motor references? I tried unbundle by name. I get DevStatus, Motors], Sensitivity, and Square Inputs. I tried using Motors] for a Motor/Get-Speed Function. Wrong data match. I tried splitting Motors] using unbundle by name. Wrong data match. The other programmers are using Drive functions that use RobotDriveDevRef in their autonomous code they are developing. I could change all of the autonomous code to use separate motor openings and Motor/Set-Speed functions. However, I would prefer to avoid it. It’s vastly easier to use the drive functions.

BTW, we are using a Drive/Open-2-Motor function to open. We are using two motors to drive the back wheels independently. The kind of drive system that is conveniently done by tank drive.

Motors] is an array, not a cluster, so you can’t unbundle it. You can use the “Array to Cluster” tool to turn it into a cluster that can then be unbundled, or you can use other array tools to select specific items from the array directly.

I use motors] and then “index array” to strip out the motors I want. Don’t forget the first motor is index 0.

I’ve been using LabVIEW for so long that I never bothered to learn a really cool trick about “index array” - you can resize it by extending the bottom or top edges to extract multiple items from the array without having to plop down multiple copies. Very nifty trick. I think that there are even provisions for automatically incrementing the index based on an initial value.

Russ

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.

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

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