Skip to content

Commit

Permalink
Merge pull request #151 from Axel13fr/feature/No_Communication_Diag_U…
Browse files Browse the repository at this point in the history
…pdate

Raise diagnostic when no packets are received
  • Loading branch information
Joshua Whitley committed Apr 26, 2018
2 parents f0df814 + 277035c commit e04afa4
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
8 changes: 8 additions & 0 deletions velodyne_driver/src/driver/driver.cc
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ VelodyneDriver::VelodyneDriver(ros::NodeHandle node,
&diag_max_freq_,
0.1, 10),
TimeStampStatusParam()));
diag_timer_ = private_nh.createTimer(ros::Duration(0.2), &VelodyneDriver::diagTimerCallback,this);

// open Velodyne input device or file
if (dump_file != "") // have PCAP file?
Expand Down Expand Up @@ -228,4 +229,11 @@ void VelodyneDriver::callback(velodyne_driver::VelodyneNodeConfig &config,
config_.time_offset = config.time_offset;
}

void VelodyneDriver::diagTimerCallback(const ros::TimerEvent &event)
{
(void)event;
// Call necessary to provide an error when no velodyne packets are received
diagnostics_.update();
}

} // namespace velodyne_driver
3 changes: 3 additions & 0 deletions velodyne_driver/src/driver/driver.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ class VelodyneDriver
///Callback for dynamic reconfigure
void callback(velodyne_driver::VelodyneNodeConfig &config,
uint32_t level);
/// Callback for diagnostics update for lost communication with vlp
void diagTimerCallback(const ros::TimerEvent&event);

///Pointer to dynamic reconfigure service srv_
boost::shared_ptr<dynamic_reconfigure::Server<velodyne_driver::
Expand All @@ -62,6 +64,7 @@ class VelodyneDriver
ros::Publisher output_;

/** diagnostics updater */
ros::Timer diag_timer_;
diagnostic_updater::Updater diagnostics_;
double diag_min_freq_;
double diag_max_freq_;
Expand Down

0 comments on commit e04afa4

Please sign in to comment.