Announcement

Collapse
No announcement yet.

adding a 2nd joystick

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • adding a 2nd joystick

    how do you add a 2nd joystick to the robot project.

    if you know do you think you can post some screenshots too?

  • #2
    Re: adding a 2nd joystick

    There are really two steps.

    Step one, plug the joystick into the DS, and if needed, use the diagnostics or setup page to verify it works. When a button is pressed the line item or LED turns blue.

    Step two is to read the data using the DriverStation VI. It is the same VI as used in the default code. You need to open and name it in Begin, read and act on it in TeleOp.

    Greg McKaskle

    Comment


    • #3
      Re: adding a 2nd joystick

      I was confused too. The checkout procedure from "Basic Operator Control" doc on page 2 of 3 has you confirm both Arcade and Tank Drive works. Tank requires both joysticks. I have only been able to get Arcade Drive to work.

      I must be missing something too. I think the default project provides for only Arcade drive. I will look into the code later tonight to verify.

      Comment


      • #4
        Re: adding a 2nd joystick

        Originally posted by edwint View Post
        I was confused too. The checkout procedure from "Basic Operator Control" doc on page 2 of 3 has you confirm both Arcade and Tank Drive works. Tank requires both joysticks. I have only been able to get Arcade Drive to work.

        I must be missing something too. I think the default project provides for only Arcade drive. I will look into the code later tonight to verify.
        You are correct that the default project only has arcade drive. The documentation is incorrect when using LabVIEW in that case.
        Team 330 beta tester

        Comment


        • #5
          Re: adding a 2nd joystick

          no i'm asking like how do you add it to the code. for instance we would like to use the 2nd joystick for a robotic arm. second how would you program the joystick to control a few different motors on each axis? for example motor 1 control the x axis while motor 2 and 3 control the y axis?

          thanks for replying guys your help is greatly appreciated

          Comment


          • #6
            Re: adding a 2nd joystick

            I'm in the same boat. I tried the NI.COM tutorial on "Basic motor control" and could not get it to work with joystick 2.

            Comment


            • #7
              Re: adding a 2nd joystick

              Take a look at the begin.vi this is where the opens for all the devices are. You should be able to find a joystick open in this VI. Create a second one like it and name it joystick2 for the reference name or something like that.

              Now, back in robotmain.vi you can reference the second joystick and get values from it and send to the different motor controllers.

              Post if you are still having issues and will try to post a screen shot of what I am referring too here.

              Randy
              Head Mentor
              FIRST Team 4106
              Bots of Prey
              http://www.botsofprey.org
              Canyon County 4-H, Idaho

              Comment


              • #8
                Re: adding a 2nd joystick

                I did add the joystick (joystick2) code to the Begin.vi, Teleop.vi and Finish.vis. Joystick2 is set to use USB2. Once this code is added, joystick one, which controls the Arcade Drive quits working.

                So, I tried moving to USB2 & 3---still nothing works. So, I purchased a new USB expander---still not working.

                Comment


                • #9
                  Re: adding a 2nd joystick

                  There is a string passed into the open joystick command. It is another parameter like he USB 1 / USB 2. That needs to be unique for each joystick.

                  I will try to post a screen shot later of what it should look like.
                  Head Mentor
                  FIRST Team 4106
                  Bots of Prey
                  http://www.botsofprey.org
                  Canyon County 4-H, Idaho

                  Comment


                  • #10
                    Re: adding a 2nd joystick

                    If I double-click on the SECOND Joystick OPEN (JOYSTICK2), the two USB parameters are set to USB1. However, the CONTROL I added to JOYSTICK2 is set to USB2. If I set the USB parameters to USB2 for JOYSTICK2, it also changes JOYSTICK1.

                    Comment


                    • #11
                      Re: adding a 2nd joystick

                      OK, I think I understand what is happening now. When you double click on the joystick block you are editing one instance of the joystick that is global for the system.

                      What you need to do is on the terminals on the left of the joystick block, hover over them, there should be one labeled port and one labeled name (or something like that).

                      Right click on the one labeled port and select "create a constant" from the menu. This will create a drop down next to the joystick open which allows you to select the USB port.

                      Do the same thing on the name. This will create a little text box that you can enter the name you want to call the joystick.

                      As soon as I get over to the school tonight I will post and example of what I mean.

                      Thanks!

                      Randy
                      Head Mentor
                      FIRST Team 4106
                      Bots of Prey
                      http://www.botsofprey.org
                      Canyon County 4-H, Idaho

                      Comment


                      • #12
                        Re: adding a 2nd joystick

                        I've done that in the beginning and it does not work. I will try to post some images of my Begin.vi and Teleop.vi---if I can figure out how to use the INSERT IMAGE button.

                        Comment


                        • #13
                          Re: adding a 2nd joystick

                          Please see the attached images. It shows several screen shots of begin.vi and telop.vi. I added the vis as well.

                          See second post for the telop.vi attachment
                          Attached Files
                          Head Mentor
                          FIRST Team 4106
                          Bots of Prey
                          http://www.botsofprey.org
                          Canyon County 4-H, Idaho

                          Comment


                          • #14
                            Re: adding a 2nd joystick

                            teleop vi
                            Attached Files
                            Head Mentor
                            FIRST Team 4106
                            Bots of Prey
                            http://www.botsofprey.org
                            Canyon County 4-H, Idaho

                            Comment


                            • #15
                              Re: adding a 2nd joystick

                              steinra,

                              Thank you for your help. With your help, I located the problem. My code in the Begin.vi and Teleop.vi was the same, except for one invisible difference---an extra space in the name of "Joystick 2 " in the Teleop.vi. Once I removed the extra space after the "2", the second joystick now controls the arm motor.

                              Again, THANKS for your help.

                              Edwin

                              Comment

                              Working...
                              X