OTL / rosruby

ruby ROS client.
http://otl.github.com/rosruby/
BSD 3-Clause "New" or "Revised" License
25 stars 5 forks source link

No module named genrb.generator #35

Open zfxw0206 opened 8 years ago

zfxw0206 commented 8 years ago

I download rosruby and genrb from "https://github.com/OTL/rosruby" and "https://github.com/OTL/genrb" But when I compile them, I got the error message:

Traceback (most recent call last): File "/home/administrator/wspace/src/rosruby/scripts/rosruby_genmsg.py", line 15, in from genrb.generator import msg_generator ImportError: No module named genrb.generator

Does anybody can help me? Thank you!

OTL commented 8 years ago

Hi, thank you for testing rosruby!!!

I have not tested these packages these days, so i dont know if these works well recent ros system.

Could you tell me your environments? OS(ubuntu14.04?osx10.10? or...) and ros distro(indigo?jade? or...)

zfxw0206 commented 8 years ago

ubuntu 14.04 and ros indigo

OTL commented 8 years ago

i see, i'll check it. thanks 2016/03/22 22:15 "zfxw0206" notifications@github.com:

ubuntu 14.04 and ros indigo

— You are receiving this because you commented. Reply to this email directly or view it on GitHub https://github.com/OTL/rosruby/issues/35#issuecomment-199808025

OTL commented 8 years ago

I fixed and uploaded as indigo-devel branch.

https://github.com/OTL/rosruby/tree/indigo-devel

Could you try it?

At least it works in develop environment (I mean that ~/catkin_ws/src/rosruby, genrb) on Indigo/ Ubuntu14.04

zfxw0206 commented 8 years ago

Yes, I tried the publisher and subscriber sample code, it works. Thank you very much! But when I change the message type from string to boolean, there is a problem. Here is my code Publisher:

!/usr/bin/env ruby

require 'ros' require 'std_msgs/Bool'

node = ROS::Node.new('/rosruby_sample_publisher') publisher = node.advertise('/chatter', Std_msgs::Bool) msg = Std_msgs::Bool.new while node.ok? msg.data = 1 publisher.publish(msg) sleep(1.0) end

Subscriber

!/usr/bin/env ruby

require 'ros' require 'std_msgs/Bool'

node = ROS::Node.new('/rosruby_sample_subscriber') node.subscribe('/chatter', Std_msgs::Bool) do |msg| puts "message come! = \'#{msg.data}\'" end while node.ok? node.spin_once sleep(1) end

I ran "rostopic echo /chatter", I could get the data be "true". And when I ran "rostopic info /chatter", I got: Type: std_msgs/Bool Publishers:

Subscribers:

After running the subscriber code, it should print "message come! ...", but It print nothing. Can you tell me what is wrong with me? Thank you again!

OTL commented 8 years ago

Oh, that is bug of genrb. I pushed genrb to fix it, could you update genrb, and try to rebuild?

$ cd ~/catkin_ws/src/genrc
$ git pull
$ cd ~/catkin_ws
$ catkin_make

then, you'll able to use bool message like below. (you can use same subscriber)

#!/usr/bin/env ruby

require 'ros'
require 'std_msgs/Bool'

node = ROS::Node.new('/rosruby_sample_publisher')
publisher = node.advertise('/chatter', Std_msgs::Bool)
msg = Std_msgs::Bool.new
while node.ok?
  msg.data = true #<- bool!
  publisher.publish(msg)
  sleep(1.0)
end

Thank you for great contribution! It might have some trouble in more complicated message, i'm very happy if you let me know.

zfxw0206 commented 8 years ago

Yes, it is working now. Thank you! Now I want to use rosruby to trigger my camera. The sample code is here.This code will set PCIC and send the command to the camera. Is it possible to use rosruby to run this code?

OTL commented 8 years ago

You're welcome! I believe it is possible.

zfxw0206 commented 8 years ago

I tried it just now. It works. Thank you!

zfxw0206 commented 8 years ago

I am sorry, these days, I rebuild my catkin space, I got the same problem "No module named genrb.generator" again. I did nothing with it. Can you help me again? Thank you!

nxdefiant commented 5 years ago

I just had the same error. Problem was I forgot to source the catkin folder setup script.

(Yes I know older question)