|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools |
Rating:
|
Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Autonomous timing of events are to fast
Yes, the a button press is used to turn on the frontMotors in periodic tasks. The frontMotors are turned off in the false case of the button press.
How do I fix this so they do not conflict with eachother? |
|
#2
|
||||
|
||||
|
Re: Autonomous timing of events are to fast
In periodic task, you can set-up a case structure where when the robot is in auto, it does not do the function you have in periodic task. This structure would go over the entire function of what you're doing when you press the button. There's other ways, such as developing a global Boolean variable that executes your periodic task function during auto. I highly recommend doing the global Boolean method, after reading the posts before this.
Last edited by Kevin Phan : 30-03-2014 at 22:07. |
|
#3
|
|||||
|
|||||
|
Re: Autonomous timing of events are to fast
There are better ways to integrate Periodic Tasks actions with Autonomous, but you'd have to completely revamp how you do things, and now is probably not the time to do that. The "cheap" fix is actually pretty easy:
Instead of setting the motor itself in your Autonomous sequence, set a global variable. Where the Periodic Tasks case is setting the motor value to 0, set it instead to the value of that global variable. |
|
#4
|
|||
|
|||
|
Re: Autonomous timing of events are to fast
Thanks again for helping.
I've never used global data before so I watch a youtube video. I think I added the global variables, but don't have access to the robot to check. I've attached screenshots with the changes I've made. Could you check to see if I've added them correctly? |
|
#5
|
|||||
|
|||||
|
Re: Autonomous timing of events are to fast
I don't understand what your "read global variable" loop is intended to do. It's going to be continuously overwriting the global with the current motor value, which is likely to interfere with anything else trying to write the global. If that loop was newly added as part of implementing the global variable, remove it.
There is nowhere I can see that actually sets the motor value. You replaced the spot in Periodic Tasks where that was being done with another global variable write, where all you needed to do was replace the constant 0 with a read of the variable. The only places that should be writing the global are what used to be setting the motor value in the autonomous sequence. I also don't see why you added a rearMotors global. Was something interfering with it as well? |
|
#6
|
|||
|
|||
|
Re: Autonomous timing of events are to fast
I cleaned up and attached the code with corrections. I can't check the code on our robot until district championships, so I am relying on your feedback to get this running.
Thanks again! |
|
#7
|
||||
|
||||
|
Re: Autonomous timing of events are to fast
Why do you have the driver station writing a value to the frontMotors, my interpretation from Alan is to write your frontMotor global values from the periodic task to your motors. You can still have your driverstation determine what the value of the frontMotors.
|
|
#8
|
|||
|
|||
|
Re: Autonomous timing of events are to fast
We read from the driver station so that it is easy to tune the motors for a shot. Will it not work this way? Our shot was fairly consistant in our last district event and can set it in the global. Do I need to do this to make the global work? I'm new to globals.
Last edited by grosh : 05-04-2014 at 22:23. |
|
#9
|
||||
|
||||
|
Re: Autonomous timing of events are to fast
Edit: I think I'm reading your code wrong. Your frontMotor values are suppose to be set in periodic task and you're doing something that I can't see in auto, correct. The code is fine. Sorry for the confusion.
Last edited by Kevin Phan : 05-04-2014 at 22:32. Reason: Misinterperrtation |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|