feat: make client compatible with python3/clover0.23

This commit is contained in:
artem30801
2023-05-12 09:49:10 +01:00
parent e04f6c7229
commit 0a4ffb2bc0
4 changed files with 8 additions and 7 deletions

View File

@@ -6,7 +6,7 @@ After=clover.service
[Service] [Service]
WorkingDirectory=/home/pi/clever-show/drone WorkingDirectory=/home/pi/clever-show/drone
ExecStart=/bin/bash -c ". /home/pi/catkin_ws/devel/setup.sh; \ ExecStart=/bin/bash -c ". /home/pi/catkin_ws/devel/setup.sh; \
ROS_HOSTNAME=`hostname`.local /usr/bin/python /home/pi/clever-show/drone/client.py" ROS_HOSTNAME=`hostname`.local /usr/bin/python3 /home/pi/clever-show/drone/client.py"
KillSignal=SIGKILL KillSignal=SIGKILL
Restart=on-failure Restart=on-failure
RestartSec=3 RestartSec=3

View File

@@ -7,7 +7,7 @@ After=network.target
User=pi User=pi
WorkingDirectory=/home/pi/clever-show/drone WorkingDirectory=/home/pi/clever-show/drone
ExecStart=/bin/bash -c ". /home/pi/catkin_ws/devel/setup.sh; \ ExecStart=/bin/bash -c ". /home/pi/catkin_ws/devel/setup.sh; \
ROS_HOSTNAME=`hostname`.local /usr/bin/python /home/pi/clever-show/drone/failsafe.py" ROS_HOSTNAME=`hostname`.local /usr/bin/python3 /home/pi/clever-show/drone/failsafe.py"
Restart=on-failure Restart=on-failure
RestartSec=3 RestartSec=3

View File

@@ -8,7 +8,6 @@ import logging
import datetime import datetime
import threading import threading
import subprocess import subprocess
from collections import namedtuple
from watchdog.observers import Observer from watchdog.observers import Observer
from watchdog.events import FileSystemEventHandler from watchdog.events import FileSystemEventHandler
@@ -89,11 +88,11 @@ emergency = False
logging.basicConfig( # TODO all prints as logs logging.basicConfig( # TODO all prints as logs
level=logging.DEBUG, # INFO level=logging.DEBUG, # INFO
stream=sys.stdout,
format="%(asctime)s [%(name)-7.7s] [%(threadName)-12.12s] [%(levelname)-5.5s] %(message)s", format="%(asctime)s [%(name)-7.7s] [%(threadName)-12.12s] [%(levelname)-5.5s] %(message)s",
handlers=[ handlers=[
logging.StreamHandler(sys.stdout), logging.StreamHandler(sys.stdout),
]) ]
)
handler = logging.StreamHandler(sys.stdout) handler = logging.StreamHandler(sys.stdout)
handler.setLevel(logging.DEBUG) handler.setLevel(logging.DEBUG)
@@ -763,7 +762,10 @@ class Telemetry:
@classmethod @classmethod
def get_git_version(cls): def get_git_version(cls):
return subprocess.check_output("git log --pretty=format:'%h' -n 1", shell=True) result = subprocess.check_output("git log --pretty=format:'%h' -n 1", shell=True, universal_newlines=True)
if isinstance(result, bytes):
result = result.decode("ascii")
return result.strip()
@classmethod @classmethod
def get_config_version(cls): def get_config_version(cls):

View File

@@ -41,7 +41,6 @@ emergency_land_decrease_thrust_after = config.emergency_land_decrease_thrust_aft
logging.basicConfig( # TODO all prints as logs logging.basicConfig( # TODO all prints as logs
level=logging.DEBUG, # INFO level=logging.DEBUG, # INFO
stream=sys.stdout,
format="%(asctime)s [%(name)-7.7s] [%(threadName)-12.12s] [%(levelname)-5.5s] %(message)s", format="%(asctime)s [%(name)-7.7s] [%(threadName)-12.12s] [%(levelname)-5.5s] %(message)s",
handlers=[ handlers=[
logging.StreamHandler(sys.stdout), logging.StreamHandler(sys.stdout),