Ask Your Question

JeffBlumenthal's profile - activity

2019-10-29 23:15:06 -0600 received badge  Famous Question (source)
2019-10-29 23:15:06 -0600 received badge  Notable Question (source)
2018-09-09 16:51:44 -0600 received badge  Famous Question (source)
2018-08-24 08:43:15 -0600 marked best answer ROS Debugging VSCode Python

Hi Everyone,

I have read/tried various solutions in an attempt to debug ROS in VS Code without any luck. Can I please get some help in solving this mystery?

My workspace runs fine from when I run from an Ubuntu terminal prompt and from an IDE terminal prompt. source devel/setup.bash rosrun location tagsub.py

My env: Ubuntu 16.04 VS Code IDE ROS extension installed

My ROS package: Name: location Simple pub/sub with a custom message

From an Ubuntu terminal prompt I go to my workspace root, and start code. In VS Code terminal (which is on my workspace root), run catkin build then roscore. In the lower left corner of IDE, ROS Master now has a check mark.

I then created a launch configuration by:

  1. clicking on the debug icon on the left most part of the IDE
  2. clicking on the gear icon on the upper left section of the IDE, this opens a new launch.json file
  3. click on the the button Add Configuration...(in the lower right of the window). This pulls up a window of choices
  4. choose {} ROS : rosrun
  5. Here is my launch entry:

    {
      "request": "launch",
      "type": "ros",
      "command": "rosrun",
      "name": "rosrun",
      "package": "location",
      "target": "tagsub.py",
      "debugSettings": "debugSettings"
    }
    
  6. Click on my source file tagsub.py file tag in the editer window

  7. Press F5

The debug process starts and get this error: Exception has occurred: str

'No module named rospy'
  File "/home/zzfl0b/location/src/location/scripts/tagsub.py", line 3, in <module>
  File "/usr/lib/python2.7/runpy.py", line 72, in _run_code
  File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main

In IDE terminal pip list | grep ros returns:

gazebo-ros                    2.5.17
rosbag                        1.12.13
rosboost-cfg                  1.14.3
rosclean                      1.14.3
roscreate                     1.14.3
rosgraph                      1.12.13
roslaunch                     1.12.13
roslib                        1.14.3
roslint                       0.11.0
roslz4                        1.12.13
rosmake                       1.14.3
rosmaster                     1.12.13
rosmsg                        1.12.13
rosnode                       1.12.13
rosparam                      1.12.13
rospy                         1.12.13
rosservice                    1.12.13
rostest                       1.12.13
rostopic                      1.12.13
rosunit                       1.14.3
roswtf                        1.12.13
smach-ros                     2.0.1
tf2-ros                       0.5.17

Also from an IDE terminal prompt,

$ env | grep ros:
ROS_ROOT=/opt/ros/kinetic/share/ros
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
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
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
PYTHONPATH=/home/jeff/location/devel/lib/python2.7/dist-packages:/opt/ros/kinetic/lib/python2.7/dist-packages
PKG_CONFIG_PATH=/home/jeff/location/devel/lib/pkgconfig:/opt/ros ...
(more)
2018-08-24 08:43:15 -0600 received badge  Scholar (source)
2018-08-23 13:15:44 -0600 commented answer ROS Debugging VSCode Python

Thank you for your response/help. So step 4 runs the node and step 6 attaches to it? In the launch.json I have program

2018-08-23 13:13:42 -0600 commented answer ROS Debugging VSCode Python

Thank you for your response/help. So step 4 runs the node and step 6 attaches to it? In the launch.json I have program

2018-08-23 06:20:02 -0600 received badge  Notable Question (source)
2018-08-21 10:09:40 -0600 commented question ROS Debugging VSCode Python

@Choco93, can you please be more specific on how to do this? I have also tried running source devel/setup.bash from a la

2018-08-21 10:07:26 -0600 received badge  Popular Question (source)
2018-08-20 08:31:43 -0600 asked a question ROS Debugging VSCode Python

ROS Debugging VSCode Python Hi Everyone, I have read/tried various solutions in an attempt to debug ROS in VS Code with

2018-07-31 22:10:01 -0600 received badge  Taxonomist
2018-07-17 07:56:26 -0600 received badge  Popular Question (source)
2018-05-11 09:18:25 -0600 asked a question [mavros-2] killing on exit

[mavros-2] killing on exit Hi Everyone, I'm trying to get mavros to startup on boot. Jetson TX2 Ubuntu 16.04 Kinetic H

2018-04-26 07:30:54 -0600 received badge  Enthusiast
2018-04-13 09:25:56 -0600 received badge  Supporter (source)
2018-03-01 08:42:58 -0600 commented answer Installing ROS Kinetic on Ubuntu 16.04: apt-get update fail

The link you posted got shortened: https://packages.ubuntu.com/xenial/al.. Can you please post a valid link? Tks