melodic python3 script
I run ros melodic on ev3dev system. I installed ros using this tutorial. ev3dev library works only with python3. This is a part of script I am importing from subscriber node:
#!/usr/bin/env python3
from ev3dev.brickpi import *
As a result I get:
Traceback (most recent call last):
File "/home/robot/Tesla/CatkinWorkspaces/src/learn_network/scripts/RemoteControlsSubscriber.py", line 8, in <module>
from SteeringController import SteeringController
File "/home/robot/Tesla/CatkinWorkspaces/src/learn_network/scripts/SteeringController.py", line 2, in <module>
from ev3dev.brickpi import *
ImportError: No module named brickpi
EDIT: this error is 'No module named brickpi' not, No module named 'ev3dev'
Is there any way make ros to run python3 scripts? It is crucial for me, i can even rebuild ROS packages from source, as 'rivermont' mention in this issue but i don't know how do this.
Asked by Antracyt on 2018-10-11 07:50:18 UTC
Comments
ROS can certainly run Python3 scripts. It is more likely that ev3dev is not in your path appropriately. Can you
python3 -c 'import ev3dev'
for me?Asked by allenh1 on 2018-10-11 08:51:42 UTC
There is no result of this command
When I run scripts through python3 command everything works fine. Problem appears when i run scripts through ros.
I edited my post, look plz
Asked by Antracyt on 2018-10-11 11:58:39 UTC
Ah, you're talking about running the node through
rosrun
, then? If so, that would make a lot of sense. I think a source installation is definitely the key. You can do something like a gentoo prefix install.Asked by allenh1 on 2018-10-11 14:12:31 UTC
You can select the python version for it then by using
eselect python
and setting it to any python 3 version. To get ROS installed, you'll probably want to use the ROS Overlay.Asked by allenh1 on 2018-10-11 14:13:48 UTC
Yes, I mean runing the node trough
rosrun
. ev3dev is debian distro, so eselect will not work.Asked by Antracyt on 2018-10-12 04:34:36 UTC
Could you look at ros installation tutorial on ev3dev I followed (steps 1-9) and tell me what additional steps I should do? It is black magic for me.
Asked by Antracyt on 2018-10-12 04:36:04 UTC
Ok I managed this. Here is explenation https://github.com/OTL/cozmo_driver#super-hack-to-run-rospy-from-python3
Asked by Antracyt on 2018-10-12 11:17:58 UTC