0
$\begingroup$

Rosanswers logo

I've been playing around with the TurtleSim demo project (and now have draw_square actually drawing a square, except that the precision of the g_goal->theta calculation is not enough to make the 4th side of the square as straight as I would like it).

I've been using catkin_make install -DCMAKE_INSTALL_PREFIX=/opt/ros/hydro to build the project. It works fine and updates the install space of my package. I tried sourcing the install/setup.bash file hoping it would perform the actual install into /opt/ros/hydro but it doesn't. So I've been manually copy/pasting the executables into the /opt/ros folder structure for testing.

I would like to do this the proper way, so I tried performing the above catkin_make command using sudo, thinking that it might be a permission problem. But when I do this, my terminal returns 'catkin_make: command not found'.

Could someone please explain:

  1. Why I'm getting command not found when using sudo catkin_make?

  2. What is the proper way of installing a package so that it can be run using rosrun?

Cheers,

Nap

I installed ROS Hydro using apt-get install.

(I am rather new to Ubuntu, having had lots of Windows experience though.)


Originally posted by Nap on ROS Answers with karma: 302 on 2013-12-12

Post score: 1


Original comments

Comment by Tirjen on 2013-12-12:
Don't know if this will solve the problem, but I can tell you that you cannot run the command catkin_make with sudo. Moreover the command catkin_make should be used in your catkin workspace folder, where are you running it?

Comment by Nap on 2013-12-12:
yes, I'm running it in my catkin workspace. According to the tutorial (wiki.ros.org/catkin/Tutorials/using_a_workspace), it says that sudo might be required.

What I'm really trying to achieve is to be able to install my new version of the TurtleSim project so I can run it using 'rosrun'.

Comment by Tirjen on 2013-12-12:
If you want to run the command catkin_make in sudo, try first 'sudo -s' to get superuser permissions and then run 'catkin_make'. I don't understand well why you want to install the package, you could simply make it and the run it using rosrun, without installing it, but maybe I didn't understand well the question!

Comment by Nap on 2013-12-13:
@Tirjen, so what you're saying is that I can do source install/setup.bash and this would set the path to my new version and rosrun turtlesim draw_square` wlll run my version not the one in /opt/ros/...?

Edit: tested it: yes, that's how it works

$\endgroup$

1 Answer 1

0
$\begingroup$

Rosanswers logo

There are two issues here: permissions and environment. The reason you can't "sudo catkin_make" is that by using sudo, it changes your environment and you no longer have catkin_make on your path. catkin_make ended up on your path when you presumably did "source /opt/ros/hydro/setup.bash".

The second issue here is permissions. You can't install files to /opt because your user doesn't have the rights to. But, there is no reason to install to /opt, you can just do "catkin_make install" and then "source install/setup.bash" from within your workspace and everything that you just built should be on your path. These setup.bash scripts don't install anything or change any locations of files, instead they change your environment variables, specifically the PATH on which to look for executables and libraries. This also helps to explain why you need to source the file every time you create a new shell/terminal instance as your PATH needs to be updated again.

Which brings me to a third point: if your packages are not setup to do installation properly (I'm not sure if that tutorial is), then you might not actually have all your files in the installation. I would actually suggest that you just try your typical "catkin_make" without the install, and then source "devel/setup.bash".


Originally posted by fergs with karma: 13902 on 2013-12-12

This answer was ACCEPTED on the original site

Post score: 4


Original comments

Comment by Nap on 2013-12-13:
and then rosrun will run the built executable instead of the /opt/ros/... version?

Edit: tested: that's how it works.

$\endgroup$

Your Answer

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