eval_message_view.py
Go to the documentation of this file.
1 # Software License Agreement (BSD License)
2 #
3 # Copyright (c) 2018-2019, Locus Robotics
4 # All rights reserved.
5 #
6 # Redistribution and use in source and binary forms, with or without
7 # modification, are permitted provided that the following conditions
8 # are met:
9 #
10 # * Redistributions of source code must retain the above copyright
11 # notice, this list of conditions and the following disclaimer.
12 # * Redistributions in binary form must reproduce the above
13 # copyright notice, this list of conditions and the following
14 # disclaimer in the documentation and/or other materials provided
15 # with the distribution.
16 # * Neither the name of the copyright holder nor the names of its
17 # contributors may be used to endorse or promote products derived
18 # from this software without specific prior written permission.
19 #
20 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
23 # FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
24 # COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
25 # INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
26 # BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27 # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 # CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29 # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
30 # ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 # POSSIBILITY OF SUCH DAMAGE.
32 
33 from nav_2d_utils.conversions import pathToPath2D
34 
35 from .dwb_widget import DWBWidget
36 from .evaluation_cache import get_cache
37 from .multi_topic_view import ExtraTopic, MultiTopicView
38 
39 
41  """Independent panel in rqt_bag interface for viewing LocalPlanEvaluation messages one at a time.
42 
43  Uses the DWBWidget for most of the functionality.
44  """
45 
46  name = 'EvalView'
47 
48  def __init__(self, timeline, parent, topic):
49  super(EvalView, self).__init__(timeline, parent, topic)
50 
51  # When this View is initialized, pre-load all the messages
52  cache = get_cache()
53  cache.getMessages(timeline, topic, timeline._get_start_stamp(), timeline._get_end_stamp())
54  self.dwb_widget = DWBWidget(parent, cache)
55  parent.layout().addWidget(self.dwb_widget)
56 
57  def get_extra_topics(self):
58  base = self.main_topic.rpartition('/')[0]
59  return [
60  ExtraTopic(base + '/transformed_global_plan', 'nav_msgs/Path', self.plan_viewed),
61  ExtraTopic(base + '/velocity', 'nav_2d_msgs/Twist2D', self.velocity_viewed)
62  ]
63 
64  def message_viewed(self, bag, msg_details):
65  super(EvalView, self).message_viewed(bag, msg_details)
66  _, msg, _ = msg_details
67  self.dwb_widget.setEvaluation(msg)
68 
69  def plan_viewed(self, bag, msg_details):
70  _, msg, _ = msg_details
71  self.dwb_widget.setPlan(pathToPath2D(msg))
72 
73  def velocity_viewed(self, bag, msg_details):
74  _, msg, _ = msg_details
75  self.dwb_widget.setVelocity(msg)
def message_viewed(self, bag, msg_details)
def velocity_viewed(self, bag, msg_details)
def __init__(self, timeline, parent, topic)
def plan_viewed(self, bag, msg_details)


rqt_dwb_plugin
Author(s):
autogenerated on Mon Feb 28 2022 23:33:43