def __init__(self): self.force_scale = rospy.get_param("~force_scale", 600) self.torque_scale = rospy.get_param("~torque_scale", 500) self.remote = RemoteControl("joystick", "/wrench/rc") self.reset() rospy.Subscriber("joy", Joy, self.joy_recieved)
def __init__(self): self.force_scale = rospy.get_param("/joystick_wrench/force_scale", 600) self.torque_scale = rospy.get_param("/joystick_wrench/torque_scale", 500) self.remote = RemoteControl("keyboard", "/wrench/keyboard") rospy.Service("/keyboard_control", KeyboardControl, self.key_recieved) # Initialize this to a random UUID so that a client without a UUID cannot authenticate self.locked_uuid = uuid.uuid4().hex # This maps each key to a remote control function self.key_mappings = {ord('k'): lambda: self.remote.toggle_kill(), ord('K'): lambda: self.remote.kill(), ord('h'): lambda: self.remote.station_hold(), ord('j'): lambda: self.remote.select_rc_control(), ord('e'): lambda: self.remote.select_emergency_control(), ord('b'): lambda: self.remote.select_keyboard_control(), ord('u'): lambda: self.remote.select_autonomous_control(), ord('c'): lambda: self.remote.select_next_control(), ord('r'): lambda: self.remote.shooter_load(), ord('f'): lambda: self.remote.shooter_fire(), ord('t'): lambda: self.remote.shooter_cancel(), ord('w'): lambda: self.remote.publish_wrench(self.force_scale, 0, 0), ord('s'): lambda: self.remote.publish_wrench(-self.force_scale, 0, 0), ord('a'): lambda: self.remote.publish_wrench(0, self.force_scale, 0), ord('d'): lambda: self.remote.publish_wrench(0, -self.force_scale, 0), curses.KEY_LEFT: lambda: self.remote.publish_wrench(0, 0, self.torque_scale), curses.KEY_RIGHT: lambda: self.remote.publish_wrench(0, 0, -self.torque_scale) } self.movement_keys = [ord('w'), ord('s'), ord('a'), ord('d'), curses.KEY_LEFT, curses.KEY_RIGHT]
def __init__(self, context): super(Shooter, self).__init__(context) # Create the widget and name it self._widget = QtGui.QWidget() self._widget.setObjectName("Shooter") self.setObjectName("Shooter") # Extend the widget with all attributes and children in the UI file ui_file = os.path.join(rospkg.RosPack().get_path("navigator_gui"), "resource", "shooter.ui") loadUi(ui_file, self._widget) self.remote = RemoteControl("shooter gui") self.remote.is_timed_out = True self.shooter_status = { "received": "Unknown", "stamp": rospy.Time.now(), "cached": "Unknown" } self.disc_speed_setting = 0 self.connect_ui() rospy.Subscriber("/shooter/status", String, self.cache_shooter_status) # Show _widget.windowTitle on left-top of each plugin (when it's set in _widget). This is useful when you open multiple # plugins at once. Also if you open multiple instances of your plugin at once, these lines add number to make it easy to # tell from pane to pane. if context.serial_number() > 1: self._widget.setWindowTitle(self._widget.windowTitle() + (" (%d)" % context.serial_number())) # Add widget to the user interface context.add_widget(self._widget)
def __init__(self, context): super(Shooter, self).__init__(context) # Create the widget and name it self._widget = QtWidgets.QWidget() self._widget.setObjectName("Shooter") self.setObjectName("Shooter") # Extend the widget with all attributes and children in the UI file ui_file = os.path.join(rospkg.RosPack().get_path("navigator_gui"), "resource", "shooter.ui") loadUi(ui_file, self._widget) self.remote = RemoteControl("shooter gui") self.remote.is_timed_out = True self.shooter_status = { "received": "Unknown", "stamp": rospy.Time.now(), "cached": "Unknown" } self.disc_speed_setting = 0 self.connect_ui() rospy.Subscriber("/shooter/status", String, self.cache_shooter_status) # Deals with problem of multiple instances of same plugin if context.serial_number() > 1: self._widget.setWindowTitle(self._widget.windowTitle() + (" (%d)" % context.serial_number())) # Add widget to the user interface context.add_widget(self._widget)
def __init__(self, context): super(Dashboard, self).__init__(context) # Create the widget and name it self._widget = QtGui.QWidget() self._widget.setObjectName("Dashboard") self.setObjectName("Dashboard") # Extend the widget with all attributes and children in the UI file ui_file = os.path.join(rospkg.RosPack().get_path("navigator_gui"), "resource", "dashboard.ui") loadUi(ui_file, self._widget) self.is_killed = False self.remote = RemoteControl("dashboard") # Creates dictionaries that are used by the monitor functions to keep track of their node or service service_monitor_template = {"received": "Unknown", "cached": "Unknown"} node_monitor_template = service_monitor_template.copy() node_monitor_template["timeout_count"] = 0 node_monitor_template["is_timed_out"] = False self.operating_mode = service_monitor_template.copy() self.battery_voltage = node_monitor_template.copy() self.battery_voltage["cached_warning_color"] = "red" self.system_time = node_monitor_template.copy() self.system_time["is_timed_out"] = True # Build an ordered list of host dictionaries that resolve to devices on navigator host_list = [ "mil-nav-ubnt-wamv", "mil-nav-ubnt-shore", "mil-nav-wamv", "mil-com-velodyne-vlp16", "mil-com-sick-lms111" ] host_template = {"hostname": "", "ip": "Unknown", "status": "Unknown"} self.hosts = [] for host in host_list: host_entry = host_template.copy() host_entry["hostname"] = host self.hosts.append(host_entry) self.connect_ui() self.connect_ros() # Show _widget.windowTitle on left-top of each plugin (when it's set in _widget). This is useful when you open multiple # plugins at once. Also if you open multiple instances of your plugin at once, these lines add number to make it easy to # tell from pane to pane. if context.serial_number() > 1: self._widget.setWindowTitle(self._widget.windowTitle() + (" (%d)" % context.serial_number())) # Add widget to the user interface context.add_widget(self._widget) # Creates monitors that update data on the GUI periodically self.monitor_battery_voltage() self.monitor_system_time() self.monitor_hosts()
def __init__(self): self.force_scale = rospy.get_param("/joystick_wrench/force_scale", 600) self.torque_scale = rospy.get_param("/joystick_wrench/torque_scale", 500) self.remote = RemoteControl("emergency", "/wrench/emergency") rospy.Subscriber("joy_emergency", Joy, self.joy_recieved) self.active = False self.reset()
def __init__(self, context): super(Dashboard, self).__init__(context) # Create the widget and name it self._widget = QtGui.QWidget() self._widget.setObjectName("Dashboard") self.setObjectName("Dashboard") # Extend the widget with all attributes and children in the UI file ui_file = os.path.join(rospkg.RosPack().get_path("navigator_gui"), "resource", "dashboard.ui") loadUi(ui_file, self._widget) self.is_killed = False self.remote = RemoteControl("dashboard") self.remote.is_timed_out = True # Creates dictionaries that are used by the monitor functions to keep track of their node or service node_monitor_template = { "received": "Unknown", "stamp": rospy.Time.now(), "cached": "Unknown", } self.operating_mode = node_monitor_template.copy() self.battery_voltage = node_monitor_template.copy() self.battery_voltage["cached_warning_color"] = "red" self.system_time = node_monitor_template.copy() del self.system_time["stamp"] self.system_time["timeout_count"] = 0 self.hosts = node_monitor_template.copy() self.clear_hosts() self.hosts["cached"] = self.hosts["received"] self.connect_ui() self.connect_ros() # Show _widget.windowTitle on left-top of each plugin (when it's set in _widget). This is useful when you open multiple # plugins at once. Also if you open multiple instances of your plugin at once, these lines add number to make it easy to # tell from pane to pane. if context.serial_number() > 1: self._widget.setWindowTitle(self._widget.windowTitle() + (" (%d)" % context.serial_number())) # Add widget to the user interface context.add_widget(self._widget) # Creates monitors that update data on the GUI periodically self.monitor_operating_mode() self.monitor_battery_voltage() self.monitor_system_time() self.monitor_hosts()
def __init__(self, context): super(Dashboard, self).__init__(context) # Create the widget and name it self._widget = QtWidgets.QWidget() self._widget.setObjectName("Dashboard") self.setObjectName("Dashboard") # Extend the widget with all attributes and children in the UI file ui_file = os.path.join(rospkg.RosPack().get_path("navigator_gui"), "resource", "dashboard.ui") loadUi(ui_file, self._widget) self.remote = RemoteControl("dashboard") # Creates dictionaries that are used by the monitor functions to keep track of their node or service node_monitor_template = { "current": "Unknown", "displayed": "Unknown", } self.operating_mode = copy(node_monitor_template) self.battery_voltage = copy(node_monitor_template) self.kill_status = copy(node_monitor_template) self.kill_status["current"] = True self.system_time = copy(node_monitor_template) self.hosts = node_monitor_template.copy() self.clear_hosts() self.connect_ui() self.connect_ros() # Deals with problem when they're multiple instances of Dashboard plugin if context.serial_number() > 1: self._widget.setWindowTitle(self._widget.windowTitle() + (" (%d)" % context.serial_number())) # Add widget to the user interface context.add_widget(self._widget) # Creates monitors that update data on the GUI periodically self.update_gui()