Use kdbg or Nemiver to debug Ros

Source: Internet
Author: User

kdbg

Kdbg is a gdb front-end GUI in the KDE environment, which is friendly and fast to install and use, please refer to:

http://www.kdbg.org/

You can use apt to install directly under Ubuntu:

sudo apt-get install kdbg

After the installation runs, you will encounter an error similar to "MNG error 11:function is invalid at this point; Chunk mhdr; subcode 0:0"

Remove/usr/share/kde4/apps/kdbg/icons/hicolor/22x22/actions/pulse.mng to

Nemiver

Nemiver is a gnome-based GDB front-end, very powerful, but slow

Use apt to install directly under Ubuntu:

sudo apt-get install Nemiver

Using the debugger (GDB front end) in Ros must use debug mode to compile the package to be run, as follows:

catkin_make -dcmake_build_type=Debug

There are two ways to use the debugger:

One is to debug with attach after starting the node. This way kdbg and Nemiver are supported, here do not do more introduction, just need to know that node's execution file is generally in

<CATKIN_WORKSPACE>/devel/lib/<PKG_NAME> under, such as: ~/code/ros/catkin_ws/devel/lib/robot_ Localization

Another way is to specify the command prefix for node start in the launch file, which is the launch-prefix property of node, please refer to the following link:

Roslaunch Nodes in Valgrind or GDB

Node

We can also designate Launch-prefix as other tools, such as the nemiver and kdbg I just introduced

For example:

 #localization_starter. Launch
<Launch> <Argname= "Debugger"default="" /> <nodePkg= "Robot_localization"
Type= "Ekf_localization_node"
Name= "Ekf_localization"
Clear_params= "true"
Launch-prefix= "$ (Arg debugger)" /></Launch>

When running Localization_starter.launch, you can use this method to develop debugger as Nemiver:

Roslaunch <MY_PKG_NAME> localization_starter.launch debugger:=nemiver

Nemiver can be specified directly as Launch-prefix, but the use of kdbg is a little trickier because kdbg's command-line format is incompatible with this approach

Using the prefix method requires the tool to support the following form of command-line format:

<TOOL_NAME> <EXEC_NAME> <exec_args...>, such as:nemiver git status

However, the kdbg command line format is: kdbg-a "<EXEC_ARGS...>" <EXEC_NAME>

Therefore, the script must be used for format conversion, and I use the following script:

#!/bin/bashkdbg=Kdbgprogram=$1ShiftARGS="[email protected]"if["${args}"!=""] && ["${program}"!=""]; Then${kdbg}-A"${args}" "${program}"Else  if["${program}"!=""]; Then${kdbg}-A" " "${program}"  Else${kdbg}fifi

The name is: Kdbg-ros and added to the environment variable path can be used in the Ros launch file, still with the previous localization_starter.launch as an example:

Roslaunch <MY_PKG_NAME> localization_starter.launch debugger:=kdbg-ros

Set breakpoints after kdbg startup, then click Run to start the node for debugging

Use kdbg or Nemiver to debug Ros

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.