Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recheck intensity support when restarting the driver #58

Open
wants to merge 1 commit into
base: indigo-devel
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions include/urg_node/urg_node_driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,8 @@ class UrgNode
bool synchronize_time_;
bool publish_intensity_;
bool publish_multiecho_;
bool intensity_enabled_;
bool multiecho_enabled_;
int error_limit_;
double diagnostics_tolerance_;
double diagnostics_window_time_;
Expand Down
16 changes: 9 additions & 7 deletions src/urg_node_driver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -365,20 +365,22 @@ bool UrgNode::connect()
try
{
urg_.reset(); // Clear any previous connections();
intensity_enabled_ = publish_intensity_;
multiecho_enabled_ = publish_multiecho_;
if (!ip_address_.empty())
{
urg_.reset(new urg_node::URGCWrapper(ip_address_, ip_port_,
publish_intensity_, publish_multiecho_, synchronize_time_));
intensity_enabled_, multiecho_enabled_, synchronize_time_));
}
else
{
urg_.reset(new urg_node::URGCWrapper(serial_baud_, serial_port_,
publish_intensity_, publish_multiecho_, synchronize_time_));
intensity_enabled_, multiecho_enabled_, synchronize_time_));
}

std::stringstream ss;
ss << "Connected to";
if (publish_multiecho_)
if (multiecho_enabled_)
{
ss << " multiecho";
}
Expand All @@ -391,7 +393,7 @@ bool UrgNode::connect()
ss << " serial";
}
ss << " device with";
if (publish_intensity_)
if (intensity_enabled_)
{
ss << " intensity and";
}
Expand Down Expand Up @@ -508,7 +510,7 @@ void UrgNode::scanThread()
try
{
boost::mutex::scoped_lock lock(lidar_mutex_);
if (publish_multiecho_)
if (multiecho_enabled_)
{
const sensor_msgs::MultiEchoLaserScanPtr msg(new sensor_msgs::MultiEchoLaserScan());
if (urg_->grabScan(msg))
Expand Down Expand Up @@ -551,7 +553,7 @@ void UrgNode::scanThread()
service_yield_ = false;
}

// Reestablish conneciton if things seem to have gone wrong.
// Reestablish connection if things seem to have gone wrong.
if (error_count_ > error_limit_)
{
ROS_ERROR_THROTTLE(10.0, "Error count exceeded limit, reconnecting.");
Expand All @@ -576,7 +578,7 @@ void UrgNode::run()
diagnostics_thread_.join();
}

if (publish_multiecho_)
if (multiecho_enabled_)
{
echoes_freq_.reset(new diagnostic_updater::HeaderlessTopicDiagnostic("Laser Echoes",
*diagnostic_updater_,
Expand Down