diff --git a/aruco_pose/test/largemap.py b/aruco_pose/test/largemap.py index 56e06837..e27fe570 100755 --- a/aruco_pose/test/largemap.py +++ b/aruco_pose/test/largemap.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import sys import unittest import json diff --git a/builder/assets/butterfly.service b/builder/assets/butterfly.service index a822c816..7b7c890d 100644 --- a/builder/assets/butterfly.service +++ b/builder/assets/butterfly.service @@ -2,5 +2,5 @@ Description=Butterfly Terminal Server [Service] -ExecStart=/usr/local/bin/butterfly.server.py --host="0.0.0.0" --unsecure +ExecStart=/bin/bash -c ". /root/butterfly_env/bin/activate; butterfly.server.py --host="0.0.0.0" --unsecure" User=pi diff --git a/builder/assets/python3.yaml b/builder/assets/python3.yaml new file mode 100644 index 00000000..fc5f4879 --- /dev/null +++ b/builder/assets/python3.yaml @@ -0,0 +1,22 @@ +python3-crypto: + debian: + buster: [python3-crypto] +python3-imaging: + debian: + buster: [python3-pil] +python3-wxtools: + debian: + pip: + packages: [wxPython] +python3-future: + debian: + buster: [python3-future] +python3-twisted: + debian: + buster: [python3-twisted] +python3-serial: + debian: + buster: [python3-serial] +python3-requests: + debian: + buster: [python3-requests] diff --git a/builder/image-build.sh b/builder/image-build.sh index 957f1d01..acb62484 100755 --- a/builder/image-build.sh +++ b/builder/image-build.sh @@ -111,6 +111,7 @@ ${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} exec ${SCRIPTS_DIR}'/image-network. ${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/clever.service' '/lib/systemd/system/' ${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/roscore.service' '/lib/systemd/system/' ${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/melodic-rosdep-clever.yaml' '/etc/ros/rosdep/' +${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/python3.yaml' '/etc/ros/rosdep/' ${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/ros_python_paths' '/etc/sudoers.d/' ${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/pigpiod.service' '/lib/systemd/system/' ${BUILDER_DIR}/image-chroot.sh ${IMAGE_PATH} copy ${SCRIPTS_DIR}'/assets/launch.nanorc' '/usr/share/nano/' diff --git a/builder/image-ros.sh b/builder/image-ros.sh index 26e7ca37..2b1fc6a8 100755 --- a/builder/image-ros.sh +++ b/builder/image-ros.sh @@ -68,7 +68,8 @@ my_travis_retry() { # TODO: 'kinetic-rosdep-clever.yaml' should add only if we use our repo? echo_stamp "Init rosdep" my_travis_retry rosdep init -echo "yaml file:///etc/ros/rosdep/melodic-rosdep-clever.yaml" >> /etc/ros/rosdep/sources.list.d/20-default.list +echo "yaml file:///etc/ros/rosdep/melodic-rosdep-clever.yaml" > /etc/ros/rosdep/sources.list.d/30-clever.list +echo "yaml file:///etc/ros/rosdep/python3.yaml" > /etc/ros/rosdep/sources.list.d/40-python3.list my_travis_retry rosdep update echo_stamp "Populate rosdep for ROS user" @@ -97,8 +98,9 @@ echo_stamp "Installing CLEVER" \ && git status \ && cd /home/pi/catkin_ws \ && resolve_rosdep $(pwd) \ -&& my_travis_retry pip install wheel \ -&& my_travis_retry pip install -r /home/pi/catkin_ws/src/clever/clever/requirements.txt \ +&& my_travis_retry pip3 install wheel \ +&& my_travis_retry pip3 install -r /home/pi/catkin_ws/src/clever/clever/requirements.txt \ +&& export ROS_PYTHON_VERSION=3 \ && source /opt/ros/melodic/setup.bash \ && catkin_make -j2 -DCMAKE_BUILD_TYPE=Release \ && systemctl enable roscore \ @@ -128,8 +130,7 @@ echo_stamp "Install GeographicLib datasets (needed for mavros)" \ && wget -qO- https://raw.githubusercontent.com/mavlink/mavros/master/mavros/scripts/install_geographiclib_datasets.sh | bash # FIXME: Buster comes with tornado==5.1.1 but we need tornado==4.2.1 for rosbridge_suite -# (note that Python 3 will still have a more recent version) -pip install tornado==4.2.1 +pip3 install tornado==4.2.1 echo_stamp "Running tests" cd /home/pi/catkin_ws diff --git a/builder/image-software.sh b/builder/image-software.sh index cb4e5746..e70877c6 100755 --- a/builder/image-software.sh +++ b/builder/image-software.sh @@ -66,7 +66,8 @@ apt-get update \ && apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-key C1CF6E31E6BADE8868B172B4F42ED6FBAB17C654 echo "deb http://packages.ros.org/ros/ubuntu buster main" > /etc/apt/sources.list.d/ros-latest.list -echo "deb http://deb.coex.tech/rpi-ros-melodic buster main" > /etc/apt/sources.list.d/rpi-ros-melodic.list +echo "deb http://deb.coex.tech/opencv3 buster main" > /etc/apt/sources.list.d/opencv3.list +echo "deb http://deb.coex.tech/melodic-py3 buster main" > /etc/apt/sources.list.d/rpi-ros-melodic.list # FIXME: We still don't have these packages built for Buster # FIXME: Check these packages after their installation echo "deb http://deb.coex.tech/clever stretch main" > /etc/apt/sources.list.d/clever.list @@ -109,6 +110,7 @@ espeak espeak-data python-espeak \ ntpdate \ python-dev \ python3-dev \ +python3-venv \ python-systemd \ mjpg-streamer \ && echo_stamp "Everything was installed!" "SUCCESS" \ @@ -132,10 +134,14 @@ pip3 --version echo_stamp "Install and enable Butterfly (web terminal)" echo_stamp "Workaround for tornado >= 6.0 breaking butterfly" -my_travis_retry pip3 install tornado==5.1.1 -my_travis_retry pip3 install butterfly -my_travis_retry pip3 install butterfly[systemd] +cd /root +python3 -m venv butterfly_env +source butterfly_env/bin/activate +my_travis_retry pip install tornado==5.1.1 +my_travis_retry pip install butterfly +my_travis_retry pip install butterfly[systemd] systemctl enable butterfly.socket +deactivate echo_stamp "Install ws281x library" my_travis_retry pip install --prefer-binary rpi_ws281x diff --git a/builder/image-validate.sh b/builder/image-validate.sh index ce30379e..0391dd51 100755 --- a/builder/image-validate.sh +++ b/builder/image-validate.sh @@ -18,6 +18,7 @@ echo "Run image tests" export ROS_DISTRO='melodic' export ROS_IP='127.0.0.1' +export ROS_PYTHON_VERSION=3 source /opt/ros/melodic/setup.bash source /home/pi/catkin_ws/devel/setup.bash diff --git a/builder/test/tests.py b/builder/test/tests.py index 6d7f6e60..380ff29b 100755 --- a/builder/test/tests.py +++ b/builder/test/tests.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 # validate all required modules installed @@ -27,4 +27,4 @@ import rpi_ws281x import pigpio from espeak import espeak -print cv2.getBuildInformation() +print(cv2.getBuildInformation()) diff --git a/clever/test/basic.py b/clever/test/basic.py index 67de1fbe..3816562a 100755 --- a/clever/test/basic.py +++ b/clever/test/basic.py @@ -1,4 +1,4 @@ -#!/usr/bin/env python +#!/usr/bin/env python3 import rospy import pytest from mavros_msgs.msg import State