mirror of
https://github.com/OSURoboticsClub/Rover_2017_2018.git
synced 2025-11-08 18:21:15 +00:00
Added watchdog for drive coordinator. Removed background from compass. Tuned some stuff on ground station drive sender.
This commit is contained in:
@@ -19,7 +19,7 @@ DEFAULT_DRIVE_COMMAND_TOPIC = "/rover_control/command_control/ground_station_dri
|
|||||||
|
|
||||||
DRIVE_COMMAND_HERTZ = 15
|
DRIVE_COMMAND_HERTZ = 15
|
||||||
|
|
||||||
Y_AXIS_DEADBAND = 0.015
|
Y_AXIS_DEADBAND = 0.025
|
||||||
X_AXIS_DEADBAND = 0.025
|
X_AXIS_DEADBAND = 0.025
|
||||||
|
|
||||||
THROTTLE_MIN = 0.05
|
THROTTLE_MIN = 0.05
|
||||||
@@ -104,7 +104,6 @@ class LogitechJoystick(QtCore.QThread):
|
|||||||
|
|
||||||
def __setup_controller(self):
|
def __setup_controller(self):
|
||||||
for device in devices.gamepads:
|
for device in devices.gamepads:
|
||||||
print device
|
|
||||||
if device.name == GAME_CONTROLLER_NAME:
|
if device.name == GAME_CONTROLLER_NAME:
|
||||||
self.gamepad = device
|
self.gamepad = device
|
||||||
|
|
||||||
|
|||||||
@@ -85,8 +85,29 @@
|
|||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_44">
|
<layout class="QVBoxLayout" name="verticalLayout_44">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="leftMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="topMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="rightMargin">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
<layout class="QHBoxLayout" name="horizontalLayout_9">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
|
<property name="bottomMargin">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_44">
|
<widget class="QLabel" name="label_44">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
@@ -502,6 +523,13 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="Line" name="line">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
@@ -549,6 +577,13 @@
|
|||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
|
<item row="0" column="1">
|
||||||
|
<widget class="Line" name="line_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout_5">
|
<layout class="QVBoxLayout" name="verticalLayout_5">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
@@ -565,55 +600,6 @@
|
|||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>0</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<item row="0" column="0">
|
|
||||||
<widget class="QLabel" name="label_8">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>17</pointsize>
|
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Heading</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QLabel" name="next_goal_label">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>14</pointsize>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>258°</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="0" column="2">
|
|
||||||
<widget class="QLabel" name="label_10">
|
|
||||||
<property name="font">
|
|
||||||
<font>
|
|
||||||
<pointsize>17</pointsize>
|
|
||||||
<weight>75</weight>
|
|
||||||
<bold>true</bold>
|
|
||||||
</font>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Next Goal</string>
|
|
||||||
</property>
|
|
||||||
<property name="alignment">
|
|
||||||
<set>Qt::AlignCenter</set>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
<item row="1" column="0">
|
||||||
<widget class="QLabel" name="current_heading_label">
|
<widget class="QLabel" name="current_heading_label">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
@@ -642,23 +628,137 @@
|
|||||||
</property>
|
</property>
|
||||||
</spacer>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
|
<item row="0" column="0">
|
||||||
|
<widget class="QLabel" name="label_8">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>17</pointsize>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Heading</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="0" column="2">
|
||||||
|
<widget class="QLabel" name="label_10">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>17</pointsize>
|
||||||
|
<weight>75</weight>
|
||||||
|
<bold>true</bold>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Next Goal</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item row="1" column="2">
|
||||||
|
<widget class="QLabel" name="next_goal_label">
|
||||||
|
<property name="font">
|
||||||
|
<font>
|
||||||
|
<pointsize>14</pointsize>
|
||||||
|
</font>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>258°</string>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="compass_label">
|
<spacer name="verticalSpacer_6">
|
||||||
<property name="minimumSize">
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
<size>
|
<size>
|
||||||
<width>275</width>
|
<width>20</width>
|
||||||
<height>275</height>
|
<height>40</height>
|
||||||
</size>
|
</size>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
</spacer>
|
||||||
<string/>
|
</item>
|
||||||
|
<item>
|
||||||
|
<layout class="QHBoxLayout" name="horizontalLayout_7">
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<widget class="QLabel" name="heading_compass_label">
|
||||||
|
<property name="minimumSize">
|
||||||
|
<size>
|
||||||
|
<width>275</width>
|
||||||
|
<height>275</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="maximumSize">
|
||||||
|
<size>
|
||||||
|
<width>275</width>
|
||||||
|
<height>275</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string/>
|
||||||
|
</property>
|
||||||
|
<property name="scaledContents">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
<property name="alignment">
|
||||||
|
<set>Qt::AlignCenter</set>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="horizontalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Horizontal</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>40</width>
|
||||||
|
<height>20</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
|
</layout>
|
||||||
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_5">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
</property>
|
</property>
|
||||||
<property name="alignment">
|
<property name="sizeHint" stdset="0">
|
||||||
<set>Qt::AlignCenter</set>
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</spacer>
|
||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
@@ -687,7 +787,7 @@
|
|||||||
</property>
|
</property>
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<property name="spacing">
|
<property name="spacing">
|
||||||
<number>6</number>
|
<number>0</number>
|
||||||
</property>
|
</property>
|
||||||
<property name="leftMargin">
|
<property name="leftMargin">
|
||||||
<number>6</number>
|
<number>6</number>
|
||||||
@@ -720,6 +820,9 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
<layout class="QHBoxLayout" name="horizontalLayout_2">
|
||||||
|
<property name="spacing">
|
||||||
|
<number>0</number>
|
||||||
|
</property>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_2">
|
<widget class="QLabel" name="label_2">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
@@ -749,6 +852,19 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_3">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_3">
|
<widget class="QLabel" name="label_3">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
@@ -791,6 +907,19 @@
|
|||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_4">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<widget class="QLabel" name="label_4">
|
<widget class="QLabel" name="label_4">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
@@ -810,6 +939,9 @@
|
|||||||
</item>
|
</item>
|
||||||
<item>
|
<item>
|
||||||
<layout class="QFormLayout" name="formLayout">
|
<layout class="QFormLayout" name="formLayout">
|
||||||
|
<property name="horizontalSpacing">
|
||||||
|
<number>6</number>
|
||||||
|
</property>
|
||||||
<item row="0" column="0">
|
<item row="0" column="0">
|
||||||
<widget class="QLabel" name="label_5">
|
<widget class="QLabel" name="label_5">
|
||||||
<property name="font">
|
<property name="font">
|
||||||
@@ -876,6 +1008,19 @@
|
|||||||
</item>
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</item>
|
</item>
|
||||||
|
<item>
|
||||||
|
<spacer name="verticalSpacer_2">
|
||||||
|
<property name="orientation">
|
||||||
|
<enum>Qt::Vertical</enum>
|
||||||
|
</property>
|
||||||
|
<property name="sizeHint" stdset="0">
|
||||||
|
<size>
|
||||||
|
<width>20</width>
|
||||||
|
<height>40</height>
|
||||||
|
</size>
|
||||||
|
</property>
|
||||||
|
</spacer>
|
||||||
|
</item>
|
||||||
</layout>
|
</layout>
|
||||||
</widget>
|
</widget>
|
||||||
</item>
|
</item>
|
||||||
|
|||||||
@@ -105,7 +105,7 @@ class GroundStation(QtCore.QObject):
|
|||||||
self.start_threads_signal.emit()
|
self.start_threads_signal.emit()
|
||||||
|
|
||||||
compass_image = PIL.Image.open("Resources/Images/compass.png").resize((300, 300)) # PIL.Image
|
compass_image = PIL.Image.open("Resources/Images/compass.png").resize((300, 300)) # PIL.Image
|
||||||
self.shared_objects["screens"]["right_screen"].compass_label.setPixmap(QtGui.QPixmap.fromImage(ImageQt(compass_image)))
|
self.shared_objects["screens"]["right_screen"].heading_compass_label.setPixmap(QtGui.QPixmap.fromImage(ImageQt(compass_image)))
|
||||||
|
|
||||||
def ___ros_master_running(self):
|
def ___ros_master_running(self):
|
||||||
checker = ROSMasterChecker.ROSMasterChecker()
|
checker = ROSMasterChecker.ROSMasterChecker()
|
||||||
|
|||||||
@@ -25,6 +25,8 @@ UINT16_MAX = 65535
|
|||||||
|
|
||||||
DEFAULT_HERTZ = 15
|
DEFAULT_HERTZ = 15
|
||||||
|
|
||||||
|
WATCHDOG_TIMEOUT = 0.3
|
||||||
|
|
||||||
|
|
||||||
#####################################
|
#####################################
|
||||||
# ControlCoordinator Class Definition
|
# ControlCoordinator Class Definition
|
||||||
@@ -57,11 +59,20 @@ class DriveCoordinator(object):
|
|||||||
self.right_bogie_publisher = rospy.Publisher(self.right_bogie_topic, DriveControlMessage, queue_size=1)
|
self.right_bogie_publisher = rospy.Publisher(self.right_bogie_topic, DriveControlMessage, queue_size=1)
|
||||||
|
|
||||||
# Other Vars TODO: fix this later
|
# Other Vars TODO: fix this later
|
||||||
self.drive_commands = {
|
self.drive_command_data = {
|
||||||
"iris": DriveCommandMessage(),
|
"iris": {
|
||||||
"ground_station": DriveCommandMessage()
|
"message": DriveCommandMessage(),
|
||||||
|
"last_time": time()
|
||||||
|
},
|
||||||
|
|
||||||
|
"ground_station": {
|
||||||
|
"message": DriveCommandMessage(),
|
||||||
|
"last_time": time()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
self.last_message_time = time()
|
||||||
|
|
||||||
# ########## Run the Class ##########
|
# ########## Run the Class ##########
|
||||||
self.run()
|
self.run()
|
||||||
|
|
||||||
@@ -79,12 +90,18 @@ class DriveCoordinator(object):
|
|||||||
sleep(max(self.wait_time - time_diff, 0))
|
sleep(max(self.wait_time - time_diff, 0))
|
||||||
|
|
||||||
def process_drive_commands(self):
|
def process_drive_commands(self):
|
||||||
if not self.drive_commands["iris"].ignore_drive_control:
|
if not self.drive_command_data["iris"]["message"].ignore_drive_control:
|
||||||
self.send_drive_control_command(self.drive_commands["iris"])
|
self.send_drive_control_command(self.drive_command_data["iris"])
|
||||||
else:
|
else:
|
||||||
self.send_drive_control_command(self.drive_commands["ground_station"])
|
self.send_drive_control_command(self.drive_command_data["ground_station"])
|
||||||
|
|
||||||
|
def send_drive_control_command(self, drive_command_data):
|
||||||
|
|
||||||
|
if (time() - drive_command_data["last_time"]) > WATCHDOG_TIMEOUT:
|
||||||
|
drive_command = DriveCommandMessage()
|
||||||
|
else:
|
||||||
|
drive_command = drive_command_data["message"]
|
||||||
|
|
||||||
def send_drive_control_command(self, drive_command):
|
|
||||||
rear_drive = DriveControlMessage()
|
rear_drive = DriveControlMessage()
|
||||||
left_drive = DriveControlMessage()
|
left_drive = DriveControlMessage()
|
||||||
right_drive = DriveControlMessage()
|
right_drive = DriveControlMessage()
|
||||||
@@ -118,12 +135,12 @@ class DriveCoordinator(object):
|
|||||||
self.right_bogie_publisher.publish(right_drive)
|
self.right_bogie_publisher.publish(right_drive)
|
||||||
|
|
||||||
def iris_drive_command_callback(self, drive_command):
|
def iris_drive_command_callback(self, drive_command):
|
||||||
self.drive_commands["iris"] = drive_command
|
self.drive_command_data["iris"]["message"] = drive_command
|
||||||
return
|
self.drive_command_data["iris"]["last_time"] = time()
|
||||||
|
|
||||||
def ground_station_drive_command_callback(self, drive_command):
|
def ground_station_drive_command_callback(self, drive_command):
|
||||||
self.drive_commands["ground_station"] = drive_command
|
self.drive_command_data["ground_station"]["message"] = drive_command
|
||||||
return
|
self.drive_command_data["ground_station"]["last_time"] = time()
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
Reference in New Issue
Block a user