Chief Delphi

Chief Delphi (http://www.chiefdelphi.com/forums/index.php)
-   NI LabVIEW (http://www.chiefdelphi.com/forums/forumdisplay.php?f=182)
-   -   Tank Drive Talon SRX (http://www.chiefdelphi.com/forums/showthread.php?t=154073)

mtthwroberts 21-01-2017 22:09

Tank Drive Talon SRX
 
I'm having the hardest time trying to get two joysticks to work. I've initialized the second joystick and gave it a different refnum name, but it still doesn't work. I read through a few forums with similar issues but none of their solutions worked for me. Can someone please help?
https://www.dropbox.com/home?preview...stry+Error.PNG
https://www.dropbox.com/home?preview=Variant.PNG

ollien 21-01-2017 22:12

Re: Tank Drive Talon SRX
 
Dropbox doesn't give me access to the images. Could you upload them to imgur?

mtthwroberts 22-01-2017 13:49

Re: Tank Drive Talon SRX
 
Oops, here's shareable links...

https://www.dropbox.com/s/uz8gf3qkvp...Error.PNG?dl=0

https://www.dropbox.com/s/lqu0uzpxm2...riant.PNG?dl=0

mtthwroberts 22-01-2017 13:51

Re: Tank Drive Talon SRX
 
Uploaded to Imgur as well...

http://imgur.com/a/lbFQv

Jonathan L. 23-01-2017 21:33

Re: Tank Drive Talon SRX
 
On the left I see you are opening the two joysticks. That code should actualy be moved to the Begin.vi. As it is, the TeleOp.vi is inside a while loop on the Robot Main.vi. That means the joysticks are being opened over and over and over. When you move the Joystick Open code to the Begin.vi you can call each Joystick by its name in the TeleOp.vi. Also, you should change the refnum names to constants instead of controls.

On the upper right it looks like you are currently using a single joystick axis from a single joystick (JS0) to control two motors. One motor (the one with the error) has probably not been opened (hence the error). I'm going to assume you are trying to use two joysticks to control two motors. If that is the case, you can just delete the lower motor code and then copy and paste the joystick and motor code (not including the network table write code) and change the refnum names for the copy. Remember to open the second motor in the Begin.vi.

In addition to moving the Open VIs to the Begin.vi it is also good practice (although it may not be absolutely necessary. Maybe someone could weigh in on the importance.) to close the motors and joysticks in the finish.vi.

If these motors are drive motors, there is another way to go about controlling them as a unit. Just let us know if that is the case.

Another thing... Unless you are using a compressor and not any solenoids, you do not need ANY compressor code. The compressor will be activated automatically when you open a solenoid.

mtthwroberts 24-01-2017 01:15

Re: Tank Drive Talon SRX
 
Hi Jonathan,
I think I fixed the mistakes you mentioned. However, I'm still unable to read from two separate joy sticks. Take a look at my last post on this thread (https://www.chiefdelphi.com/forums/s....php?t=154148), and sorry for opening multiple threads!
Thanks,
Matt

JeffB 24-01-2017 14:13

Re: Tank Drive Talon SRX
 
I'm going to walk through the entire joystick process hoping this gets you, and others, on the right path.

The first thing you want to do is plug in your joysticks. Once they're plugged in, open up your Driver Station and click on the 4th tab down. It looks like the USB icon and is right above the lightning bolt, just below the gear.

This will give you a list of devices under USB order. They'll all have a number next to them. Pay attention to these numbers.

On one of your joysticks, move it forward. Do you see any axis change? If not, click on another joystick in the list and repeat until you see an axis move. Once you see the axis move, you've identified which number matches that specific joystick.

Take a look at all of the things that populate now. You have booleans and some axis values. You can move your joystick around to find where each axis is as well as push each button to see which responds. Both the axis and booleans are 0-indexed. That means the first axis is 0, the second is 1, and so on. While you're coding, you'll want to have a map of these index values to the buttons they match.

Once you've done this for all of your joysticks, open up the Begin.vi. Open a reference to each joystick using the USB number we just found matching the joystick. Give your joystick a meaningful name. The default project has "Joystick 0" Please don't use this naming scheme for yours. Replace that with something meaningful. "Drive joystick" "Left side joystick" Use a name that describes what it is. Match the code in the Begin.vi to create a reference.

In your teleop code, get the joystick reference using the name you just created.

From here, you can pull out the button or axis values and index the array of values using the index we found testing in the driver station. Pass the desired axis/boolean to your logic to see what happens.


All times are GMT -5. The time now is 10:53.

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