apollo icon indicating copy to clipboard operation
apollo copied to clipboard

How to gdb debug the Planning module

Open gulshan216 opened this issue 8 years ago • 3 comments

Hi,

I would first like to thank you for providing SimControl functionality, which is quite helpful in testing while implementing any planning algorithms in Apollo. But to still debug the planning module implementation, i currently know only 1 way of printing debug messages and then checking the planning.INFO for the same. Unfortunately this method does not help in case any exception occurs in my implementation, as the none of the Debug messages get logged in this case and it gets really difficult to find the root cause.

My question is how do i perform gdb debug of the planning module for certain routes similar to what we are doing in SimControl. I know how in general to perform gdb debugging but I just do not understand how while gdb debugging to provide the planning module with the routing information similar to what is happening in the SimControl module. Could you please provide some detail into how to do this?

gulshan216 avatar Jul 26 '18 01:07 gulshan216

You can use gdb to debug planning module for it is an independent process. In my experience, I would launch Apollo. Then, find a planning process and attached it by using gdb. Now, you can debug it. Also, you can find input parameters of planning by ps command and then launch it in gdb.

muleisheng avatar Jul 26 '18 08:07 muleisheng

Also you can debug your modules inside VSCode using gdb. You just need make "launch.json" file or correct it if you have one. And fill it with { "name": "C++ Launch MyPlanningModule", "type": "cppdbg", "request": "launch", "program": "${workspaceRoot}/bazel-bin/modules/planning/planning", "miDebuggerServerAddress": "localhost:1111", "preLaunchTask": "start gdbserver for MyPlanningModule", "args": [], "stopAtEntry": false, "cwd": "${workspaceRoot}", "environment": [], "externalConsole": true, "linux": { "MIMode": "gdb" }, "osx": { "MIMode": "gdb" }, "windows": { "MIMode": "gdb" } },

Also You have to change configuration files of planning module to use your planning algorithm as default. P.S. I know that there is an issue in this .json example. But it works ;)

gladijos avatar Aug 02 '18 13:08 gladijos

We will close the issue for now. If you have any additional question, please feel free to open a new issue. Our engineer team are more than happy to help that.

Thank you for supporting Apollo!

yifeijiang avatar Jul 07 '20 18:07 yifeijiang