0
$\begingroup$

Rosanswers logo

Using Ubuntu 10.04 Lucid and ROS Electric. I had successfully installed the NXT packages for ROS and tested them with my brick. Everything seemed to be going well. I'm trying to do the NXT tutorials:

Entered: roscd nxt

Brought me to: /opt/ros/electric/stacks/nxt

Entered: roscreate-pkg learning_nxt rospy nxt_ros

Returned:

Traceback (most recent call last):
  File "/opt/ros/electric/ros/bin/roscreate-pkg", line 35, in <module>
    roscreate.roscreatepkg.roscreatepkg_main()
  File "/opt/ros/electric/ros/tools/roscreate/src/roscreate/roscreatepkg.py", line 125, in roscreatepkg_main
    create_package(package, author_name(), depends, uses_roscpp=uses_roscpp, uses_rospy=uses_rospy)
  File "/opt/ros/electric/ros/tools/roscreate/src/roscreate/roscreatepkg.py", line 63, in create_package
    os.makedirs(p)
  File "/usr/lib/python2.6/os.py", line 157, in makedirs
    mkdir(name, mode)
OSError: [Errno 13] Permission denied: '/opt/ros/electric/stacks/nxt/learning_nxt'

Before this I had been using roscreate-pkg just fine with the regular ROS tutorials. Now that I'm trying to use it with the NXT packages, it seems to not work.

EDIT 1: In reply to Lorenz, thank you. That is one thing that has confused me about the differences between Fuerte and Electric. In the installing Electric tutorial page, overlays aren't mentioned and I feel like my bashrc isn't setup the way it should be, even though I followed the isntructions verbatim from the install and configuration tutorials. The last three lines of my bashrc are currently (before applying Lorenz's update):

source /opt/ros/electric/setup.bash
export ROS_PACKAGE_PATH=~/ros_workspace:/opt/ros/electric/stacks
export ROS_WORKSPACE=~/ros_workspace

I also don't understand why roscreate-pkg works fine when I use it without NXT in mind.

EDIT 1.1: I ran all of Lorenz's suggested commands verbatim. After trying to run the command: rosws set ~/ros_overlay/sandbox

I get this:

     Add element: 
 {'other': {'local-name': '/home/noah/ros_overlay/sandbox'}}
Continue(y/n): y
Overwriting /home/noah/ros_workspace/.rosinstall
Traceback (most recent call last):
  File "/usr/local/bin/rosws", line 66, in <module>
    sys.exit(rosinstall.rosws_cli.rosws_main(sys.argv))
  File "/usr/local/lib/python2.6/dist-packages/rosinstall/rosws_cli.py", line 519, in rosws_main
    return ws_commands[command](workspace, args)
  File "/usr/local/lib/python2.6/dist-packages/rosinstall/multiproject_cli.py", line 318, in cmd_set
    shutil.move(os.path.join(config.get_base_path(), self.config_filename), "%s.bak"%os.path.join(config.get_base_path(), self.config_filename))
  File "/usr/lib/python2.6/shutil.py", line 264, in move
    copy2(src, real_dst)
  File "/usr/lib/python2.6/shutil.py", line 99, in copy2
    copyfile(src, dst)
  File "/usr/lib/python2.6/shutil.py", line 52, in copyfile
    fsrc = open(src, 'rb')
IOError: [Errno 2] No such file or directory: '/home/noah/ros_workspace/.rosinstall'

Notice the last line.

EDIT 1.2: All of the commands ran fine up to: rosws set ~/ros_overlay/sandbox

The output of the following command is below: ls -l ~/ros_workspace

drwxr-xr-x 11 noah noah 4096 2012-06-25 09:18 beginner_tutorials

I found the .rosinstall in the ~/ros_overlay instead of ~/ros_workspace

Is there a way to move it or modify the command?

Also, I haven't changed anything since I first entered the rosws set command, but now there is a new error output for it:

ERROR: Ambiguous workspace: ROS_WORKSPACE=/home/noah/ros_workspace, /home/noah/ros_overlay/.rosinstall

EDIT 1.3: I feel like the issue isn't with my workspaces or whatnot. I feel like it is with the actual NXT Tutorial. The tutorial tells me to roscd to the NXT directory and then run the create package command. By me being in the NXT directory, /opt/ros/electric/stacks/nxt, won't running roscreate-pkg attempt to create my package in the current directory instead of my workspace? In the Creating Package tutorial, the user is told to roscd into their workspace before creating the package.


Originally posted by Nezteb on ROS Answers with karma: 32 on 2012-06-25

Post score: 0


Original comments

Comment by Lorenz on 2012-06-25:
That's interesting. The rosws init should actually create the .rosinstall file in ~/ros_workspace. Did you get any errors while executing rosws init? After executing it, what's the output of ls -l ~/ros_workspace?

Comment by dornhege on 2012-06-25:
re EDIT 1: Your .bashrc had a workspace setup correctly (for electric). The reason for the error is that you tried to create a package in the installed nxt stack instead of your home workspace. This is always bad and independent of electric or fuerte.

Comment by Lorenz on 2012-06-25:
As I said at the end of my question, you should call roscreate in ~/ros_overlay/sandbox. Ignore what the NXT tutorial or any other tutorial says about where to create packages :) and always use your sandbox dir. The NXT tutorial probably assumes an installation from source.

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

You should never try to edit, create or change files in /opt/ros/.... Instead, create a overlay in your home directory. To create an overlay for electric, just execute the following commands:

sudo apt-get install python-pip
sudo pip install -U rosinstall
rosws init ~/ros_overlay /opt/ros/electric
mkdir ~/ros_overlay/sandbox
source ~/ros_overlay/setup.bash
rosws set ~/ros_overlay/sandbox

Now open your ~/.bashrc and change the line

source /opt/ros/electric/setup.bash

to

source ~/ros_overlay/setup.bash

Now close and re-open your terminal and execute the command roscreate-pkg in ~/ros_workspace/sandbox.


Originally posted by Lorenz with karma: 22731 on 2012-06-25

This answer was ACCEPTED on the original site

Post score: 2


Original comments

Comment by Lorenz on 2012-06-25:
Ah. Sorry. I screwed up the source line. Edited my question to fix it. Of course you should source the setup.bash in ros_overlay, not in ros_workspace.

Comment by Lorenz on 2012-06-25:
There was another mistake in the commands above. I forgot that you have to source setup.bash before calling rosws set, instead your ROS_WORKSPACE variable is not set correctly. Sorry for that.

$\endgroup$

Your Answer

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