bounds.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 .util import subtractPose
34 
35 
36 class Bounds(object):
37  """Tracks the extreme bounds of all the relative poses within a LocalPlanEvaluation."""
38 
39  def __init__(self, initial_evaluation=None):
40  self.x_min = self.y_min = 0.0
41  self.x_max = self.y_max = 0.0
42  if initial_evaluation:
43  self.process_evaluation(initial_evaluation)
44 
45  def process_evaluation(self, msg):
46  for twist in msg.twists:
47  self.check_pose(subtractPose(twist.traj.poses[-1], twist.traj.poses[0]))
48 
49  def check_pose(self, pose):
50  self.x_min = min(self.x_min, pose.x)
51  self.x_max = max(self.x_max, pose.x)
52  self.y_min = min(self.y_min, pose.y)
53  self.y_max = max(self.y_max, pose.y)
rqt_dwb_plugin.bounds.Bounds.__init__
def __init__(self, initial_evaluation=None)
Definition: bounds.py:39
rqt_dwb_plugin.bounds.Bounds
Definition: bounds.py:36
rqt_dwb_plugin.util.subtractPose
def subtractPose(pose_a, pose_b)
Definition: util.py:48
rqt_dwb_plugin.bounds.Bounds.check_pose
def check_pose(self, pose)
Definition: bounds.py:49
rqt_dwb_plugin.bounds.Bounds.y_min
y_min
Definition: bounds.py:40
rqt_dwb_plugin.bounds.Bounds.y_max
y_max
Definition: bounds.py:41
rqt_dwb_plugin.bounds.Bounds.x_min
x_min
Definition: bounds.py:40
rqt_dwb_plugin.bounds.Bounds.x_max
x_max
Definition: bounds.py:41
rqt_dwb_plugin.bounds.Bounds.process_evaluation
def process_evaluation(self, msg)
Definition: bounds.py:45


rqt_dwb_plugin
Author(s):
autogenerated on Sun May 18 2025 02:47:58