Esempio n. 1
0
 def __init__(self):
     self._b = False
     self.last_cmd_sent = datetime.now()
     self.controller = DroneController()
     self.min_points = 15
     self.filter = MovingAverage()
     self.tf = tf.TransformListener()
     self._ap_ctrl = rospy.Subscriber('/apctrl',
                                      Empty,
                                      self.on_toggle,
                                      queue_size=1)
     self.is_active = False
     self.is_webcam = rospy.get_param('~is_webcam', False)
Esempio n. 2
0
    def __init__(self):
        super(UInode, self).__init__()

        self._ap_topic = rospy.Publisher('/apctrl', Empty, queue_size=5)
        self.webcam_shutdown_pub = rospy.Publisher('/webcam/shutdown',
                                                   Empty,
                                                   queue_size=5)

        self.swap_red_blue = rospy.get_param('~swap_red_blue', False)

        self.controller = DroneController(
            offline_timeout=rospy.get_param('~connection_check_period', 500))

        self.keymap = self.gen_keymap()
        # Without release action
        self.keymap2 = self.gen_keymap2()

        self.messages = Messages(
            rospy.get_param('~message_display_time', 5000), *grid)

        self.messages_named_template = re.compile(
            r'((?P<name>[a-zA-Z0-9_-]+)::)?(?P<message>.*)')

        self.setWindowTitle('ARdrone camera')
        self.image_box = QtGui.QLabel(self)
        self.setCentralWidget(self.image_box)

        self.image = None
        self.image_lock = Lock()

        fps = rospy.get_param('~fps', 50)

        self.redraw_timer = QtCore.QTimer(self)
        self.redraw_timer.timeout.connect(self.on_redraw)
        self.redraw_timer.start(1000 / fps)

        rospy.Subscriber('/ui/message', String, self.on_ui_request)
        rospy.Subscriber('/out/image', Image, self.on_video_update)
Inputs
------

* /ardrone/navdata -- information about the drone state.

"""

import rospy

from utils.drone import DroneController

if __name__ == '__main__':
    rospy.init_node('drone_commands_logger', anonymous=True)

    controller = DroneController(land_on_shutdown=False)

    @controller.on_online.subscribe
    def on_online(*args, **kwargs):
        rospy.loginfo('on_online')

    @controller.on_offline.subscribe
    def on_offline(*args, **kwargs):
        rospy.loginfo('on_offline')

    @controller.on_status_change.subscribe
    def on_status_change(*args, **kwargs):
        rospy.loginfo('on_status_change')

    @controller.on_status_emergency.subscribe
    def on_status_emergency(*args, **kwargs):