|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
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.
|
|
#2
|
|||
|
|||
|
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? |
|
#3
|
|||
|
|||
|
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 |
|
#4
|
|||||
|
|||||
|
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. |
|
#5
|
|||
|
|||
|
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. |
|
#6
|
|||
|
|||
|
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 |
|
|