Go to Post Brandon, your amazing! CD media will rock my socks off more then DS&K! :p Ok, maybe I won't go that far. - Kyle Love [more]
Home
Go Back   Chief Delphi > Technical > Programming > NI LabVIEW
CD-Media   CD-Spy  
portal register members calendar search Today's Posts Mark Forums Read FAQ rules

 
Reply
 
Thread Tools Rate Thread Display Modes
  #1   Spotlight this post!  
Unread 21-01-2017, 22:09
mtthwroberts mtthwroberts is offline
Registered User
FRC #3669
 
Join Date: Jan 2017
Location: Ripon, Ca
Posts: 13
mtthwroberts is an unknown quantity at this point
Lightbulb 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
Reply With Quote
  #2   Spotlight this post!  
Unread 21-01-2017, 22:12
ollien ollien is offline
Registered User
FRC #5202
 
Join Date: Feb 2015
Location: United States
Posts: 342
ollien is just really niceollien is just really niceollien is just really niceollien is just really nice
Re: Tank Drive Talon SRX

Dropbox doesn't give me access to the images. Could you upload them to imgur?
Reply With Quote
  #3   Spotlight this post!  
Unread 22-01-2017, 13:49
mtthwroberts mtthwroberts is offline
Registered User
FRC #3669
 
Join Date: Jan 2017
Location: Ripon, Ca
Posts: 13
mtthwroberts is an unknown quantity at this point
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
Reply With Quote
  #4   Spotlight this post!  
Unread 22-01-2017, 13:51
mtthwroberts mtthwroberts is offline
Registered User
FRC #3669
 
Join Date: Jan 2017
Location: Ripon, Ca
Posts: 13
mtthwroberts is an unknown quantity at this point
Re: Tank Drive Talon SRX

Uploaded to Imgur as well...

http://imgur.com/a/lbFQv
Reply With Quote
  #5   Spotlight this post!  
Unread 23-01-2017, 21:33
Jonathan L. Jonathan L. is offline
Programmer alumnus, mentor, and CSA
FRC #1094 (Channel Cats)
 
Join Date: Jan 2013
Rookie Year: 2011
Location: St. Louis MO
Posts: 82
Jonathan L. is a jewel in the roughJonathan L. is a jewel in the roughJonathan L. is a jewel in the roughJonathan L. is a jewel in the rough
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.
Reply With Quote
  #6   Spotlight this post!  
Unread 24-01-2017, 01:15
mtthwroberts mtthwroberts is offline
Registered User
FRC #3669
 
Join Date: Jan 2017
Location: Ripon, Ca
Posts: 13
mtthwroberts is an unknown quantity at this point
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
Reply With Quote
  #7   Spotlight this post!  
Unread 24-01-2017, 14:13
JeffB JeffB is online now
Registered User
FRC #5052 (RoboLobos)
Team Role: Mentor
 
Join Date: Apr 2015
Rookie Year: 2014
Location: Austin
Posts: 64
JeffB is a splendid one to beholdJeffB is a splendid one to beholdJeffB is a splendid one to beholdJeffB is a splendid one to beholdJeffB is a splendid one to beholdJeffB is a splendid one to beholdJeffB is a splendid one to behold
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.
__________________
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

The Chief Delphi Forums are sponsored by Innovation First International, Inc.


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