Ask Your Question
1

Debugging nodes with gdbserver

asked 2015-09-14 08:46:12 -0500

rbaleksandar gravatar image

Hi!

My setup:

  • * Remote PC*: ROS Indigo, Ubuntu 14.04 LTS
  • * Local PC*: ROS Indigo, Ubuntu 14.04 LTS, Qt Creator 3.0.1

I have a remote PC where I start my node using gdbserver:

user@remote:~$ gdbserver :1234 ~/catkin_ws/devel/lib/my_node/my_node

This node contains multiple SimpleActionServer-s and callbacks for each of those. All servers' flag for autostart have been set to false (see here). I'm using this tutorial as a reference.

On my local PC I have two things (note that here and above I exclude the obvious roscore running :)):

  • Qt Creator 3.01 - here I want to connect to the gdbserver on the remote and debug my node
  • Publishing - using rostopic pub ... I publish Goal messages to my remote.

I should say that normally everything works. However when I use gdbserver the callbacks don't get activated. At first I thought it was my Qt Creator's configuration. However everything there works fine and up to the spin() point I can debug step-wise through my code. Once the spin() is reached I can only pause it (it stops at the spin function call) which tells me two things:

  • The node is spinning properly
  • The messages for some reason are not passed to the action server(s)

In order to investigate further I decided to call my executable on the remote machine (without Qt Creator or even gdbserver). I connected via SSH to it and ran

user@remote:~$ ~/catkin_ws/devel/lib/my_node/my_node

The node started. However every time I send a goal to it nothing happens (same behaviour as with Qt Creator).

  • My first question is do I always have to run ROS nodes using rosrunor roslaunch? I guess that rosrun as well as roslaunch load some things without which a node cannot function in its full glory.
  • My second question is how do I go around all that?

If I really have to use rosrun the complexity of the debugging procedure skyrockets:

  • Server's callback runs in a separate thread
  • Server is started as an attached child process to rosrun
  • Rosrun is executed by gdbserver
  • Local machine connects to remote gdbserver (however we have rosrun here so we have too hook Qt Creator to the child process of rosrun representing our node)

This seems to be an overkill so I'm guessing/hoping that I've done something weird and in fact things are much simpler...

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-09-14 14:33:58 -0500

ahendrix gravatar image

There is no requirement to run nodes with rosrun or roslaunch; they're just convenience tools to make it easier to find and run your executables.

rosrun does even not pass any additional arguments to your node.

Any bug you have is in your code.

edit flag offensive delete link more

Comments

I have followed the tutorial and it works perfectly fine (I have 5-6 SimpleActionServer-s active in that node) whenever I use rosrun or roslaunch in combination with rostopic for publishing or the ActionClient in an extra node. Where do I even start to look at in a situation like this?

rbaleksandar gravatar imagerbaleksandar ( 2015-09-14 16:36:30 -0500 )edit

I will check the namespaces and such because this is usually the spot where most of my errors spawn from.

rbaleksandar gravatar imagerbaleksandar ( 2015-09-14 17:47:14 -0500 )edit

Start by comparing how you're running the node with rosrun to how you're running it without rosrun. Are you passing any arguments to rosrun?

ahendrix gravatar imageahendrix ( 2015-09-14 20:50:28 -0500 )edit

You were right. Though I'm still having difficulties sending message to my node when it's running inside gdbserver at least I got it up and running.I also found out that roslaunch offers support for such things and you can add a launch-prefix that enables the gdbserver + passes all the arguments

rbaleksandar gravatar imagerbaleksandar ( 2015-09-21 20:09:55 -0500 )edit

Have a look at the roslaunch nodes in GDB tutorial as well.

ahendrix gravatar imageahendrix ( 2015-09-22 13:11:50 -0500 )edit

Already did 3-4 days ago. Thanks for the link though. Will definitely be helpful for people who come here.

rbaleksandar gravatar imagerbaleksandar ( 2015-09-22 19:51:17 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2015-09-14 08:46:12 -0500

Seen: 751 times

Last updated: Sep 14 '15