Skip to content

Commit 84846e0

Browse files
committed
some modifications
1 parent b638c08 commit 84846e0

File tree

3 files changed

+22
-5
lines changed

3 files changed

+22
-5
lines changed

vins_estimator/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ find_package(catkin REQUIRED COMPONENTS
1717

1818
find_package(OpenCV REQUIRED)
1919

20-
message(WARNING "OpenCV_VERSION: ${OpenCV_VERSION}")
20+
# message(WARNING "OpenCV_VERSION: ${OpenCV_VERSION}")
2121

2222
find_package(Ceres REQUIRED)
2323

vins_estimator/src/estimator.cpp

+20-3
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ void Estimator::clearState()
3333
angular_velocity_buf[i].clear();
3434

3535
if (pre_integrations[i] != nullptr)
36-
{
3736
delete pre_integrations[i];
38-
}
3937
pre_integrations[i] = nullptr;
4038
}
4139

@@ -45,6 +43,15 @@ void Estimator::clearState()
4543
ric[i] = Matrix3d::Identity();
4644
}
4745

46+
for (auto &it : all_image_frame)
47+
{
48+
if (it.second.pre_integration != nullptr)
49+
{
50+
delete it.second.pre_integration;
51+
it.second.pre_integration = nullptr;
52+
}
53+
}
54+
4855
solver_flag = INITIAL;
4956
first_imu = false,
5057
sum_of_back = 0;
@@ -1000,6 +1007,7 @@ void Estimator::slideWindow()
10001007
TicToc t_margin;
10011008
if (marginalization_flag == MARGIN_OLD)
10021009
{
1010+
double t_0 = Headers[0].stamp.toSec();
10031011
back_R0 = Rs[0];
10041012
back_P0 = Ps[0];
10051013
if (frame_count == WINDOW_SIZE)
@@ -1036,11 +1044,20 @@ void Estimator::slideWindow()
10361044

10371045
if (true || solver_flag == INITIAL)
10381046
{
1039-
double t_0 = Headers[0].stamp.toSec();
10401047
map<double, ImageFrame>::iterator it_0;
10411048
it_0 = all_image_frame.find(t_0);
10421049
delete it_0->second.pre_integration;
1050+
it_0->second.pre_integration = nullptr;
1051+
1052+
for (map<double, ImageFrame>::iterator it = all_image_frame.begin(); it != it_0; ++it)
1053+
{
1054+
if (it->second.pre_integration)
1055+
delete it->second.pre_integration;
1056+
it->second.pre_integration = NULL;
1057+
}
1058+
10431059
all_image_frame.erase(all_image_frame.begin(), it_0);
1060+
all_image_frame.erase(t_0);
10441061

10451062
}
10461063
slideWindowOld();

vins_estimator/src/factor/marginalization_factor.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ MarginalizationInfo::~MarginalizationInfo()
7373
//ROS_WARN("release marginlizationinfo");
7474

7575
for (auto it = parameter_block_data.begin(); it != parameter_block_data.end(); ++it)
76-
delete it->second;
76+
delete[] it->second;
7777

7878
for (int i = 0; i < (int)factors.size(); i++)
7979
{

0 commit comments

Comments
 (0)