Ask Your Question

How to get rospack, roslaunch, etc. to work in Windows 10 (Melodic)

asked 2019-04-17 10:55:53 -0600

RobotRiley gravatar image

updated 2019-04-18 07:57:19 -0600

I have installed ROS for Windows 10 per the instructions at the link below:

I am having trouble figuring out where to place my workspace and packages such that they are able to use standard ROS commands. roscd brings me to C:\opt\ros\melodic\x64

I created a workspace in that directory, but none of the packages inside are recognized. I am able to start roscore and then manually start nodes with "python", but I can't run launch files without going into the directory with the launch file and I can't use roscd package_name to jump to a package, nor use rospack package_name to find a package I create. Using the list parameter I can see the packages in the share subdirectory (of x64), but not my packages.

Are there any additional steps I need to make these commends work, or a special directory I need to put my workspace in?

Edit: I open up a command window shortcut which automatically runs c:\opt\ros\melodic\x64\setup.bat

I then use roscd to jump to c:\opt\ros\melodic\x64

I create a workspace folder (catkin_ws) there with a folder called src inside.

I run catkin_make inside or the workspace folder. This creates build and devel folders inside of the workspace folder and create a CMakeLists.txt file in the src folder.

Inside the src folder I type catkin_create_pkg test_package std_msgs rospy roscpp

There is now a test_package folder with the include and src folders, as well as CMakeLists.txt and package.xml files.

I then return to the workspace folder and run catkin_make again.

Then I run the setup.bat file in the devel folder of the workspace.

I don't have enough characters left to list all of the files and folders, but the above is what I do to get things set up.

Edit #2:

The output of rospack profile:

Full tree crawl took 0.765600 seconds. Directories marked with (*) contain no manifest. You may want to delete these directories. To get just of list of directories without manifests, re-run the profile with --zombie-only
0.718767   C:\opt\ros\melodic\x64\share
0.000000   C:\opt\ros\melodic\x64\share\doc\liborocos-kdl
0.000000   C:\opt\ros\melodic\x64\share\doc
edit retag flag offensive close merge delete


Are there any additional steps I need to make these commends work, or a special directory I need to put my workspace in?

Just making sure: you did build your workspace, correct?

gvdhoorn gravatar imagegvdhoorn ( 2019-04-17 12:43:01 -0600 )edit

As far as I know I did. I have been using those steps on the Ubuntu machine I was working on with no problems, but on the Windows computer I feel that I am missing something.

RobotRiley gravatar imageRobotRiley ( 2019-04-17 13:31:13 -0600 )edit

As far as I know I did.

So: please tell us exactly which commands you've run, how you created your workspace, what's in it and what you did after building it.

gvdhoorn gravatar imagegvdhoorn ( 2019-04-17 13:33:24 -0600 )edit

I run catkin_make inside or the workspace folder.

This should probably read: "inside of the workspace folder"?

Then I run the setup.bat file in the devel folder of the workspace.

If you did this, what is the output of rospack profile?

I don't have enough characters left to list all of the files and folders,

don't use comments for this sort of thing. Update your original question text by editing it.

gvdhoorn gravatar imagegvdhoorn ( 2019-04-18 01:12:21 -0600 )edit

Ok, I will respond with edits to the main question from now on.

RobotRiley gravatar imageRobotRiley ( 2019-04-18 07:58:01 -0600 )edit

1 Answer

Sort by ยป oldest newest most voted

answered 2019-04-19 15:43:06 -0600

RobotRiley gravatar image

updated 2019-04-19 19:26:01 -0600

jayess gravatar image

The solution I found was to type the following at the command line from my ROS shortcut:

choco upgrade ros-melodic-desktop -y

choco upgrade ros-melodic-desktop_full -y

For reference, the shortcut target is:

C:\Windows\System32\cmd.exe /k "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64 && c:\opt\ros\melodic\x64\setup.bat

I'm not sure if only one of those commands was needed, but I ran both. After that I appended the location of my workspace batch file to the shortcut target listed above:

&& %USERPROFILE%\catkin_ws\devel\setup.bat

Doing these things gave me access to the normal ROS syntax (rospack, rosrun, etc.) for my packages. Please note that you have to use the shortcut to open your command line window in order for it to work.

edit flag offensive delete link more


I just installed ROS for Windows. Same melodic distribution that you have. I have same kind of problems. Did you make catkin_ws under "c:\opt\ros\melodic\x64" ? In you last comment, you said you add this line to ROS cmd shortcut "%USERPROFILE%\catkin_ws\devel\setup.bat" So did you make catkin_ws folder under %USERPROFILE% folder (normally "c:\user\name") or under "c:\opt\ros\melodic\x64" ?

Easiest way might be to use Ubuntu, but hope I can get this work with windows

Jim171 gravatar imageJim171 ( 2019-12-07 08:36:28 -0600 )edit

I just understood, that Workspace can be anywhere, just remember to run the \devel\setup.bat from that workspace. So now Python nodes works ok.

When I build with catkin_make nodes written with c++, I get error

"ImportError: "from catkin_pkg.package import parse_package" failed: No module named catkin_pkg.workspaces Make sure that you have installed "catkin_pkg", it is up to date and on the PYTHONPATH. CMake Error at C:/opt/ros/melodic/x64/share/catkin/cmake/safe_execute_process.cmake:11 (message):"

catkin_pkg is installed at catkin_pkg-folder is "C:\opt\python27amd64\Lib\site-packages" folder



But catkin_make prints on the command promp before error "%USERPROFILE%/.windows-build-tools/python27/python2.exe"

So there is 2 Python2 directories. /.windows-build-tools/python27 and \opt\python27amd64 First is installed by VisualCodeC++ enviroment and second by ROS

Jim171 gravatar imageJim171 ( 2019-12-07 11:11:17 -0600 )edit

After "set PYTHONPATH=C:/opt/ros/melodic/x64\lib/site-packages;C:\opt\python27amd64\Lib\site-packages", everything works

Jim171 gravatar imageJim171 ( 2019-12-07 12:20:05 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower


Asked: 2019-04-17 10:55:53 -0600

Seen: 469 times

Last updated: Apr 19