Skip to content

Commit

Permalink
Merge branch 'wyca-robotics-enable_disable_sensor' into development
Browse files Browse the repository at this point in the history
  • Loading branch information
doronhi committed Oct 2, 2020
2 parents c5759b9 + 2d99cf5 commit 2ecaf73
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions realsense2_camera/src/base_realsense_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,11 @@ BaseRealSenseNode::~BaseRealSenseNode()
try
{
_sensors[profile.first].stop();
_sensors[profile.first].close();
}
catch(const rs2::wrong_api_call_sequence_error& e)
{
}

_sensors[profile.first].close();
}
}
}
Expand All @@ -180,6 +179,7 @@ void BaseRealSenseNode::toggleSensors(bool enabled)
{
std::string module_name = sensor_profile.first;
rs2::sensor sensor = active_sensors[module_name];
sensor.open(sensor_profile.second);
sensor.start(_sensors_callback[module_name]);
if (sensor.is<rs2::depth_sensor>())
{
Expand All @@ -197,6 +197,7 @@ void BaseRealSenseNode::toggleSensors(bool enabled)
if (res.second)
{
_sensors[profile.first].stop();
_sensors[profile.first].close();
}
}
}
Expand Down

0 comments on commit 2ecaf73

Please sign in to comment.