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

Usage of rosbridge with python

asked 2018-09-28 05:14:29 -0600

aks gravatar image

updated 2019-10-07 03:46:54 -0600

knxa gravatar image

I have a ROS installation on 1 pc. I want to subscribe to the ROS messages in my 2nd PC where there is no ROS installed. I just came across Rosbridge.

  1. Is this the ideal way for my use case ?
  2. There are many js examples online, is there also a simple python example wherein I can just receive some ros messages (just for the first test, maybe on the chatter topic). I just need to understand the workflow.
edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
0

answered 2019-10-07 03:35:51 -0600

knxa gravatar image

I know the question is old, but anyway:

  1. Yes

  2. Take a look at roslibpy

edit flag offensive delete link more

Comments

re: roslibpy: this may actually be more/also interesting. Plain rospy Windows.

gvdhoorn gravatar image gvdhoorn  ( 2019-10-07 04:10:48 -0600 )edit

I am also trying to make python and rosbridge work together However, in the terminal, type this when I run: importerror: no module named roslibpy What could be the problem

bela gravatar image bela  ( 2021-10-11 07:37:14 -0600 )edit
0

answered 2021-10-11 06:33:37 -0600

siddharthcb gravatar image

updated 2021-10-11 06:34:23 -0600

Try this for python.

 pip3 install roslibpy

roslibpy works for non-ros/windows env too.

import time
import roslibpy

client = roslibpy.Ros(host='localhost', port=9090)  #same as rosbridge port
client.run()

talker = roslibpy.Topic(client, '/chatter', 'std_msgs/String')

while client.is_connected:
    talker.publish(roslibpy.Message({'data': 'Hello World!'}))
    print('Sending message...')
    time.sleep(1)

talker.unadvertise()

client.terminate()
edit flag offensive delete link more

Question Tools

2 followers

Stats

Asked: 2018-09-28 05:14:29 -0600

Seen: 1,320 times

Last updated: Oct 11 '21