This is the first year my team is using an xbox controller. We have looked at old posts for ideas and examples and none have worked. We are using labview tank drive. Does anyone have an recent example code?
An example of our code is attached below.
This is the first year my team is using an xbox controller. We have looked at old posts for ideas and examples and none have worked. We are using labview tank drive. Does anyone have an recent example code?
An example of our code is attached below.
My Labview skills are a little rusty, but why are you inputting axis 2 from the “get axis” vi and axis 1 from the unbundled cluster? It seems like you should either use the “get axis” vi for both, or feed the values in from the cluster. It also looks like you have axis 5 feeding into the one drive twice.
There should only be a single instance of Tank Drive in that VI. You never want to define the same item twice with different variables The Tank Drive VI takes two numerical values, one for the right and left joysticks. I’m not sure what exactly you’re trying to achieve with your current setup. I’m assuming you want to use the two Y-axises of the Xbox joystick as your controls. If so, I would use axis 1 for your left stick and axis 4 for your right stick. I do not have LabVIEW on this computer (we switched to Java), but your VI should look like this: http://prntscr.com/9x2sk7
I have built a “tank drive” control similar to what I think you are looking for for one of our demo robots. Just to clarify, you are trying to use the two Y-values from the sticks on the controller to control your right and left side independent of each other. The two numeric inputs on the “Tank Drive” VI are the two joystick input values. A single instance of the “Tank Drive” VI will control both the right and left sides. Having multiple drive VIs running at the same time will cause problems.
As a side note, this is a hard drive style to get used to if you have done a lot of driving with single stick controls.
xBox tank drive would look like this:
As far as I know, the labview best practice for joysticks is not clusters anymore, but arrays.
You used to have to use clusters but all teams I’ve seen recently have used arrays.
This was done to provide better support for a wide array of joysticks. You can convert between arrays and clusters if you like or you can build an enum that gives useful names to the indices and use that as you index constant.
Greg McKaskle
316 is using enums this year. If anyone has any questions on how we are doing it, please PM me. It really increases the readability of your code.