Search code examples
pythonpycharmros

How to import ros to PyCharm


I am developing a robot using the ros framework. As ide, I use PyCharm. But I can’t import ros into it. On the ros site there is the article about ide http://wiki.ros.org/IDEs. There is information about using ros with pycharm. I have to modify the .desktop file, but I installed PyCharm using a snap from the software center. Where can I find the .desktop file for snap applications? Can there be another method to import ros into PyCharm?

Edit: @hug Yes, I launched this command here is the result

/snap/pycharm-community/103/meta/gui/pycharm-community.desktop
/snap/pycharm-community/103/snap/gui/pycharm-community.desktop
/var/lib/snapd/desktop/applications/pycharm-community_pycharm-community.desktop
/var/tmp/pycharm-community.desktop.swp

I think that the .swp file has remained since the last reinstallation of PyCharm. I reinstalled when I tried to do it myself and realized that I had broken the program.


Solution

  • If you want to use from the auto-suggestion with ROS packages in Pycharm IDE, you could do the following instructions:

    1. File > Settings (or Ctrl+Alt+s as shortcut)> Project: > Project interpreter.

    2. In the project interpreter dropdown list, you can specify ROS Python interpreter by selecting the appropriate from the list.


    [NOTE]:

    You could add a virtual environment with the above instructions, then you should add ROS distpackages (roslib) on it with this instruction.

    ROS distpackages path that you need: /opt/ros/kinetic/lib/python2.7/distpackages