File tree Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Expand file tree Collapse file tree 1 file changed +32
-1
lines changed Original file line number Diff line number Diff line change @@ -578,7 +578,7 @@ void SpatioTemporalVoxelLayer::deactivate(void)
578578
579579 observation_subscribers_iter sub_it = _observation_subscribers.begin ();
580580 for (; sub_it != _observation_subscribers.end (); ++sub_it) {
581- if (*sub_it != NULL ) {
581+ if (*sub_it != nullptr ) {
582582 (*sub_it)->unsubscribe ();
583583 }
584584 }
@@ -902,6 +902,37 @@ SpatioTemporalVoxelLayer::dynamicParametersCallback(std::vector<rclcpp::Paramete
902902 }
903903 }
904904 }
905+
906+ if (type == ParameterType::PARAMETER_BOOL) {
907+ if (name == name_ + " ." + " enabled" ) {
908+ bool enable = parameter.as_bool ();
909+ if (enabled_ != enable) {
910+ if (enable) {
911+ observation_subscribers_iter sub_it = _observation_subscribers.begin ();
912+ for (; sub_it != _observation_subscribers.end (); ++sub_it) {
913+ if (*sub_it != nullptr ) {
914+ (*sub_it)->subscribe ();
915+ }
916+ }
917+
918+ observation_buffers_iter buf_it = _observation_buffers.begin ();
919+ for (; buf_it != _observation_buffers.end (); ++buf_it) {
920+ if (*buf_it != nullptr ) {
921+ (*buf_it)->ResetLastUpdatedTime ();
922+ }
923+ }
924+ } else {
925+ observation_subscribers_iter sub_it = _observation_subscribers.begin ();
926+ for (; sub_it != _observation_subscribers.end (); ++sub_it) {
927+ if (*sub_it != nullptr ) {
928+ (*sub_it)->unsubscribe ();
929+ }
930+ }
931+ }
932+ }
933+ enabled_ = enable;
934+ }
935+ }
905936 }
906937
907938 result.successful = true ;
You can’t perform that action at this time.
0 commit comments