|
|
|
![]() |
|
|||||||
|
||||||||
![]() |
|
|
Thread Tools | Rate Thread | Display Modes |
|
|
|
#1
|
|||
|
|||
|
Re: Using a separate thread for driving motors?
But I still don't think that's the case. I don't believe separate threads outside the main robot thread can keep the robot alive if the main thread has died.
|
|
#2
|
|||
|
|||
|
Re: Using a separate thread for driving motors?
Yes, your right. I'm more used to working with Java, where this is not the case, but in C++ (which I just realized the OP was using), exiting the main thread does cause all other threads to terminate.
|
|
#3
|
||||
|
||||
|
Re: Using a separate thread for driving motors?
Quote:
Quote:
So it's not yet clear if you are both saying exactly the same thing. It depends on Jefferson's intended meaning of "died": If the main thread is blocked or busy-waiting for an event that never occurs, it could be considered to have "died" but not "exited". Last edited by Ether : 03-18-2015 at 06:30 PM. |
|
#4
|
|||
|
|||
|
Re: Using a separate thread for driving motors?
Ether brings up a good point. I was thinking about the case where the main thread finished its execution or threw an exception, in which case all other threads would exit.
But if for the main thread locked up without actually exiting or crashing (something that becomes more likely when you start communicating between multiple threads), the other threads (such as the one controlling the driving) could continue executing. Like I mentioned before, the e-stop/disable buttons would still be able to stop the robot in this case. |
|
#5
|
|||||
|
|||||
|
Re: Using a separate thread for driving motors?
OP, would you mind posting your code? I would advise trying to find the root of the problem in the main thread rather than moving drive code out.
|
|
#6
|
||||
|
||||
|
Re: Using a separate thread for driving motors?
ditto that.
|
|
#7
|
|||
|
|||
|
Re: Using a separate thread for driving motors?
Quote:
I'll throw in with everybody else and recommend finding the root cause of the motor safety errors in the first place. |
|
#8
|
|||
|
|||
|
Re: Using a separate thread for driving motors?
This is the code for the robot, except all the camera code was commented out at competition.
https://github.com/Saint-Francis-Rob...367/FinalRobot |
![]() |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|