mirror of
https://github.com/CopterExpress/clever-show.git
synced 2026-06-02 18:19:33 +00:00
drone: Add clover dir auto detection
This commit is contained in:
@@ -19,6 +19,8 @@ except ImportError:
|
||||
print("Can't import rospy! Please check your ROS installation.")
|
||||
exit()
|
||||
|
||||
import rospkg
|
||||
|
||||
# Import clever or clover package
|
||||
try:
|
||||
from clever import srv
|
||||
@@ -125,12 +127,25 @@ class CopterClient(client_core.Client):
|
||||
def __init__(self, config_path="config/client.ini"):
|
||||
super(CopterClient, self).__init__(config_path)
|
||||
self.load_config()
|
||||
if self.config.clover_dir == 'auto':
|
||||
self.check_clover_dir()
|
||||
self.telemetry = None
|
||||
self.animation = animation.Animation(self.config, "animation.csv")
|
||||
|
||||
def load_config(self):
|
||||
super(CopterClient, self).load_config()
|
||||
|
||||
def check_clover_dir(self):
|
||||
rospack = rospkg.RosPack()
|
||||
try:
|
||||
path = rospack.get_path('clever')
|
||||
except rospkg.common.ResourceNotFound:
|
||||
try:
|
||||
path = rospack.get_path('clover')
|
||||
except rospkg.common.ResourceNotFound:
|
||||
path = 'error'
|
||||
self.config.set('', 'clover_dir', path, write=True)
|
||||
|
||||
def on_broadcast_bind(self):
|
||||
repair_chrony(self.config.server_host)
|
||||
|
||||
@@ -150,7 +165,6 @@ class CopterClient(client_core.Client):
|
||||
client_thread = threading.Thread(target=super(CopterClient, self).start, name="Client thread")
|
||||
client_thread.daemon = True
|
||||
client_thread.start()
|
||||
#super(CopterClient, self).start()
|
||||
|
||||
def start_floor_frame_broadcast(self):
|
||||
if self.config.floor_frame_parent == "gps":
|
||||
|
||||
@@ -2,6 +2,7 @@ config_name = string(default='client')
|
||||
config_version = float(default=1.0)
|
||||
# Available options: /hostname ; /default ; /ip ; any string 63 characters length
|
||||
id = string(default=/hostname, max=63)
|
||||
clover_dir = string(default=auto)
|
||||
|
||||
[SERVER]
|
||||
port = integer(default=25000, min=1)
|
||||
|
||||
Reference in New Issue
Block a user