Skip to content
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin move rosruby_tf/rosruby_actionlib/rosruby_tutorials to rosruby_common… Jun 4, 2012
test * wait until simulated time has come Aug 13, 2012
.gitignore use ruby roscore for test Jun 2, 2012
.travis.yml rm rvm from travis Sep 4, 2013
CHANGELOG.rst update change log 0.5.5 Oct 25, 2013
Gemfile - add get_number_of_subscribers/subscribers Jun 9, 2012
LICENSE.txt Add LICENSE file via Aug 16, 2013 Add about indigo Mar 23, 2016
package.xml "0.5.5" Oct 25, 2013
rosruby.rosinstall add Oct 2, 2013

ROS Ruby Client: rosruby

ROS is Robot Operating System developed by OSRF and open source communities.

This project supports ruby ROS client. You can program intelligent robots by ruby, very easily.

Homepage: Git: Author: Takashi Ogura Copyright: 2012 License: new BSD License Latest Version: 0.4.3


  • ruby (1.8.7/1.9.3)
  • ROS (hydro/groovy)


If you are using electric or fuerte, please use v0.2.1.

Install (binary)

sudo apt-get install ros-hydro-rosruby

then you have to source /opt/ros/hydro/setup.bash for ruby library path.

Install from source

Install ROS and ruby first. ROS document is . rosruby uses genrb for message generation. After install genrb, .rb message files are automatically compiled if there are message source package exists in your catkin_ws/src directory.

rosruby uses catkin. If you have not catkin_ws yet, please read this wiki.

$ cd ~/catkin_ws/src
$ git clone
$ git clone
$ cd ~/catkin_ws
$ catkin_make

Install from source (indigo/jade)
Try indigo-devel branch.

$ cd ~/catkin_ws/src/rosruby
$ git checkout indigo-devel
$ cd ~/catkin_ws
$ catkin_make

Message generation
You must generate ROS msg/srv files for rosruby if the msg/srv packages are not compiled from source.
If you are using catkin package, it is easy.
Please add below to your package CMakeLists.txt.

    rosruby_generate_messages(message_pkg1 message_pkg2 ...)

Or, you can generate it manually.
Please use the msg/srv generation script ( in order to
generage rosruby messages.

For example, (please replace `catkin_ws` to your catkin workspace)

$ rosrun rosruby geometry_msgs nav_msgs -d ~/catkin_ws/devel/lib/ruby/vendor_ruby/

If you want to generate msg/srv files from source (for example your project), it is automatically
generated by [genrb](

Sample Source
You can get rosruby sample programs from [rosruby_tutorials]( package.

## Subscriber

#!/usr/bin/env ruby

require 'ros'
require 'std_msgs/String'

node ='/rosruby_sample_subscriber')
node.subscribe('/chatter', Std_msgs::String) do |msg|
  puts "message come! = \'#{}\'"

while node.ok?


## Publisher

#!/usr/bin/env ruby

require 'ros'
require 'std_msgs/String'

node ='/rosruby_sample_publisher')
publisher = node.advertise('/chatter', Std_msgs::String)

msg =

i = 0
while node.ok? = "Hello, rosruby!: #{i}"
  i += 1

Ruby requires 'Start with Capital letter' for class or module names.
So please use **S**td_msgs::String class instead of **s**td_msgs::String.
rosruby message compiler automatically generates messages by the rule.

There are [rosruby_common]( that contains actionlib and tutorials.

Do all tests

[![Build Status](](

Install some packages for tests.

$ sudo apt-get install rake gem
$ sudo gem install yard redcarpet simplecov

run tests.

$ rake test

you can generate API documents using yard.
Document generation needs yard and redcarpet.
You can install these by gem command like this.

$ gem install yard redcarpet

Then try to generate documentds.

$ rake yard

You can access to the generated documents from [here](

catkin and CMakeLists.txt

rosruby's CMakeLists.txt defines some macros for your package that uses rosruby.
you can use these if you add `find_package(rosruby)` to CMakeLists.txt.

* rosruby_setup() : setup some macros and variables for rosruby
* rosruby_generate_messages(message_pkg1 message_okg2 ...) : generates rosruby msg/srv files
* rosruby_add_libraries(files or dirs) : install lib files for devel environment.
You can’t perform that action at this time.