Exemplo n.º 1
0
 def send_volume_message(self, volume):
     """ Publish TegaAction message setting the percent volume to use. """
     if self.tega_pub is not None:
         print('\nsending volume message: %s' % volume)
         msg = TegaAction()
         # add header
         msg.header = Header()
         msg.header.stamp = rospy.Time.now()
         msg.set_volume = True
         msg.percent_volume = volume
         self.tega_pub.publish(msg)
         rospy.loginfo(msg)
Exemplo n.º 2
0
 def send_tega_command(self,
                       motion="",
                       lookat=None,
                       audio="",
                       fidgets="",
                       enqueue=False,
                       cancel=False,
                       volume=None):
     """ Publish a Tega command message and optionally wait for a response.
     """
     # We may need to send a TegaAction message with any or all of these
     # parameters.
     # pylint: disable=too-many-arguments
     if self._tega_pub is None:
         self._logger.warning("TegaAction ROS publisher is none!")
         return
     self._logger.info("Sending Tega command...")
     # Build message.
     msg = TegaAction()
     # Add header.
     msg.header = Header()
     msg.header.stamp = rospy.Time.now()
     # If parameters are set, add them to the message...
     msg.motion = motion
     if lookat is not None:
         msg.do_look_at = True
         msg.look_at = lookat
     msg.wav_filename = audio
     msg.fidgets = fidgets
     msg.enqueue = enqueue
     msg.cancel_actions = cancel
     if volume is not None:
         msg.percent_volume = volume
         msg.set_volume = True
     # Send message.
     self._tega_pub.publish(msg)
     self._logger.debug(msg)