FIRST Robotics Competition Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Joystick Problems with use of buttons

Hi again

I was wondering if anyone knew what kind of layout do I need to use a button on the joystick. The program is supost to stop the robot from moveing.

I have done unbundle by name and selected button one for the use for my program.

When I have the bot in tank drive the button is ignored even when I do a flash.

Also when I have the throttle which I believe is axis 3 all the way down the bot seems to go in arcade drive.

And the button works but when the joystick is moved side to side the button is ignored and the motors run.

Does anyone have the solution to this problem??

Thanks in advance.

0 Kudos
Message 1 of 7
(9,561 Views)

We would need to see your code to help.

0 Kudos
Message 2 of 7
(2,761 Views)

ok i will post a screen shot of the code.

The red rectangle in the scrreenshot is the code i edited

0 Kudos
Message 3 of 7
(2,761 Views)

Since you only showed the TRUE case (when the button is held) I can only help with that.

Axis 1 is the X axis of the joysticks. When the button is held, you doing tank drive with the joysticks X axis. This sounds like exactly what you described. If you want the robot to stop, you should put a 0 constant into the tank drive VI and ignore any joystick values.

0 Kudos
Message 4 of 7
(2,761 Views)

OK, lots of issues here.

1)  I think Axis 1 is the X axis, which is left/right.  You probably want axis 2 (Forward/back) for tank drive.

2) Not sure why you are using Joystick:GetAxis.... instead you should just be using Joystick:Get and then you can access all the axes.

     Take the Axes Cluster and use the Unbundle By Name component to access the axis you want.  Here you can see which axis is which.

3) The new controller does not use +/- 127 to scale motor drives.

     nearly all the drives use +/- 1 as the full scale range, which is exactly what the Joystick:get function returns, so no need to scale this

     (although you may need to reverse the sign (since stick forward is negative D'oh !!!)

4) Can't see from the screen grab... do you set the drive to 0 in the "False" state?

Get a life? This IS my life!
0 Kudos
Message 5 of 7
(2,761 Views)

Ok the advice is helpful but.....

1. When I get the bot up and running the robot reacts to the forward and backward motion for the joystick like tank drive. The left and right motion does not respond.

2. When the throttle (the + - on earthier side, below button #8, 9) When it is up all the way by the + symbol the tank drive takes effect. When button one is clicked nothing happens When it is all the way by the - symbol it is in an arcade like drive. The button makes the motors stop but when the joystick is moved left right it runs. Another thing that I noticed is that of without the button pressed the "Arcade Drive" does not turn on the spot, with the left/ right motion.

3. The joystick in the false statement is set to 0 as a constant.


4. What is the axis on the joysticks?? When I can choose the axis I see axis 1-6.

5. Could this reaction still be old code form Out of the Box that somehow does not flash when I send new code? Is there any updates still need for anything? I have done all of the updates for labview,crio, and DS.

When I build the code shows an error about file name collision was prevented. Is that a problem?? Also when I right-click and select "Run as Startup" It says that it found files that have found a conflict “This VI is part of a Real-Time Startup Application. All VIs on the target will be closed if you choose to refresh and continue with deployment.” It highlights Send Image to PC.vi, Basic Robot Main.vi, Autonomous Independent.vi, Acquire Image.vi. What is going on with this??

What is going on with this program??



0 Kudos
Message 6 of 7
(2,761 Views)

Hi,

It might be easier for everyone to see what is going on if you post your VI.

It should react to forward and backward in tank drive, and ignore the left/right.

File name collision is not a problem, it is fixed automatically when you deploy (you can't have two VIs with the same name in memory at the same time, so it will automatically change the name).

When you select run as startup, that message is just warning you that it is going to close the currently running VIs when it deploys.  After deployment, it will ask you to reboot, after which your startup executable will be running.

Regards,

JeremyB

Applications Engineer

National Instruments

Regards,

Jeremy_B

Applications Engineer
National Instruments
0 Kudos
Message 7 of 7
(2,761 Views)