Fixed large RAM usage in cubic polinomial curves.

This commit is contained in:
Axel1092 2020-05-19 09:42:40 +02:00 committed by Marc Garcia Puig
parent 704b32fa1a
commit 543f502512
2 changed files with 10 additions and 2 deletions

View File

@ -132,7 +132,10 @@ namespace element {
}
void GeometryPoly3::PreComputeSpline() {
const double delta_u = 0.01; // interval between values of u
// Roughly the interval size in m
constexpr double interval_size = 0.5;
size_t number_intervals = std::max(static_cast<size_t>(_length / interval_size), size_t(1));
const double delta_u = 1.0 / number_intervals;; // interval between values of u
double current_s = 0;
double current_u = 0;
double last_u = 0;
@ -187,7 +190,9 @@ namespace element {
}
void GeometryParamPoly3::PreComputeSpline() {
size_t number_intervals = 1000;
// Roughly the interval size in m
constexpr double interval_size = 0.5;
size_t number_intervals = std::max(static_cast<size_t>(_length / interval_size), size_t(10));
double delta_p = 1.0 / number_intervals;
if (_arcLength) {
delta_p *= _length;

View File

@ -89,6 +89,9 @@ def main():
temp_file.close()
fixed_xodr = fix_opendrive(broken_xodr, args.center_map)
temp_file = open('temp_opendrive.xodr', 'w')
temp_file.write(fixed_xodr)
temp_file.close()
print('OpenDRIVE file fixed, connecting to simulation...')
client = carla.Client(args.host, args.port, worker_threads=1)