Bolt Haptics : Software - Matlab-ROS-IPC-Bridge browse

Installing IPC Bridge for ROS/Matlab Communication


About

There's no way around it; ROS has a steep learning curve. One way to circumvent this hurdle is to avoid ROS as much as possible and focus on BioTac data analysis in Matlab. The IPC Bridge ROS package will read BioTacHand ROS messages and push them into a Matlab Cell array. These BioTacHand messages can be live messages published at 100Hz by the BioTacs themselves, or through a call to `rosbag play some_collected_data.bag` for playback of ROS bagfile data. This tutorial will guide you through the installation process of IPC Bridge and get you started subscribing to data in Matlab.

Assumptions

  • ROS is currently installed and working on your system
    - see http://www.ros.org/wiki/electric/Installation/Ubuntu
  • Matlab is currently installed
  • You've downloaded the Penn BOLT Git repository into your ROS_PACKAGE_PATH
  • You are running a Linux 2.6 Kernel (`uname -r` to check and replace with your kernel X.X wherever you see 2.6 in these instructions)
  • Basic familiarity with Commandline tools


IPC Bridge Installation

  • Installing IPC - All commands are in your Terminal
    cd ~/Downloads
    wget http://www.cs.cmu.edu/afs/cs/project/TCA/ftp/ipc-3.9.1.tar.gz
    tar xvzf ipc-3.9.1.tar.gz
    cd ipc-3.9.1/
    CFLAGS_EXT="-fPIC" make
    CFLAGS_EXT="-fPIC" make #Yes, a second time after the first one fails!
    sudo cp lib/Linux-2.6/libipc.a /usr/local/lib/
    sudo cp bin/Linux-2.6/central /usr/local/bin/
    sudo cp bin/Linux-2.6/xdrgen /usr/local/bin/
    sudo cp include/ipc.h /usr/local/include/
  • Exporting Mex File Path - Check if yours is already set `echo $MEX`. If that command prints nothing:
    #substitute your Matlab path inside the export
    echo "export MEX=/usr/local/matlabR2009a/bin/mex" >> ~/.bashrc
    source ~/.bashrc
  • Installing IPC Bridge - change directory to your ros_workspace or wherever you typically install user packages within your ROS_PACKAGE_PATH. In my case:
    cd ~/ros
    git clone https://github.com/nmichael/ipc-bridge.git
    rosmake ipc_bridge_ros
    -- Honestly, the only package of these next few that we really need to compile is ipc_rosgraph_msgs. Make sure that one compiles without error --
    roscd ipc_rosgraph_msgs && make
    roscd ipc_std_msgs && make
    roscd ipc_geometry_msgs && make
    roscd ipc_nav_msgs && make
    roscd ipc_sensor_msgs && make
  • Building ipc_biotac_sensors Package - This is a package written specifically for the BioTacs in the Penn Bolt Git repository
    roscd ipc_biotac_sensors && make


Playing BioTac data straight into Matlab

  • Terminal #1
    central -su
  • Terminal #2
    roslaunch ipc_biotac_sensors matlab_biotac_subscriber.launch
  • Terminal #3 - Plug in the BioTacs and run
    rosrun biotac_sensors biotac_pub
    OR w/o BioTacs:
    rosbag play -l some_biotac_bag_file.bag (you can use this -l flag for continuous looping)
  • Terminal #4 - Open up Matlab (if it's not already open)
    navigate to ipc_biotac_sensors/matlab/matlab_biotac_subscriber_example.m
    and press the f5 key to read in your glorious BioTac data!