asked 2011-05-22 05:10:14 -0500
This post is a wiki. Anyone with karma >75 is welcome to improve it.
(Original Author) want(s) to run ROS commands, like e.g. $ ROSCORE, from a C++ application. The following example does not work:
#include <stdlib.h>
int main()
{
system("/opt/ros/diamondback/ros/bin/roscore");
return 0;
}
Execution results in the following message:
Traceback (most recent call last):
File "/opt/ros/diamondback/ros/bin/roscore", line 34, in <module>
from ros import roslaunch
ImportError: No module named ros
Original Author was using Ubuntu 10.04.
Original Author notes that roscore successfully launches the master when executed from the command line
answered 2011-05-23 01:41:56 -0500
This post is a wiki. Anyone with karma >75 is welcome to improve it.
Maybe it is a problem with missing environment variables (python path?). You could try to run bash with the command as parameter, e.g. something like bash -i -c "/opt/ros/diamondback/ros/bin/roscore". -i makes the bash read ~/.bashrc where I assume you source /opt/ros/diamondback/setup.sh.
answered 2011-07-03 23:57:33 -0500
This post is a wiki. Anyone with karma >75 is welcome to improve it.
Why do you want to launch this from inside a program? If you include your program in a launch file the roscore will also be launched.
Asked: 2011-05-22 05:10:14 -0500
Seen: 467 times
Last updated: Aug 06 '12
ROS Answers is licensed under Creative Commons Attribution 3.0 Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.
I accidentally pushed this to the top by correcting the formatting. :P
Asomerville ( 2012-08-06 12:09:08 -0500 )edit