ros subscriber is interrupted by ginput

1 Ansicht (letzte 30 Tage)
Jin Dai
Jin Dai am 29 Dez. 2016
Beantwortet: Sebastian Castro am 19 Sep. 2017
I have a ginput command in my ros subscriber callback, which causes an interruption of the subscriber. The callback is entered once, and then it stops spinning. When I comment out ginput command, the callback is called continuously.
  4 Kommentare
Geoff Hayes
Geoff Hayes am 30 Dez. 2016
Jin - doesn't the call to ginput "block" and so you are waiting for the user (?) to choose a point on the axes? What are you expecting to happen with the call to ginput?
Jin Dai
Jin Dai am 30 Dez. 2016
I deleted most codes to show you only the code structure. I clicked a point and found nearest neighbors of this clicked point. After this, it exits the callback, and never enters it again.

Melden Sie sich an, um zu kommentieren.

Antworten (1)

Sebastian Castro
Sebastian Castro am 19 Sep. 2017
This is expected, sorry to say.
Recall that the MATLAB environment is single-threaded, with the exception of optimized math functions (which you can't control as a user), or if you're using the Parallel Computing Toolbox to explicitly assign tasks to multiple cores.
So, a blocking operation like ginput means your subscriber won't be receiving any messages until you free up computational resources.
- Sebastian

Kategorien

Mehr zu Services and Actions finden Sie in Help Center und File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by