cost_interpreter.h
Go to the documentation of this file.
1 /*
2  * Software License Agreement (BSD License)
3  *
4  * Copyright (c) 2018, Locus Robotics
5  * All rights reserved.
6  *
7  * Redistribution and use in source and binary forms, with or without
8  * modification, are permitted provided that the following conditions
9  * are met:
10  *
11  * * Redistributions of source code must retain the above copyright
12  * notice, this list of conditions and the following disclaimer.
13  * * Redistributions in binary form must reproduce the above
14  * copyright notice, this list of conditions and the following
15  * disclaimer in the documentation and/or other materials provided
16  * with the distribution.
17  * * Neither the name of the copyright holder nor the names of its
18  * contributors may be used to endorse or promote products derived
19  * from this software without specific prior written permission.
20  *
21  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
24  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
25  * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
26  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
27  * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29  * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
30  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
31  * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
32  * POSSIBILITY OF SUCH DAMAGE.
33  */
34 
35 #ifndef DLUX_GLOBAL_PLANNER_COST_INTERPRETER_H
36 #define DLUX_GLOBAL_PLANNER_COST_INTERPRETER_H
37 #include <nav_core2/costmap.h>
38 #include <ros/node_handle.h>
39 #include <array>
40 #include <memory>
41 
43 {
46 const float LETHAL_COST_F = static_cast<float>(LETHAL_COST);
47 
67 {
68 public:
70  void setConfiguration(const unsigned char neutral_cost, const float scale, const UnknownInterpretation mode);
71 
72  inline unsigned char getNeutralCost() const { return neutral_cost_; }
73 
74  inline float interpretCost(const unsigned char cost) const
75  {
76  return cached_costs_[cost];
77  }
78 
79  inline float getCost(const unsigned int x, const unsigned int y) const
80  {
81  return interpretCost(costmap_->operator()(x, y));
82  }
83 
84  inline bool isLethal(const float cost) const
85  {
86  return cost >= LETHAL_COST_F;
87  }
88 
89  typedef std::shared_ptr<CostInterpreter> Ptr;
90 
91 protected:
92  std::array<float, 256> cached_costs_;
93  unsigned char neutral_cost_;
94 
96 };
97 } // namespace dlux_global_planner
98 
99 #endif // DLUX_GLOBAL_PLANNER_COST_INTERPRETER_H
bool isLethal(const float cost) const
float interpretCost(const unsigned char cost) const
static const unsigned char INSCRIBED_INFLATED_OBSTACLE
ROSCONSOLE_DECL void initialize()
const float LETHAL_COST_F
const unsigned char LETHAL_COST
unsigned char getNeutralCost() const
std::shared_ptr< CostInterpreter > Ptr
unsigned char interpretCost(unsigned char original_value, const std::vector< unsigned char > &cost_interpretation_table)
std::array< float, 256 > cached_costs_
std::shared_ptr< Costmap > Ptr
float getCost(const unsigned int x, const unsigned int y) const


dlux_global_planner
Author(s):
autogenerated on Wed Jun 26 2019 20:06:30