Skip to content
This repository has been archived by the owner on Mar 17, 2019. It is now read-only.

Problems with Python 2.7 #7

Open
awesomebytes opened this issue Nov 26, 2015 · 4 comments
Open

Problems with Python 2.7 #7

awesomebytes opened this issue Nov 26, 2015 · 4 comments

Comments

@awesomebytes
Copy link
Contributor

I tried on a ubuntu 12.04 (32bits) ROS hydro environment.

Where you do pip3 install I just do pip install.

I needed to install:

sudo pip install trollius

I also compiled the workspace just doing catkin_make.

I needed to get rid of the unicode strings that did like u'SOME STRING' and change the default interpreter to:

#!/usr/bin/env python

Instead of python3

I had something installed using apache previously (robot web tools RMS (Robot Management System)), so I needed to remove the access to it, and give access to rosimple.

First I created /var/www/html folder (which didn't exist so the deploy.sh didn't work).

then I went to /etc/apache2/sites-enabled
and created rosimple.conf containing:

<VirtualHost *:80>
        #ServerName www.example.com

        DocumentRoot /var/www/html

        <Directory /var/www/html>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order Allow,Deny
                Allow from all
        </Directory>

        LogLevel warn

        ErrorLog ${APACHE_LOG_DIR}/error.log
        CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>

And in /etc/apache2/sites-enabled I made a softlink to that file

 sudo ln -s ../sites-available/rosimple.conf rosimple.conf

Then I restarted apache2:

sudo service apache2 restart

From this point, after running:
rosrun rosimple rosimple_backend.py

I could access with my browser to localhost url. Which redirected me to http://localhost/pages/blockly.html

And I could see the website, hooray!

I tried to add a block and spy the topics it's supposed to publish (mainly /joy, and I also saw the /rosimple) but... I have no idea how to execute it!

@awesomebytes
Copy link
Contributor Author

Ok I found out that if you click on Builder > Then "Launch" appears. But it didn't work at first as you have hardcoded

WebSocket connection to 'ws://erle-brain-2.local:9000/' failed: Error in connection establishment: net::ERR_NAME_NOT_RESOLVED

Says the chrome developer tools.

So I changed:

erle_rosimple_ws/src/ros_rosimple/frontend$ grep -r erle-brain-2.local .
./pages/blockly.html:    socket = new WebSocket("ws:/erle-brain-2.local:9000");

To

 socket = new WebSocket("ws://0.0.0.0:9000");

And I deployed again. (with deploy.sh script).

@vmayoral
Copy link
Contributor

Thanks @awesomebytes for giving it a try.

Good to hear you've made it work with Python 2.X and thanks for noting the hardcoded URL. To encourage more to use ROSimple we probably should change it. I'd be happy to accept a PR with this small change.

@awesomebytes
Copy link
Contributor Author

Then I got:

Traceback (most recent call last):
  File "test.py", line 8, in <module>
    from crab_msgs.msg import *
ImportError: No module named crab_msgs.msg

So I went to: erle_rosimple_ws/src/ros_rosimple/frontend/blockly/generators/python/erle-spider.js

And commented all references to crab_msgs.msg...

Then I executed build.py, re-deployed...

Re-ran rosrun rosimple rosimple_backend.py
Refreshed the page, pressed launch and... yay! topic /joy shows stuff! (I put a Go forward 2s block).

@awesomebytes
Copy link
Contributor Author

Here you have a PR of just the un-hardcoding: #8

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants