|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
| Thread Tools | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
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. |
|
#2
|
|||||
|
|||||
|
Re: Splitting RobotDriveDevRef into separate motor references.
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.
|
|
#3
|
|||||
|
|||||
|
Re: Splitting RobotDriveDevRef into separate motor references.
I use motors[] and then "index array" to strip out the motors I want. Don't forget the first motor is index 0.
|
|
#4
|
|||
|
|||
|
Re: Splitting RobotDriveDevRef into separate motor references.
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 |
|
#5
|
|||
|
|||
|
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;
}
}
|
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Pointers/References? | htwiz2002 | Programming | 7 | 29-01-2007 22:21 |
| Separate Processor & Robot Rules | JoeXIII'007 | Control System | 7 | 20-01-2006 19:59 |
| Fisher Price Motor Into Drill Gearbox | Chris | Technical Discussion | 11 | 21-04-2004 09:09 |
| Please help asap.. Where do the victor motor 3 pin wires plug into | 1166 | Electrical | 10 | 16-02-2004 12:07 |