|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Stopping all motors
I'l try to make it short.
I have around 15 loops which everyone uses a motor object. I want to make an emergency break button, If I use a joystick button I'l have to make a reference in each loop. it's a lot so I think it's kind of lame way to make it. Do you have any other options\ideas? (Besides making one function for it). |
|
#2
|
||||
|
||||
|
Re: Stopping all motors
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. |
|
#3
|
|||||
|
|||||
|
Re: Stopping all motors
You could try enabling the user watchdog and intentionally letting it expire.
|
|
#4
|
|||
|
|||
|
Re: Stopping all motors
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.
|
|
#5
|
|||
|
|||
|
Re: Stopping all motors
Quote:
Quote:
Quote:
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? |
|
#6
|
|||
|
|||
|
Re: Stopping all motors
It isn't clear to me if you want to stop the code and loops, or stop the motors.
It is best to leave the motors being updated in a single place. Anytime you try to coordinate loops to share a motor, it gets unpredictable. So if you want to build a motor override functionality, I'd make a subVI that goes in front of, or even wraps the various calls to update the motor. Pass in the requested motor speed, and in the subVI, check the global override and choose between the requested speed and 0.0. Pass that value to the motor. If you wish to actually stop the code, I'd look at the Abort or Exit. Not the cleanest, nor what I think you are asking for, but it exists. Greg McKaskle |
|
#7
|
|||||
|
|||||
|
Re: Stopping all motors
Then use the space bar. That will stop ALL motors!
Quote:
THERE SHOULD BE NO LOOPS IN YOUR TELEOP. Quote:
Quote:
Quote:
Quote:
A "professional" programmer would have planed out the correct architecture before wiring the first node on the block diagram and avoided endless loops that block the rest of the code from running. |
|
#8
|
|||
|
|||
|
Re: Stopping all motors
Quote:
We have been told that FIRST as some sort of an override to the robot. So we don't really need an emergency stop button. Quote:
I've fixed it with a subVI I programed. The loops are used to put a delay so we'l have a timed controlled actions. Some other question: 1) How can I run the motors without a loop(I need to run a controlled by time motor action). 2)I have some values to put in the dashboard. How can I send the values to the dashboard? 3) How can I run another thread?(I want an multi threading system which the shooter wont interrupt the driver). Last edited by Ilya122 : 15-02-2013 at 04:58. |
|
#9
|
|||
|
|||
|
Re: Stopping all motors
Quote:
2. SmartDashboard is there for this purpose. In the lower right of the palette you can write the value into a named variable that is replicated on other clients. On the dashboard, you can read with the same name or simply put the display indicator on the panel in the Operation tab and name it the same as the variable. 3. LV does parallelism using threads, but without you needing to manage them. Each parallel loop you draw will multitask, and each branch of code will multitask. The system will have a pool of threads that take turns running the code based on a priority queue. By default there are four threads per CPU. Greg McKaskle |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|