Comments (1)
Fixed in 59ad148 . Issue was with blocking processes and no threads to unblock them.
May want to do a full refactor to avoid use of preempt_cb. Discussion so far:
- The
HarmoniActionServer
has a main thread (thread 1) which creates two threads--the first we explicitly create for the executeCallback (thread 2) and another new thread that seems to be created for regular callbacks (thread 3--this thread creation must occur in the actionlib code somewhere).- The
service_server
and its associated service live inside of the executeCallback thread (thread 2).- Any while loops in your services which are called in response to start, do, request, etc. will block the
service_server
from responding to state transitions until the while loop breaks. As long as there is a sleep in your while loop, data (e.g. state) can be changed by a separate thread which can be used as a loop break signal.- I implemented a workaround for the issue caused by previous point without rewriting existing loops. I used a preempt callback in the
service_server
that theActionServer
(thread 3) can call at any time. This callback updates the State to PAUSE, which the while loop checks for and breaks out of when seen.- We should refactor code which contains long-running while loops. The preempt workaround I have provided requires extra knowledge of classes a service creator shouldn't care about too much. Possible solutions include putting the
service_server
in a separate thread, making an obvious requirement for service creators to thread their loops, or using a timer thread to poll for goal updates- The current
start_sending_feedback()
function found in theservice_server
is another a blocking function; in themicrophone_service
case it is called on the main thread (thread 1) after theHarmoniActionServer
initializes. This deserves a refactor--feedback should either be reported when changes occur (e.g. state changes) or it should have its own thread, assuming we want it to be a longrunning monitor process.- I think this is an old discussion, but I still feel the title of the
HarmoniServiceManager
service template is confusing. It's being used as a service template usually, so why not just call it that? e.g.Service
orAbstractService
. I just checked, and there is no name overlap with built-ins.
Chris: Awesome write up! I completely agree that preempting is not a good long term solution, unless it is implemented under the hood as part of the action_server.py - so that no one needs to know what it is doing. Taking a step back, I think we may want to discuss if we want services to be state machines - with a state first approach and their own threads, or functions - which the action server is calling upon. I am excited to discuss on Wednesday. I'll try and wrap up the rostests before than so maybe we can close this branch before we get too far into the rewrite.
from harmoni.
Related Issues (20)
- Remove test:=true references HOT 3
- Camera test passes even when it fails HOT 6
- Standardize Readmes
- Gesture Test Failing HOT 1
- Improve Multi-PC tutorial.
- Cleanup Misc Tutorials
- Provide roadmap
- Launching Services Tutorial HOT 1
- Re-test swarm networking approach and provide instructions/compose files.
- Bot Setup Tutorial HOT 1
- Quickstart build harmoni core packages roscpp cmake error HOT 2
- Individual package requirements.txt HOT 1
- Build error on QT NUC HOT 5
- Speaker setup on QT HOT 2
- Better param loading
- Face configuration documentation on QT HOT 2
- Apt key needs updating (all images) HOT 2
- STT with google is broken HOT 1
- State Handling HOT 1
- Automating Test
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from harmoni.