How to force ROS running in single thread mode2019 Community Moderator ElectionHow do you set, clear, and toggle a single bit?How do I iterate over the words of a string?How can I profile C++ code running on Linux?gdb: Cannot find new threads: generic errorD2 and gdb issueGDB is showing 1 Thread in non threaded applicationopengl program crashes on glBegin(GL_QUADS)Accessing vector.front() in a thread causes runtime errorDebug when thread is stuck in syscall 32bit program on 64 bit hostgdb on macOs Mojave 10.14.2
How to pronounce "I ♥ Huckabees"?
Examples of transfinite towers
Do I need life insurance if I can cover my own funeral costs?
Bach's Toccata and Fugue in D minor breaks the "no parallel octaves" rule?
Official degrees of earth’s rotation per day
Python if-else code style for reduced code for rounding floats
How to write cleanly even if my character uses expletive language?
Equivalents to the present tense
A diagram about partial derivatives of f(x,y)
New passport but visa is in old (lost) passport
What are substitutions for coconut in curry?
A single argument pattern definition applies to multiple-argument patterns?
How well should I expect Adam to work?
Shortcut for setting origin to vertex
Professor being mistaken for a grad student
Brexit - No Deal Rejection
How to deal with taxi scam when on vacation?
Why did it take so long to abandon sail after steamships were demonstrated?
Problem with FindRoot
Violin - Can double stops be played when the strings are not next to each other?
Is there a symmetric-key algorithm which we can use for creating a signature?
Why do tuner card drivers fail to build after kernel update to 4.4.0-143-generic?
What exactly is this small puffer fish doing and how did it manage to accomplish such a feat?
Why does overlay work only on the first tcolorbox?
How to force ROS running in single thread mode
2019 Community Moderator ElectionHow do you set, clear, and toggle a single bit?How do I iterate over the words of a string?How can I profile C++ code running on Linux?gdb: Cannot find new threads: generic errorD2 and gdb issueGDB is showing 1 Thread in non threaded applicationopengl program crashes on glBegin(GL_QUADS)Accessing vector.front() in a thread causes runtime errorDebug when thread is stuck in syscall 32bit program on 64 bit hostgdb on macOs Mojave 10.14.2
I am trying to debug my ros code in gdb, how ever, when I start the node in gdb, it always gives me:
Starting program: /home/uav/catkin_ws/devel/lib/my_package/my_node
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-
gnu/libthread_db.so.1".
[New Thread 0x7ffff13b9700 (LWP 28089)]
[New Thread 0x7ffff0bb8700 (LWP 28090)]
[New Thread 0x7fffebfff700 (LWP 28091)]
[New Thread 0x7fffeb7fe700 (LWP 28096)]
[New Thread 0x7fffeaffd700 (LWP 28098)]
[New Thread 0x7fffea7fc700 (LWP 28121)]
and hangs forever. I don't see this issue before and have no clue why it always start in multi-threads mode. My main function looks like this:
int main(int argc, char** argv)
ros::init(argc, argv, "my_node");
ros::NodeHandle nodeHandle("~");
ros::Rate rate(10);
while (ros::ok())
// Do Something
ros::spinOnce();
rate.sleep();
return 0;
How can I fix this problem? I am thinking I should make my node to a single thread version and debug it, how am I supposed to do that?
c++ gdb ros
add a comment |
I am trying to debug my ros code in gdb, how ever, when I start the node in gdb, it always gives me:
Starting program: /home/uav/catkin_ws/devel/lib/my_package/my_node
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-
gnu/libthread_db.so.1".
[New Thread 0x7ffff13b9700 (LWP 28089)]
[New Thread 0x7ffff0bb8700 (LWP 28090)]
[New Thread 0x7fffebfff700 (LWP 28091)]
[New Thread 0x7fffeb7fe700 (LWP 28096)]
[New Thread 0x7fffeaffd700 (LWP 28098)]
[New Thread 0x7fffea7fc700 (LWP 28121)]
and hangs forever. I don't see this issue before and have no clue why it always start in multi-threads mode. My main function looks like this:
int main(int argc, char** argv)
ros::init(argc, argv, "my_node");
ros::NodeHandle nodeHandle("~");
ros::Rate rate(10);
while (ros::ok())
// Do Something
ros::spinOnce();
rate.sleep();
return 0;
How can I fix this problem? I am thinking I should make my node to a single thread version and debug it, how am I supposed to do that?
c++ gdb ros
Check out the documentation: wiki.ros.org/roscpp/Overview/Callbacks%20and%20Spinning - your code is already single-threaded.
– Fruchtzwerg
Mar 7 at 8:31
add a comment |
I am trying to debug my ros code in gdb, how ever, when I start the node in gdb, it always gives me:
Starting program: /home/uav/catkin_ws/devel/lib/my_package/my_node
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-
gnu/libthread_db.so.1".
[New Thread 0x7ffff13b9700 (LWP 28089)]
[New Thread 0x7ffff0bb8700 (LWP 28090)]
[New Thread 0x7fffebfff700 (LWP 28091)]
[New Thread 0x7fffeb7fe700 (LWP 28096)]
[New Thread 0x7fffeaffd700 (LWP 28098)]
[New Thread 0x7fffea7fc700 (LWP 28121)]
and hangs forever. I don't see this issue before and have no clue why it always start in multi-threads mode. My main function looks like this:
int main(int argc, char** argv)
ros::init(argc, argv, "my_node");
ros::NodeHandle nodeHandle("~");
ros::Rate rate(10);
while (ros::ok())
// Do Something
ros::spinOnce();
rate.sleep();
return 0;
How can I fix this problem? I am thinking I should make my node to a single thread version and debug it, how am I supposed to do that?
c++ gdb ros
I am trying to debug my ros code in gdb, how ever, when I start the node in gdb, it always gives me:
Starting program: /home/uav/catkin_ws/devel/lib/my_package/my_node
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-
gnu/libthread_db.so.1".
[New Thread 0x7ffff13b9700 (LWP 28089)]
[New Thread 0x7ffff0bb8700 (LWP 28090)]
[New Thread 0x7fffebfff700 (LWP 28091)]
[New Thread 0x7fffeb7fe700 (LWP 28096)]
[New Thread 0x7fffeaffd700 (LWP 28098)]
[New Thread 0x7fffea7fc700 (LWP 28121)]
and hangs forever. I don't see this issue before and have no clue why it always start in multi-threads mode. My main function looks like this:
int main(int argc, char** argv)
ros::init(argc, argv, "my_node");
ros::NodeHandle nodeHandle("~");
ros::Rate rate(10);
while (ros::ok())
// Do Something
ros::spinOnce();
rate.sleep();
return 0;
How can I fix this problem? I am thinking I should make my node to a single thread version and debug it, how am I supposed to do that?
c++ gdb ros
c++ gdb ros
asked Mar 6 at 20:38
JeokerJeoker
145
145
Check out the documentation: wiki.ros.org/roscpp/Overview/Callbacks%20and%20Spinning - your code is already single-threaded.
– Fruchtzwerg
Mar 7 at 8:31
add a comment |
Check out the documentation: wiki.ros.org/roscpp/Overview/Callbacks%20and%20Spinning - your code is already single-threaded.
– Fruchtzwerg
Mar 7 at 8:31
Check out the documentation: wiki.ros.org/roscpp/Overview/Callbacks%20and%20Spinning - your code is already single-threaded.
– Fruchtzwerg
Mar 7 at 8:31
Check out the documentation: wiki.ros.org/roscpp/Overview/Callbacks%20and%20Spinning - your code is already single-threaded.
– Fruchtzwerg
Mar 7 at 8:31
add a comment |
1 Answer
1
active
oldest
votes
There are two ways to talk about multithreading in ROS.
- The whole node
- The callbackQueue.
In the first case, when you use:
ros::NodeHandle nodeHandle("~");
ros::ok()
...
It does some requests to the ROS Master. And with roscpp the network communication is handled with multithreading. There is no way to change that. If single threading is very important for you, you should try rospy, rosnodejs or others.
"roscpp does not try to specify a threading model for your application. This means that while roscpp may use threads behind the scenes to do network management, scheduling etc., it will never expose its threads to your application."
In the second case, we talk about handling topics, services and actions with multithreading. By default, a topic is handled with one thread. But if you send more data that your node can handle it, you can use multithreading.
"roscpp does, however, allow your callbacks to be called from any number of threads if that's what you want."
For mode details, see:
http://wiki.ros.org/roscpp/Overview/Callbacks%20and%20Spinning
add a comment |
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55031778%2fhow-to-force-ros-running-in-single-thread-mode%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
There are two ways to talk about multithreading in ROS.
- The whole node
- The callbackQueue.
In the first case, when you use:
ros::NodeHandle nodeHandle("~");
ros::ok()
...
It does some requests to the ROS Master. And with roscpp the network communication is handled with multithreading. There is no way to change that. If single threading is very important for you, you should try rospy, rosnodejs or others.
"roscpp does not try to specify a threading model for your application. This means that while roscpp may use threads behind the scenes to do network management, scheduling etc., it will never expose its threads to your application."
In the second case, we talk about handling topics, services and actions with multithreading. By default, a topic is handled with one thread. But if you send more data that your node can handle it, you can use multithreading.
"roscpp does, however, allow your callbacks to be called from any number of threads if that's what you want."
For mode details, see:
http://wiki.ros.org/roscpp/Overview/Callbacks%20and%20Spinning
add a comment |
There are two ways to talk about multithreading in ROS.
- The whole node
- The callbackQueue.
In the first case, when you use:
ros::NodeHandle nodeHandle("~");
ros::ok()
...
It does some requests to the ROS Master. And with roscpp the network communication is handled with multithreading. There is no way to change that. If single threading is very important for you, you should try rospy, rosnodejs or others.
"roscpp does not try to specify a threading model for your application. This means that while roscpp may use threads behind the scenes to do network management, scheduling etc., it will never expose its threads to your application."
In the second case, we talk about handling topics, services and actions with multithreading. By default, a topic is handled with one thread. But if you send more data that your node can handle it, you can use multithreading.
"roscpp does, however, allow your callbacks to be called from any number of threads if that's what you want."
For mode details, see:
http://wiki.ros.org/roscpp/Overview/Callbacks%20and%20Spinning
add a comment |
There are two ways to talk about multithreading in ROS.
- The whole node
- The callbackQueue.
In the first case, when you use:
ros::NodeHandle nodeHandle("~");
ros::ok()
...
It does some requests to the ROS Master. And with roscpp the network communication is handled with multithreading. There is no way to change that. If single threading is very important for you, you should try rospy, rosnodejs or others.
"roscpp does not try to specify a threading model for your application. This means that while roscpp may use threads behind the scenes to do network management, scheduling etc., it will never expose its threads to your application."
In the second case, we talk about handling topics, services and actions with multithreading. By default, a topic is handled with one thread. But if you send more data that your node can handle it, you can use multithreading.
"roscpp does, however, allow your callbacks to be called from any number of threads if that's what you want."
For mode details, see:
http://wiki.ros.org/roscpp/Overview/Callbacks%20and%20Spinning
There are two ways to talk about multithreading in ROS.
- The whole node
- The callbackQueue.
In the first case, when you use:
ros::NodeHandle nodeHandle("~");
ros::ok()
...
It does some requests to the ROS Master. And with roscpp the network communication is handled with multithreading. There is no way to change that. If single threading is very important for you, you should try rospy, rosnodejs or others.
"roscpp does not try to specify a threading model for your application. This means that while roscpp may use threads behind the scenes to do network management, scheduling etc., it will never expose its threads to your application."
In the second case, we talk about handling topics, services and actions with multithreading. By default, a topic is handled with one thread. But if you send more data that your node can handle it, you can use multithreading.
"roscpp does, however, allow your callbacks to be called from any number of threads if that's what you want."
For mode details, see:
http://wiki.ros.org/roscpp/Overview/Callbacks%20and%20Spinning
answered Mar 8 at 10:33
Marc JonotMarc Jonot
1
1
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55031778%2fhow-to-force-ros-running-in-single-thread-mode%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Check out the documentation: wiki.ros.org/roscpp/Overview/Callbacks%20and%20Spinning - your code is already single-threaded.
– Fruchtzwerg
Mar 7 at 8:31