File tree Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Expand file tree Collapse file tree 1 file changed +19
-4
lines changed Original file line number Diff line number Diff line change @@ -121,9 +121,17 @@ void GliderNode::interpolationCallback()
121121 {
122122 return ;
123123 }
124- int64_t timestamp = latest_imu_timestamp_;
125- Glider::Odometry odom = glider_->interpolate (timestamp);
126-
124+ int64_t timestamp = latest_imu_timestamp_;
125+ Glider::Odometry odom;
126+ try {
127+ odom = glider_->interpolate (timestamp);
128+ }
129+ catch (const std::exception& e)
130+ {
131+ RCLCPP_WARN (this ->get_logger (), " Interpolation error: %s" , e.what ());
132+ return ;
133+ }
134+
127135 if (!odom.isInitialized ()) return ;
128136 if (publish_nsf_)
129137 {
@@ -178,7 +186,14 @@ void GliderNode::gpsCallback(const sensor_msgs::msg::NavSatFix::ConstSharedPtr m
178186
179187 glider_->addGPS (timestamp, gps);
180188
181- current_state_ = glider_->optimize ();
189+ try {
190+ current_state_ = glider_->optimize ();
191+ }
192+ catch (const std::exception& e)
193+ {
194+ RCLCPP_WARN (this ->get_logger (), " Optimization error: %s" , e.what ());
195+ return ;
196+ }
182197 if (gps_counter_++ > gps_init_count_)
183198 {
184199 if (!initialized_) initialized_ = true ;
You can’t perform that action at this time.
0 commit comments