View Single Post
  #2   Spotlight this post!  
Unread 14-02-2013, 06:36
Ilya122 Ilya122 is offline
Israel- 4724
AKA: Ilya
FRC #4725
Team Role: Programmer
 
Join Date: Jan 2013
Rookie Year: 2013
Location: Israel
Posts: 6
Ilya122 is an unknown quantity at this point
Re: Stopping all motors

Quote:
Originally Posted by Omar View Post
I assume this is not an emergency type of stop. Because the space bar on the key board will stop ALL motors.

Reading the joy stick button in each loop is not a bad way to go. What ever way you go, you are still going to have to "read" this "other option" and have a reference to it in each loop. Plus you will have create code to constantly update this "other option" to check if the button has changed.

This is duplicating what the Get Joy Stick already does.

When you read the joy stick all you are doing is reading from stored values that have been previously stored. In this case stored in a shift register. The get joy stick function does not read from the joystick, but from this storage location on the cRIO. Anything else you do would just be duplicating the stored values.

Create a sub VI that gets the joy stick button state and returns it. Then drop copies of this sub VI into each loop and wire the Boolean output as needed.

But you could create your own copy the stored joy stick button data in your own global, but you would have to constantly copy the data from one stored location to the other stored location. Each loop could then read the copy of the data.

You could use a LabVIEW notifier. But again it will require you to create code to copy the data and send out the notifier.
Quote:
Originally Posted by Alan Anderson View Post
You could try enabling the user watchdog and intentionally letting it expire.
Quote:
Originally Posted by CooneyTech View Post
is this for teleop? And if so why do you have 15 loops? I would use case structures with a true false toggle/latch on a button to send zero to the motors.

Hmm It's kind of an Emegency stop button.
I want to stop everything so it wont stuck.. For example. Im running in a loop and any other code wont work because I'm in a loop.
I want to exit the loop and stop every action with a single press.
As I described it's still some sort of duplication.. anyhow I'l need to put it in 15 loops which is kind of silly.
I'm not an amatuer programmer and I know about duplication code and every bad habit of coding. I know about our drawbacks of coding. If I was the lead programmer I would change everything. Because of the time and waste of other's time I don't want to do that.
So how do I make a stop button for everything without stucking the robot with running code?
Reply With Quote