Skip to content

Commit

Permalink
merge segbot_apps packages into segbot (#46)
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-oquin committed Jul 29, 2015
1 parent aaa122b commit 3ec5f66
Show file tree
Hide file tree
Showing 37 changed files with 3,001 additions and 0 deletions.
3 changes: 3 additions & 0 deletions segbot/package.xml
Expand Up @@ -22,6 +22,9 @@
<run_depend>segbot_bringup</run_depend>
<run_depend>segbot_description</run_depend>
<run_depend>segbot_firmware</run_depend>
<run_depend>segbot_gui</run_depend>
<run_depend>segbot_logical_translator</run_depend>
<run_depend>segbot_navigation</run_depend>
<run_depend>segbot_sensors</run_depend>

<export>
Expand Down
48 changes: 48 additions & 0 deletions segbot_gui/CHANGELOG.rst
@@ -0,0 +1,48 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package segbot_gui
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.3.1 (2015-03-31)
------------------

0.3.0 (2015-03-24)
------------------
* removed unnecessary script installation which installs in global bin instead of package bin.
* migrated QuestionDialog srv to bwi_msgs in bwi_common
* now return preempted option when preempted
* fixed a timeout issue with the gui where preempted requests were not timing out.
* enlarge the GUI font
* Contributors: Piyush Khandelwal, Shiqi Zhang

0.2.1 (2014-04-22)
------------------

0.2.0 (2014-04-19)
------------------
* now catkin_lint approved. found a bug where a plugin file was not
being installed
* increased default font size in the segbot gui
* added missing run dependencies
* added ability to ask a text-input question
* better pep8 conformity
* rqt simple question plugin is now ready
* added a new gui package with a question dialog plugin for rqt
* Contributors: Jack O'Quin, Piyush Khandelwal, piyushk

0.1.5 (2013-09-03)
------------------

0.1.4 (2013-08-12)
------------------

0.1.3 (2013-07-16)
------------------

0.1.2 (2013-07-13)
------------------

0.1.1 (2013-07-10)
------------------

0.1.0 (2013-06-28)
------------------
12 changes: 12 additions & 0 deletions segbot_gui/CMakeLists.txt
@@ -0,0 +1,12 @@
cmake_minimum_required(VERSION 2.8.3)
project(segbot_gui)
find_package(catkin REQUIRED)
catkin_package()

install(PROGRAMS scripts/question_dialog_plugin
DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
)

install(FILES plugin.xml
DESTINATION ${CATKIN_PACKAGE_SHARE_DESTINATION}
)
35 changes: 35 additions & 0 deletions segbot_gui/package.xml
@@ -0,0 +1,35 @@
<?xml version="1.0"?>
<package>
<name>segbot_gui</name>
<version>0.3.1</version>
<description>
Displays a simple GUI to the user. The GUI is capable of displaying a simple
message or image to the user, and ask a question. The message and question
plugins are also written in this package.
</description>

<maintainer email="piyushk@gmail.com">Piyush Khandelwal</maintainer>
<maintainer email="jack.oquin@gmail.com">Jack O'Quin</maintainer>

<license>BSD</license>

<url type="website">http://ros.org/wiki/segbot_gui</url>
<url type="repository">https://github.com/utexas-bwi/segbot.git</url>
<url type="bugtracker">https://github.com/utexas-bwi/segbot/issues</url>

<author email="piyushk@gmail.com">Piyush Khandelwal</author>

<buildtool_depend>catkin</buildtool_depend>

<run_depend>bwi_msgs</run_depend>
<run_depend>python_qt_binding</run_depend>
<run_depend>qt_gui</run_depend>
<run_depend>rospy</run_depend>
<run_depend>rqt_gui</run_depend>
<run_depend>rqt_gui_py</run_depend>

<export>
<rqt_gui plugin="${prefix}/plugin.xml"/>
</export>

</package>
15 changes: 15 additions & 0 deletions segbot_gui/plugin.xml
@@ -0,0 +1,15 @@
<library path="src">
<class name="QuestionDialogPlugin"
type="segbot_gui.plugins.QuestionDialogPlugin"
base_class_type="rqt_gui_py::Plugin">
<description>
A text widget that allows simple human interaction - displaying
text to the user and asking a question with choices.
</description>
<qtgui>
<label>Question Dialog Plugin</label>
<icon type="theme">dialog-question</icon>
<statustip>Display text or ask a question from the user.</statustip>
</qtgui>
</class>
</library>
9 changes: 9 additions & 0 deletions segbot_gui/scripts/question_dialog_plugin
@@ -0,0 +1,9 @@
#!/usr/bin/env python

import sys

from rqt_gui.main import Main

plugin = 'segbot_gui.plugins.QuestionDialogPlugin'
main = Main(filename=plugin)
sys.exit(main.main(standalone=plugin))
11 changes: 11 additions & 0 deletions segbot_gui/setup.py
@@ -0,0 +1,11 @@
#!/usr/bin/env python

from distutils.core import setup
from catkin_pkg.python_setup import generate_distutils_setup

d = generate_distutils_setup(
packages=['segbot_gui'],
package_dir={'': 'src'},
)

setup(**d)
Empty file.
132 changes: 132 additions & 0 deletions segbot_gui/src/segbot_gui/plugins.py
@@ -0,0 +1,132 @@
import rospy
import time

from bwi_msgs.srv import QuestionDialog, QuestionDialogResponse, \
QuestionDialogRequest
from functools import partial
from qt_gui.plugin import Plugin
from python_qt_binding.QtGui import QFont, QHBoxLayout, QLabel, QLineEdit, \
QPushButton, QTextBrowser, QVBoxLayout, \
QWidget
from python_qt_binding.QtCore import SIGNAL

class QuestionDialogPlugin(Plugin):

def __init__(self, context):
super(QuestionDialogPlugin, self).__init__(context)
# Give QObjects reasonable names
self.setObjectName('QuestionDialogPlugin')

font_size = rospy.get_param("~font_size", 40)

# Create QWidget
self._widget = QWidget()
self._widget.setFont(QFont("Times", font_size, QFont.Bold))
self._layout = QVBoxLayout(self._widget)
self._text_browser = QTextBrowser(self._widget)
self._layout.addWidget(self._text_browser)
self._button_layout = QHBoxLayout()
self._layout.addLayout(self._button_layout)

# layout = QVBoxLayout(self._widget)
# layout.addWidget(self.button)
self._widget.setObjectName('QuestionDialogPluginUI')
if context.serial_number() > 1:
self._widget.setWindowTitle(self._widget.windowTitle() +
(' (%d)' % context.serial_number()))
context.add_widget(self._widget)

# Setup service provider
self.service = rospy.Service('question_dialog', QuestionDialog,
self.service_callback)
self.response_ready = False
self.response = None
self.buttons = []
self.text_label = None
self.text_input = None

self.connect(self._widget, SIGNAL("update"), self.update)
self.connect(self._widget, SIGNAL("timeout"), self.timeout)

def shutdown_plugin(self):
self.service.shutdown()

def service_callback(self, req):
self.response_ready = False
self.request = req
self._widget.emit(SIGNAL("update"))
# Start timer against wall clock here instead of the ros clock.
start_time = time.time()
while not self.response_ready:
if self.request != req:
# The request got preempted by a new request.
return QuestionDialogResponse(QuestionDialogRequest.PREEMPTED, "")
if req.timeout != QuestionDialogRequest.NO_TIMEOUT:
current_time = time.time()
if current_time - start_time > req.timeout:
self._widget.emit(SIGNAL("timeout"))
return QuestionDialogResponse(
QuestionDialogRequest.TIMED_OUT, "")
time.sleep(0.2)
return self.response

def update(self):
self.clean()
req = self.request
self._text_browser.setText(req.message)
if req.type == QuestionDialogRequest.DISPLAY:
# All done, nothing more too see here.
self.response = QuestionDialogResponse(
QuestionDialogRequest.NO_RESPONSE, "")
self.response_ready = True
elif req.type == QuestionDialogRequest.CHOICE_QUESTION:
for index, options in enumerate(req.options):
button = QPushButton(options, self._widget)
button.clicked.connect(partial(self.handle_button, index))
self._button_layout.addWidget(button)
self.buttons.append(button)
elif req.type == QuestionDialogRequest.TEXT_QUESTION:
self.text_label = QLabel("Enter here: ", self._widget)
self._button_layout.addWidget(self.text_label)
self.text_input = QLineEdit(self._widget)
self.text_input.editingFinished.connect(self.handle_text)
self._button_layout.addWidget(self.text_input)

def timeout(self):
self._text_browser.setText("Oh no! The request timed out.")
self.clean()

def clean(self):
while self._button_layout.count():
item = self._button_layout.takeAt(0)
item.widget().deleteLater()
self.buttons = []
self.text_input = None
self.text_label = None

def handle_button(self, index):
self.response = QuestionDialogResponse(index, "")
self.clean()
self.response_ready = True

def handle_text(self):
self.response = QuestionDialogResponse(
QuestionDialogRequest.TEXT_RESPONSE,
self.text_input.text())
self.clean()
self.response_ready = True

def save_settings(self, plugin_settings, instance_settings):
# TODO save intrinsic configuration, usually using:
# instance_settings.set_value(k, v)
pass

def restore_settings(self, plugin_settings, instance_settings):
# TODO restore intrinsic configuration, usually using:
# v = instance_settings.value(k)
pass

#def trigger_configuration(self):
# Comment in to signal that the plugin has a way to configure
# This will enable a setting button (gear icon) in each dock widget title bar
# Usually used to open a modal configuration dialog
62 changes: 62 additions & 0 deletions segbot_logical_translator/CHANGELOG.rst
@@ -0,0 +1,62 @@
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Changelog for package segbot_logical_translator
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

0.3.1 (2015-03-31)
------------------
* Closes `#29 <https://github.com/utexas-bwi/segbot_apps/issues/29>`_
- Get latest version of move_base to get fix introduced in https://github.com/ros-planning/navigation/pull/295
This allows setting tolerance to 0 when calling make_plan from segbot_logical_translator.
- Don't use any tolerance when testing whether a door was open or not.
- Don't clear costmap around robot when testing for an open door.
* fixed issue where the logical translator was returning beside and facing for two different doors. closes `#30 <https://github.com/utexas-bwi/segbot_apps/issues/30>`_.
* segbot_logical_navigator now checks for costmap updates to test whether the map has changed between door/no-door versions. closes `#28 <https://github.com/utexas-bwi/segbot_apps/issues/28>`_
* removed segbot_gazebo dependency. closes `#27 <https://github.com/utexas-bwi/segbot_apps/issues/27>`_.
* Contributors: Piyush Khandelwal

0.3.0 (2015-03-24)
------------------
* completed migration of LogicalNavigationAction to bwi_msgs in bwi_common repository.
* fixed bug in segbot_logical_translator where it would try and analyze facing/beside for doors not connected to the current location.
* modified the segbot_logical_navigator to use action service instead of services.
* read map file and data directory using multimap
* some navigation changes for more robust navigation.
* use correct approachable area for objects and doors.
* added multimap support.
* making the logical navigator advertise execute_logical_goal after the first pose has been received (github issue `#18 <https://github.com/utexas-bwi/segbot_apps/issues/18>`_)
* turning annoying prints into ROS_INFOs and removing more annoying ones.
* Made the door checker test for the door to be open 3 times before going through. Works much better. Removed recovery behavior.
* Contributors: Matteo Leonetti, Piyush Khandelwal

0.2.1 (2014-04-22)
------------------

0.2.0 (2014-04-19)
------------------
* now actually read in object approach file
* added the ability to approach an object, as well as added the
ability to approach a door from any accessible location
* now catkin_lint approved
* better error checking, shared global nodehandle, added ability to
sense whether a door is open or not
* moved the cost estimator to the bwi_planning package
* moved gazebo stuff to separate simulated app
* Contributors: Jack O'Quin, Piyush Khandelwal, piyushk

0.1.5 (2013-09-03)
------------------

0.1.4 (2013-08-12)
------------------

0.1.3 (2013-07-16)
------------------

0.1.2 (2013-07-13)
------------------

0.1.1 (2013-07-10)
------------------

0.1.0 (2013-06-28)
------------------

0 comments on commit 3ec5f66

Please sign in to comment.