#include <sim_control_util.h>
|
double | interpolate_1d (const double &p1, const double &p2, const double &frac1) |
|
double | interpolated_find (const std::vector< double > &range_table, const std::vector< double > &val_table, double to_find) |
|
double | normalize (const double value, const double mean, const double std) |
|
template<class P > |
bool | load_binary_file (const std::string &filename, P *pb_out) |
|
template<class P > |
bool | load_text_file (const std::string &filename, P *pb_out) |
|
template<class P > |
bool | load_file_to_proto (const std::string &filename, P *pb_out) |
|
bool | ends_with (const std::string &original, const std::string &pattern) |
|
int | delta_function (double value, double threshold) |
|
double | get_eta (double rise_time, double peak_time) |
|
double | get_tau_s (double peak_time, double eta) |
|
|
static double | sigmoid (const double value) |
|
static double | relu (const double value) |
|
◆ delta_function()
int apollo::dreamview::SimControlUtil::delta_function |
( |
double |
value, |
|
|
double |
threshold |
|
) |
| |
|
inline |
◆ ends_with()
bool apollo::dreamview::SimControlUtil::ends_with |
( |
const std::string & |
original, |
|
|
const std::string & |
pattern |
|
) |
| |
|
inline |
在文件 sim_control_util.h 第 81 行定义.
81 {
82 return original.length() >= pattern.length() &&
83 original.substr(original.length() - pattern.length()) == pattern;
84 }
◆ get_eta()
double apollo::dreamview::SimControlUtil::get_eta |
( |
double |
rise_time, |
|
|
double |
peak_time |
|
) |
| |
|
inline |
在文件 sim_control_util.h 第 92 行定义.
92 {
93 if (peak_time <= 0.0) {
94 AFATAL <<
"peak_time should be positive";
95 }
96 return cos(M_PI - rise_time / (peak_time / M_PI));
97 }
◆ get_tau_s()
double apollo::dreamview::SimControlUtil::get_tau_s |
( |
double |
peak_time, |
|
|
double |
eta |
|
) |
| |
|
inline |
在文件 sim_control_util.h 第 100 行定义.
100 {
101 if (eta > 1.0) {
102 AFATAL <<
"not an underdamped system";
103 }
104 return peak_time / sqrt(1 - eta * eta);
105 }
◆ interpolate_1d()
double apollo::dreamview::SimControlUtil::interpolate_1d |
( |
const double & |
p1, |
|
|
const double & |
p2, |
|
|
const double & |
frac1 |
|
) |
| |
◆ interpolated_find()
double apollo::dreamview::SimControlUtil::interpolated_find |
( |
const std::vector< double > & |
range_table, |
|
|
const std::vector< double > & |
val_table, |
|
|
double |
to_find |
|
) |
| |
在文件 sim_control_util.cc 第 29 行定义.
31 {
32 int size = range_table.size();
33 int left = -1;
34 int right = size;
35 int mid = 0;
36
37
38 while (left + 1 != right) {
39 mid = ((right - left) >> 1) + left;
40
41 if (range_table[mid] >= to_find) {
42 right = mid;
43 } else {
44 left = mid;
45 }
46 }
47
48 if (left == -1) {
49 return val_table[0];
50 }
51
52 if (left == (size - 1)) {
53 return val_table[range_table.size() - 1];
54 }
55
56 double range = range_table[right] - range_table[left];
57
58 if (fabs(range) < 1e-6) {
59 return 0.0;
60 }
61
62 double fraction = (to_find - range_table[left]) / range;
63
64 return interpolate_1d(val_table[left], val_table[right], fraction);
65}
double interpolate_1d(const double &p1, const double &p2, const double &frac1)
◆ load_binary_file()
template<class P >
bool apollo::dreamview::SimControlUtil::load_binary_file |
( |
const std::string & |
filename, |
|
|
P * |
pb_out |
|
) |
| |
|
inline |
在文件 sim_control_util.h 第 46 行定义.
46 {
47 std::fstream input(filename, std::ios::in | std::ios::binary);
48 return pb_out->ParseFromIstream(&input);
49 }
◆ load_file_to_proto()
template<class P >
bool apollo::dreamview::SimControlUtil::load_file_to_proto |
( |
const std::string & |
filename, |
|
|
P * |
pb_out |
|
) |
| |
|
inline |
在文件 sim_control_util.h 第 65 行定义.
65 {
69 return false;
70 }
71 } else {
74 return false;
75 }
76 }
77
78 return true;
79 }
bool load_text_file(const std::string &filename, P *pb_out)
bool ends_with(const std::string &original, const std::string &pattern)
bool load_binary_file(const std::string &filename, P *pb_out)
◆ load_text_file()
template<class P >
bool apollo::dreamview::SimControlUtil::load_text_file |
( |
const std::string & |
filename, |
|
|
P * |
pb_out |
|
) |
| |
|
inline |
在文件 sim_control_util.h 第 52 行定义.
52 {
53 std::fstream input(filename, std::ios::in);
54 std::string input_data((std::istreambuf_iterator<char>(input)),
55 std::istreambuf_iterator<char>());
56
57 if (input_data.empty()) {
58 return false;
59 }
60
61 return google::protobuf::TextFormat::ParseFromString(input_data, pb_out);
62 }
◆ normalize()
double apollo::dreamview::SimControlUtil::normalize |
( |
const double |
value, |
|
|
const double |
mean, |
|
|
const double |
std |
|
) |
| |
◆ relu()
double apollo::dreamview::SimControlUtil::relu |
( |
const double |
value | ) |
|
|
static |
◆ sigmoid()
double apollo::dreamview::SimControlUtil::sigmoid |
( |
const double |
value | ) |
|
|
static |
该类的文档由以下文件生成: