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

Matlab-ROS Communication with ipc_bridge_ros

asked 2012-05-04 03:53:40 -0500

mikemodanoxxx gravatar image

Hi there,

i just installed ROS fuerte (ubuntu 11.10 32bit) and now i am trying to establish a connection between matlab and ros. I found this tutorial. Is there a better way to get it working? It was the only solution i found in the web. I started the tutorial and it worked well until point 7. I can't compile the message folders. The first one seems to work, but the second gives me a long error list. Is anyone familiar with the ipc_bridge? Here is the terminal output from the "roscd ipc_std_msgs && make" command:

bash -c "mkdir -p bin" bash -c "rospack find ipc_bridge/generate_msgs.sh ." Generating std_msgs_Bool.h mex -I./include -I/home/simon/ros_workspace/ipc_msgs/ipc_roslib/include -I/home/simon/ros_workspace/ipc_bridge_stack/ipc_bridge_matlab/include -I/home/simon/ros_workspace/ipc_bridge_stack/ipc_bridge/include -I/home/simon/ros_workspace/ipc_bridge_stack/ipc/include -I/home/simon/ros_workspace/ipc_bridge_stack/ipc_bridge/include -lstdc++ -L/home/simon/ros_workspace/ipc_bridge_stack/ipc/lib -lipc mex/std_msgs_Bool.cc -output bin/std_msgs_Bool

Warning: You are using gcc version "4.6.1-9ubuntu3)". The version currently supported with MEX is "4.4.6". For a list of currently supported compilers see: http://www.mathworks.com/support/compilers/current_release/

g++ -I./include -I/home/simon/ros_workspace/ipc_msgs/ipc_roslib/include -I/home/simon/ros_workspace/ipc_bridge_stack/ipc_bridge_ros/include -I/opt/ros/fuerte/include -I/home/simon/ros_workspace/ipc_bridge_stack/ipc/include -I/home/simon/ros_workspace/ipc_bridge_stack/ipc_bridge/include -I/home/simon/ros_workspace/ipc_bridge_stack/ipc_bridge/include -lstdc++ -L/home/simon/ros_workspace/ipc_bridge_stack/ipc/lib -lipc -L/opt/ros/fuerte/lib -lroscpp -lrostime -lrosconsole -lroscpp_serialization -lxmlrpcpp ros/std_msgs_Bool_publisher.cc -o bin/std_msgs_Bool_publisher /tmp/cc4DJBiO.o: In function main': std_msgs_Bool_publisher.cc:(.text+0xc1): undefined reference toros::init(int&, char, std::basic_string<char, std::char_traits<char="">, std::allocator<char> > const&, unsigned int)' std_msgs_Bool_publisher.cc:(.text+0x123): undefined reference to ros::NodeHandle::NodeHandle(std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, std::map<std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::less<std::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::allocator<std::pair<std::basic_string<char, std::char_traits<char>, std::allocator<char> > const, std::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > const&)' std_msgs_Bool_publisher.cc:(.text+0x321): undefined reference toros::this_node::getName()' std_msgs_Bool_publisher.cc:(.text+0x372): undefined reference to ros::console::g_initialized' std_msgs_Bool_publisher.cc:(.text+0x381): undefined reference toros::console::initialize()' std_msgs_Bool_publisher.cc:(.text+0x3d2): undefined reference to ros::console::initializeLogLocation(ros::console::LogLocation*, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, ros::console::levels::Level)' std_msgs_Bool_publisher.cc:(.text+0x40e): undefined reference toros::console::setLogLocationLevel(ros::console::LogLocation, ros::console::levels::Level)' std_msgs_Bool_publisher.cc:(.text+0x41a): undefined reference to ros::console::checkLogLocationEnabled(ros::console::LogLocation*)' std_msgs_Bool_publisher.cc:(.text+0x44b): undefined reference toros::this_node::getName()' std_msgs_Bool_publisher.cc:(.text+0x4a0): undefined reference to ros::console::print(ros::console::FilterBase*, log4cxx::Logger*, ros::console::levels::Level, char const*, int, char const*, char const*, ...)' std_msgs_Bool_publisher.cc:(.text+0x4b1): undefined reference ... (more)

edit retag flag offensive close merge delete

4 Answers

Sort by » oldest newest most voted
0

answered 2012-05-05 05:30:23 -0500

sj haque gravatar image

I just went through same problem recently, the solution is pretty long.

  1. you have to install older version of GCC (4.0 or 4.1 or 4.2) in your system. I could not install it through Apt-get so had to manulay install it after downloading the setup. (I am using Ubuntu 10.04)
  2. Update in the symbolic links of Matlab ( user/.matlab/(MatlabVersion)/mexopts.sh) from "gcc" to version u installed, (eg: "gcc" to "gcc-4.1").
  3. Next problem I faced which you will also face probably. will be error in matlab while compiling "libstdc++.so.6:version GLIBCxx_3.4.9 not found". problem:ipc_bridge is expecting the above version of libstdc++, but matlab refers to the libstdc++ version which was shipped with itself. Solution:
    • check if libstdc++.so.6 is present in "usr/lib/libstdc++.so.6". If not then install the package
    • Update the "LDPATH_PREFIX" variable in file (MATLABINSTALLATIONPATH/bin/.matlab7rc.sh) for OPENGL to point to "usr/lib/libstdc++.so.6"
    • Still Matlab will try to override the pointer to its own libstdc++. So remove all c++ and g++ related files from (MatlabInstallation/sys/os/glnx86). So Matlab has no choice but to use the library you installed. (may cause a bit of unstability in matlab)

PS:Backup Every file you edit or Remove.

edit flag offensive delete link more
1

answered 2012-08-26 12:10:21 -0500

Gus gravatar image

I had the exact same problem while using ROS Fuerte in Ubuntu 12.04, and MATLAB 2012a. You don’t need to roll back to an earlier version of Ubuntu the problem is in the the gcc and g++ symbolic links. On my Ubuntu 12.04 I had two versions so I changed the symbolic links in /usr/bin to the 4.4 versions by navigation to the directory and using the following code:

ln -s g++ g++-4.4 ln -s gcc gcc-4.4

I also changes the symbolic links to MATLAB's libstdc++.so.6 as shown in the answer at the link below: http://answers.ros.org/question/33326/matlab-engine-and-ros-library-incompatible/

Everything compiled fine and I was able to run the MATLAB publisher and subscriber tutorials at: https://alliance.seas.upenn.edu/~meam620/wiki/index.php?n=Roslab.IpcBridge

edit flag offensive delete link more
0

answered 2012-11-08 03:28:26 -0500

FTrommsdorff gravatar image

updated 2012-11-08 03:29:26 -0500

There is another way: using (I guess) any UNIX-system, you can force Matlab to use any installed gcc version (which is possible, because there can exist more than one installed version of gcc). This worked for me (of course adopting all paths and gcc-version to your required settings):

http://www.mister-blogbuster.de/2011/03/matlab-eine-andere-gcc-version-zuordnen/

edit flag offensive delete link more
0

answered 2012-05-12 07:42:53 -0500

mikemodanoxxx gravatar image

Thanks i switched to ubuntu 10.04 and had to compile gcc-4.2 by myself (i didn't find any packages to install it, where did you get it from btw?) and now it works. I hope there will be a better solution soon. I will continue trying to get it work with newer ubuntu versions and without the old gcc-compiler..

edit flag offensive delete link more

Question Tools

1 follower

Stats

Asked: 2012-05-04 03:53:40 -0500

Seen: 691 times

Last updated: Nov 08 '12