0
$\begingroup$

Rosanswers logo

I have installed ROS for Windows 10 per the instructions at the link below: http://wiki.ros.org/Installation/Windows

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 myfile.py", 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

Originally posted by anonymous36363 on ROS Answers with karma: 20 on 2019-04-17

Post score: 0


Original comments

Comment by gvdhoorn on 2019-04-17:\

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?

Comment by anonymous36363 on 2019-04-17:
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.

Comment by gvdhoorn on 2019-04-17:\

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.

Comment by gvdhoorn on 2019-04-18:\

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.

Comment by anonymous36363 on 2019-04-18:
Ok, I will respond with edits to the main question from now on.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

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.


Originally posted by anonymous36363 with karma: 20 on 2019-04-19

This answer was ACCEPTED on the original site

Post score: 0


Original comments

Comment by Jim171 on 2019-12-07:
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

Comment by Jim171 on 2019-12-07:
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

PYTHONPATH=C:/opt/ros/melodic/x64\lib/site-packages

PYTHONHOME=C:\opt\python27amd64\

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

Comment by Jim171 on 2019-12-07:
After "set PYTHONPATH=C:/opt/ros/melodic/x64\lib/site-packages;C:\opt\python27amd64\Lib\site-packages", everything works

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.