Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030 #ifndef TOWR_TOWR_ROS_INCLUDE_TOWR_ROS_HEIGHT_MAP_EXAMPLES_H_
00031 #define TOWR_TOWR_ROS_INCLUDE_TOWR_ROS_HEIGHT_MAP_EXAMPLES_H_
00032
00033 #include <towr/terrain/height_map.h>
00034
00035 namespace towr {
00036
00045 class FlatGround : public HeightMap {
00046 public:
00047 FlatGround(double height = 0.0);
00048 double GetHeight(double x, double y) const override { return height_; };
00049
00050 private:
00051 double height_;
00052 };
00053
00057 class Block : public HeightMap {
00058 public:
00059 double GetHeight(double x, double y) const override;
00060 double GetHeightDerivWrtX(double x, double y) const override;
00061
00062 private:
00063 double block_start = 0.7;
00064 double length_ = 3.5;
00065 double height_ = 0.5;
00066
00067 double eps_ = 0.03;
00068 const double slope_ = height_/eps_;
00069 };
00070
00074 class Stairs : public HeightMap {
00075 public:
00076 double GetHeight(double x, double y) const override;
00077
00078 private:
00079 double first_step_start_ = 1.0;
00080 double first_step_width_ = 0.4;
00081 double height_first_step = 0.2;
00082 double height_second_step = 0.4;
00083 double width_top = 1.0;
00084 };
00085
00089 class Gap : public HeightMap {
00090 public:
00091 double GetHeight(double x, double y) const override;
00092 double GetHeightDerivWrtX(double x, double y) const override;
00093 double GetHeightDerivWrtXX(double x, double y) const override;
00094
00095 private:
00096 const double gap_start_ = 1.0;
00097 const double w = 0.5;
00098 const double h = 1.5;
00099
00100 const double slope_ = h/w;
00101 const double dx = w/2.0;
00102 const double xc = gap_start_ + dx;
00103 const double gap_end_x = gap_start_ + w;
00104
00105
00106
00107
00108
00109 const double a = (4*h)/(w*w);
00110 const double b = -(8*h*xc)/(w*w);
00111 const double c = -(h*(w - 2*xc)*(w + 2*xc))/(w*w);
00112 };
00113
00117 class Slope : public HeightMap {
00118 public:
00119 double GetHeight(double x, double y) const override;
00120 double GetHeightDerivWrtX(double x, double y) const override;
00121
00122 private:
00123 const double slope_start_ = 1.0;
00124 const double up_length_ = 1.0;
00125 const double down_length_ = 1.0;
00126 const double height_center = 0.7;
00127
00128 const double x_down_start_ = slope_start_+up_length_;
00129 const double x_flat_start_ = x_down_start_ + down_length_;
00130 const double slope_ = height_center/up_length_;
00131 };
00132
00136 class Chimney : public HeightMap {
00137 public:
00138 double GetHeight(double x, double y) const override;
00139 double GetHeightDerivWrtY(double x, double y) const override;
00140
00141 private:
00142 const double x_start_ = 1.0;
00143 const double length_ = 1.5;
00144 const double y_start_ = 0.5;
00145 const double slope_ = 3.0;
00146
00147 const double x_end_ = x_start_+length_;
00148 };
00149
00153 class ChimneyLR : public HeightMap {
00154 public:
00155 double GetHeight(double x, double y) const override;
00156 double GetHeightDerivWrtY(double x, double y) const override;
00157
00158 private:
00159 const double x_start_ = 0.5;
00160 const double length_ = 1.0;
00161 const double y_start_ = 0.5;
00162 const double slope_ = 2;
00163
00164 const double x_end1_ = x_start_+length_;
00165 const double x_end2_ = x_start_+2*length_;
00166 };
00167
00170 }
00171
00172 #endif