Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

wait() help

 
michael spiker
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello all, I'm hoping you can help me, I have a class inplementing the
main() method that does the basic work (running the motors of my robot)
I have a thread that is constantly monitoring the sensors. when a sensor is activated a recovery method is called. problem is everything works great except I cannot get the main program to wait if the sensors are activated, the recovery code and the main want to run together any help would be appreciated Thanks
 
Purushoth Thambu
Ranch Hand
Posts: 425
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you can explain with more information about the classes it would help.
 
michael spiker
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks for the reply my main class is basically just a scenario for autonomous operation (move forward,backward etc. right now it is simply a test scenario that runs thru all the capable movements)the thread simply scans the parallel port for input, and when a pin is brought low (by a bumpswitch, etc)it calls a recovery method that will in the case of the front switch, stop the bot make it reverse and go around the object blocking it.what I need to do is pause the main class while this is happening and then resume once the recovery is finished. I am learning as I go so any input would be helpful thanks
 
Amit A. Patil
Ranch Hand
Posts: 38
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Suggest a synchronized method isRecoveryComplete..could be a shared volatile boolean variable too!
 
michael spiker
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the reply, but could you elaborate? I am learning java as I go
In fact I was going to post in the beginners forum, but I noticed other posts concerning threads were moved here. Thank you for your patience.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic