ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

HZ's profile - activity

2019-07-24 10:37:10 -0500 received badge  Enlightened (source)
2019-07-24 10:37:10 -0500 received badge  Good Answer (source)
2016-02-19 12:39:21 -0500 received badge  Nice Answer (source)
2016-02-19 12:38:54 -0500 received badge  Nice Question (source)
2014-01-28 17:22:51 -0500 marked best answer Running ROS as a root user

Hi All,

Some of my ROS nodes need to be run as a root user. I can do this by "sudo su" under Ubuntu and "source" setup.bash. My programs seem to be running correctly. An annoying issue is that, when I try to use "tab completion" to complete the package name in the terminal (e.g., rosrun package_name executable_name), I got some warnings as follows:

[rospack] WARNING: cannot create rospack cache directory: Permission denied
[rospack] WARNING: cannot create rospack cache directory: Permission denied
[rospack] Unable to create temporary cache file /root/.ros/.rospack_cache.bGXJPX: Permission denied

I have done this: chmod -R a+rwx /root/.ros/, but above warnings still come out.

Any suggestion for solving this problem is appreciated.

2014-01-28 17:22:46 -0500 marked best answer launch a node within another node

Hi All,

I have two nodes: A and B implemented in C++. Now I want Node A to be launched (by the program, not by users' input in the terminal) within the execution of Node B that is launched by users in the terminal. Is there a ROS way to do this? Or should I just encode a shell command in B's source code to launch A, like executing a shell command in C++ programs?

Thanks,

2014-01-28 17:22:45 -0500 marked best answer rosmake or rosbuild?

Hi All,

I want to develop some ROS packages which contain libraries for other packages to use, and have some questions about the development process:

1) Should I use rosmake or rosbuild to compile and build my packages? 2) Which files should I modify to create libraries (.so files) instead of executables?

Thanks, HZ

2013-11-18 18:49:24 -0500 received badge  Taxonomist
2013-05-22 06:42:07 -0500 received badge  Famous Question (source)
2013-05-22 06:42:07 -0500 received badge  Notable Question (source)
2013-05-06 05:35:52 -0500 marked best answer a problem of linking external libraries

Hi All,

I encountered a problem while linking a ROS program against some external libraries. I am trying to link my ROS program against Xenomai libraries. To make sure Xenomai libraries have been successfully installed in my OS (Ubuntu 10.10), I built a simple program (non-ROS) with gcc like this:

gcc -I/usr/xenomai/include -D_GNU_SOURCE -D_REENTRANT -D__XENO__ -Wall -pipe -lnative -L/usr/xenomai/lib -lxenomai -lpthread -lrtdk hellworld.c -o helloworld

No problems arise here, and I got the executable.

To build my ROS programs (take as an example the tutorial program at the ROS website ), I add the following commands to CMakeLists.txt:

rosbuild_add_executable(listener src/listener.cpp)
include_directories(/usr/xenomai/include)
add_definitions(-D_GNU_SOURCE -D_REENTRANT -D__XENO__)
rosbuild_add_compile_flags(listener -Wall -pipe)
link_directories(/usr/xenomai/lib)
target_link_libraries(listener native xenomai pthread rtdk)

That says, I want to link the “listener” node against some Xenomai libraries, like “native”, “xenomai”, etc. However, when I rosmake’d the whole package, I got this error:

  Linking CXX executable ../bin/listener
  /usr/bin/ld: cannot find -lnative
  /usr/bin/ld: cannot find -lxenomai
  collect2: ld returned 1 exit status

It seems rosbuild did not search libraries in “/usr/xenomai/lib” which is supposed to specified by link_directories(/usr/xenomai/lib). Did I miss something to tell rosbuild to search libraries in “/usr/xenomai/lib”?

With many thanks,

2013-01-10 19:51:53 -0500 received badge  Famous Question (source)
2013-01-10 19:51:53 -0500 received badge  Notable Question (source)
2013-01-10 19:51:53 -0500 received badge  Popular Question (source)
2012-10-12 03:48:08 -0500 received badge  Notable Question (source)
2012-10-12 03:48:08 -0500 received badge  Famous Question (source)
2012-08-28 19:35:53 -0500 received badge  Famous Question (source)
2012-08-28 19:35:53 -0500 received badge  Popular Question (source)
2012-08-28 19:35:53 -0500 received badge  Notable Question (source)
2012-08-22 23:11:33 -0500 received badge  Famous Question (source)
2012-05-27 12:02:22 -0500 received badge  Notable Question (source)
2012-04-18 06:17:38 -0500 received badge  Popular Question (source)
2012-04-12 05:38:32 -0500 received badge  Popular Question (source)
2012-02-25 17:21:07 -0500 received badge  Popular Question (source)
2011-11-16 09:42:22 -0500 marked best answer Running ROS as a root user

You could add the ROS_PACKAGE_PATH to the root user's .bashrc. In Ubuntu, this is taboo, but in systems where you act as the root user often, it could be helpful.

2011-11-03 08:10:05 -0500 marked best answer launch a node within another node

The usual ROS way is running them both from a roslaunch script.

2011-10-25 20:18:08 -0500 marked best answer rosmake or rosbuild?

From the rosbuild wiki page:

"To build packages, use rosmake."

rosbuild is the name of the library of build-support tools; rosmake is the command you run to actually build stuff. Assuming you're developing your code just for ROS use (as distinct from implementing a ROS wrapper around some library that needn't be / isn't ROS-aware), you should do everything in CMakeLists.txt in your package's root directory. (Everything except setting the exports; that's in manifest.xml).

If you want to compile libraries, use the rosbuild_add_library macro; see the rosbuild wikipage for some examples, and the default CMakeLists.txt that roscreate-pkg gives you.

2011-10-20 15:55:54 -0500 asked a question how to recompile cv_bridge w/o optimization

Hi All,

For some particular reason, I need to step into /opt/ros/electric/stacks/vision_opencv/cv_bridge/src/cv_bridge.cpp for debugging purpose, and I want to examine the value of int source_type in the function of toCvCopy. However, when I print source_type in gdb, it says "value optimized out". So how can I re-compile & build cv_bridge without optimization, so I can examine the value of source_type?

Thanks

2011-09-26 04:02:52 -0500 marked best answer a problem of linking external libraries

After some googling, I found this. I think I can now answer the problem myself: It turned out that I need to place link_directories(/usr/xenomai/lib) before rosbuild_add_executable(listener src/listener.cpp), that is,

link_directories(/usr/xenomai/lib)
rosbuild_add_executable(listener src/listener.cpp)
include_directories(/usr/xenomai/include)
add_definitions(-D_GNU_SOURCE -D_REENTRANT -D__XENO__)
rosbuild_add_compile_flags(listener -Wall -pipe)
target_link_libraries(listener native xenomai pthread rtdk)

Is this a bug, or a restriction of CMake? Is it documented somewhere?