Now have the below configuration for your VSCode's launch. Once the VSCode connects, it starts the execution. This snippet will pause the execution further and wait for VSCode to connect. It would be best if you had the below snippet always at the top: #!/usr/bin/python Press the green Start button and then Enter to confirm the suggested file readme.md. VS Code will let you select an 'debugger' in order to create a default launch configuration. The contents of the file should be following: #!/usr/bin/python Switch to the Run and Debug view ( D (Windows, Linux Ctrl+Shift+D)) and select the create a launch.json file link. Hope this helps.Īssume the file we want to run using the ROS launch file is test.py. It seems lengthy but most of it is just one time configuration thing, once that is done you can change node name and path in configuration to work with any other python node. Once configured you can chose that configuration and press play button it will pop-up a list of available process to link against, select your node from it, it will ask for password and then you can debug.Then go into VSCode and debug mode (ctrl+shift+D), you will see green play button on top right press that, it will probably prompt to launch a json, open it and configure it for your python node see here.When it's built, source devel_debug/setup.bash and run your node.Then build your package in debug mode add a flag when building CMAKE_BUILD_TYPE=debug.build_space: build_debug & devel_space: devel_debug. Go into debug and change build.yaml and config.yaml to not to have build and devel but to have debug_devel and build_devel (again you can name them anything). Go into profiles and make a copy of your default profile. catkin_tools, and a sub folder called profiles. Go into your workspace and show hidden folders (ctrl+h).There might be other ways but this is one I know: PKG_CONFIG_PATH=/home/jeff/location/devel/lib/pkgconfig:/opt/ros. PYTHONPATH=/home/jeff/location/devel/lib/python2.7/dist-packages:/opt/ros/kinetic/lib/python2.7/dist-packages PATH=/opt/ros/kinetic/bin:/usr/local/cuda/bin:/usr/local/cuda/bin:/home/jeff/bin:/home/jeff/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin LD_LIBRARY_PATH=/home/jeff/location/devel/lib:/opt/ros/kinetic/lib:/opt/ros/kinetic/lib/x86_64-linux-gnu:/usr/local/cuda/lib64:/usr/local/cuda/lib64 ROS_PACKAGE_PATH=/home/jeff/location/src/roscpp:/home/jeff/location/src/rospy:/home/jeff/location/src/std_msgs:/home/jeff/location/src/location:/opt/ros/kinetic/share Note: If this command does not work, you may need to restart your. If you use the Insiders version of VS Code, you will have to run code-insiders. argument tells VS Code to open the current folder. In IDE terminal pip list | grep ros returns: gazebo-ros 2.5.17Īlso from an IDE terminal prompt, $ env | grep ros: In the WSL terminal, make sure you are in the helloWorld folder, and type in code. The debug process starts and get this error:Įxception has occurred: str 'No module named rospy'įile "/home/zzfl0b/location/src/location/scripts/tagsub.py", line 3, in įile "/usr/lib/python2.7/runpy.py", line 72, in _run_codeįile "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main This pulls up a window of choicesĬlick on my source file tagsub.py file tag in the editer window click on the the button Add Configuration.(in the lower right of the window).clicking on the gear icon on the upper left section of the IDE, this opens a new launch.json file.clicking on the debug icon on the left most part of the IDE.I then created a launch configuration by: In the lower left corner of IDE, ROS Master now has a check mark. In VS Code terminal (which is on my workspace root), run catkin build then roscore. My workspace runs fine from when I run from an Ubuntu terminal prompt and from an IDE terminal prompt.įrom an Ubuntu terminal prompt I go to my workspace root, and start code. Can I please get some help in solving this mystery? Maybe the other debugger was trying to run there? Figure with a fresh restart 5678 should work.I have read/tried various solutions in an attempt to debug ROS in VS Code without any luck. I changed the code in app_debug_vscode.py to use debugpy like this: """Use this module for development with VS Code and the integrated debugger"""įor more info see the Īlso I had to change the port to 5679 (here and on launch.json) because 5678 refused to work saying it was already in use. I did manage to get it to work by using debugpy in a similar way to what they do here : I tried applying the solution for the integrated debugger on it only to find ptvsd is no longer supported: Hey you for this very useful discussion and article.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |