Skip to content

Commit 38e8bdf

Browse files
authored
Merge branch 'main' into perf/ars548-remove-mtqueue
2 parents c7fc734 + 1242696 commit 38e8bdf

File tree

9 files changed

+67
-92
lines changed

9 files changed

+67
-92
lines changed

.codecov.yml

+42-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,43 @@
1+
coverage:
2+
status:
3+
project:
4+
default:
5+
target: auto
6+
# allow slight decreases in coverage compared to the base ref
7+
threshold: 1%
8+
19
ignore:
2-
- build
3-
- nebula_examples
10+
- ^build.* # for generated message wrappers
11+
- ^nebula_examples.* # not safety-related
12+
13+
comment:
14+
layout: header, diff, flags, components
15+
16+
component_management:
17+
default_rules:
18+
statuses:
19+
- type: project # inherit project rules for coverage statuses
20+
individual_components:
21+
- component_id: common
22+
name: Common
23+
paths:
24+
- "!**hesai**"
25+
- "!**velodyne**"
26+
- "!**continental**"
27+
- "!**robosense**"
28+
- component_id: hesai
29+
name: Hesai
30+
paths:
31+
- "**hesai**"
32+
- component_id: velodyne
33+
name: Velodyne
34+
paths:
35+
- "**velodyne**"
36+
- component_id: continental
37+
name: Continental
38+
paths:
39+
- "**continental**"
40+
- component_id: robosense
41+
name: Robosense
42+
paths:
43+
- "**robosense**"

.pre-commit-config.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ repos:
5353
args: [-w, -s, -i=4]
5454

5555
- repo: https://github.com/pycqa/isort
56-
rev: 6.0.0
56+
rev: 6.0.1
5757
hooks:
5858
- id: isort
5959

nebula_common/package.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@
1212
<buildtool_depend>ament_cmake_auto</buildtool_depend>
1313
<buildtool_depend>ros_environment</buildtool_depend>
1414

15-
<depend>libpcl-all-dev</depend>
15+
<build_depend>libpcl-all-dev</build_depend>
16+
<build_export_depend>libpcl-all-dev</build_export_depend>
1617
<depend>nlohmann-json-dev</depend>
1718
<depend>yaml-cpp</depend>
1819

nebula_decoders/package.xml

+6-3
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,16 @@
1111

1212
<buildtool_depend>ament_cmake_auto</buildtool_depend>
1313
<buildtool_depend>ros_environment</buildtool_depend>
14+
<build_depend>libpcl-all-dev</build_depend>
15+
<build_depend>libpng++-dev</build_depend>
16+
<build_depend>libpng-dev</build_depend>
17+
<build_export_depend>libpcl-all-dev</build_export_depend>
18+
<build_export_depend>libpng++-dev</build_export_depend>
19+
<build_export_depend>libpng-dev</build_export_depend>
1420

1521
<depend>angles</depend>
1622
<depend>continental_msgs</depend>
1723
<depend>diagnostic_msgs</depend>
18-
<depend>libpcl-all-dev</depend>
19-
<depend>libpng++-dev</depend>
20-
<depend>libpng-dev</depend>
2124
<depend>nebula_common</depend>
2225
<depend>nebula_msgs</depend>
2326
<depend>pandar_msgs</depend>

nebula_examples/package.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@
1111

1212
<buildtool_depend>ament_cmake_auto</buildtool_depend>
1313
<buildtool_depend>ros_environment</buildtool_depend>
14+
<build_depend>libpcl-all-dev</build_depend>
15+
<build_export_depend>libpcl-all-dev</build_export_depend>
1416

15-
<depend>libpcl-all-dev</depend>
1617
<depend>nebula_common</depend>
1718
<depend>nebula_decoders</depend>
1819
<depend>nebula_ros</depend>

nebula_ros/config/radar/continental/ARS548.param.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/**:
22
ros__parameters:
33
host_ip: 10.13.1.166
4-
sensor_ip: 10.13.1.114
4+
sensor_ip: 10.13.1.113
55
data_port: 42102
66
frame_id: continental
77
base_frame: base_link

nebula_ros/include/nebula_ros/velodyne/hw_monitor_wrapper.hpp

-13
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,6 @@ class VelodyneHwMonitorWrapper
5454
/// @brief Callback of the timer for getting the current lidar status
5555
void on_velodyne_status_timer();
5656

57-
/// @brief Callback of the timer for getting the current lidar snapshot
58-
void on_velodyne_snapshot_timer();
59-
6057
/// @brief Callback of the timer for getting the current lidar status & updating the diagnostics
6158
void on_velodyne_diagnostics_timer();
6259

@@ -250,10 +247,6 @@ class VelodyneHwMonitorWrapper
250247
/// @param diagnostics DiagnosticStatusWrapper
251248
void velodyne_check_laser_state(diagnostic_updater::DiagnosticStatusWrapper & diagnostics);
252249

253-
/// @brief Check the current snapshot for diagnostic_updater
254-
/// @param diagnostics DiagnosticStatusWrapper
255-
void velodyne_check_snapshot(diagnostic_updater::DiagnosticStatusWrapper & diagnostics);
256-
257250
/// @brief Check the current states of motor & laser for diagnostic_updater
258251
/// @param diagnostics DiagnosticStatusWrapper
259252
void velodyne_check_status(diagnostic_updater::DiagnosticStatusWrapper & diagnostics);
@@ -282,17 +275,11 @@ class VelodyneHwMonitorWrapper
282275
uint16_t diag_span_;
283276
bool show_advanced_diagnostics_;
284277

285-
rclcpp::TimerBase::SharedPtr diagnostics_snapshot_timer_;
286278
rclcpp::TimerBase::SharedPtr diagnostics_update_timer_;
287279
rclcpp::TimerBase::SharedPtr diagnostics_diag_timer_;
288280

289-
std::shared_ptr<std::string> current_snapshot_;
290-
std::shared_ptr<boost::property_tree::ptree> current_snapshot_tree_;
291281
std::shared_ptr<boost::property_tree::ptree> current_diag_tree_;
292-
std::shared_ptr<rclcpp::Time> current_snapshot_time_;
293-
uint8_t current_diag_status_;
294282

295-
std::mutex mtx_snapshot_;
296283
std::mutex mtx_status_;
297284
std::mutex mtx_diag_;
298285

nebula_ros/package.xml

+2-1
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,14 @@
1212
<buildtool_depend>ament_cmake_auto</buildtool_depend>
1313
<buildtool_depend>ros_environment</buildtool_depend>
1414
<buildtool_depend>ros_testing</buildtool_depend>
15+
<build_depend>libpcl-all-dev</build_depend>
16+
<build_export_depend>libpcl-all-dev</build_export_depend>
1517

1618
<depend>continental_msgs</depend>
1719
<depend>continental_srvs</depend>
1820
<depend>diagnostic_msgs</depend>
1921
<depend>diagnostic_updater</depend>
2022
<depend>geometry_msgs</depend>
21-
<depend>libpcl-all-dev</depend>
2223
<depend>nebula_common</depend>
2324
<depend>nebula_decoders</depend>
2425
<depend>nebula_hw_interfaces</depend>

nebula_ros/src/velodyne/hw_monitor_wrapper.cpp

+11-69
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ VelodyneHwMonitorWrapper::VelodyneHwMonitorWrapper(
1717
const std::shared_ptr<nebula::drivers::VelodyneHwInterface> & hw_interface,
1818
std::shared_ptr<const nebula::drivers::VelodyneSensorConfiguration> & config)
1919
: logger_(parent_node->get_logger().get_child("HwMonitor")),
20-
diagnostics_updater_(parent_node),
20+
diagnostics_updater_(
21+
(parent_node->declare_parameter<bool>("diagnostic_updater.use_fqn", true), parent_node)),
2122
status_(Status::OK),
2223
hw_interface_(hw_interface),
2324
parent_node_(parent_node),
@@ -30,18 +31,19 @@ VelodyneHwMonitorWrapper::VelodyneHwMonitorWrapper(
3031
std::cout << "Get model name and serial." << std::endl;
3132
auto str = hw_interface_->get_snapshot();
3233
if (!str.has_value()) return;
33-
current_snapshot_time_.reset(new rclcpp::Time(parent_node_->now()));
34-
current_snapshot_tree_ =
34+
35+
auto snapshot_tree =
3536
std::make_shared<boost::property_tree::ptree>(hw_interface_->parse_json(str.value()));
3637
current_diag_tree_ =
37-
std::make_shared<boost::property_tree::ptree>(current_snapshot_tree_->get_child("diag"));
38+
std::make_shared<boost::property_tree::ptree>(snapshot_tree->get_child("diag"));
3839
current_status_tree_ =
39-
std::make_shared<boost::property_tree::ptree>(current_snapshot_tree_->get_child("status"));
40-
current_snapshot_.reset(new std::string(str.value()));
40+
std::make_shared<boost::property_tree::ptree>(snapshot_tree->get_child("status"));
4141

4242
try {
43-
info_model_ = get_ptree_value(current_snapshot_tree_, mtx_snapshot_, key_info_model);
44-
info_serial_ = get_ptree_value(current_snapshot_tree_, mtx_snapshot_, key_info_serial);
43+
// get_ptree_value requires a mutex but we are only accessing a local variable
44+
std::mutex dummy_mtx;
45+
info_model_ = get_ptree_value(snapshot_tree, dummy_mtx, key_info_model);
46+
info_serial_ = get_ptree_value(snapshot_tree, dummy_mtx, key_info_serial);
4547
RCLCPP_INFO_STREAM(logger_, "Model: " << info_model_);
4648
RCLCPP_INFO_STREAM(logger_, "Serial: " << info_serial_);
4749
} catch (boost::bad_lexical_cast & ex) {
@@ -62,10 +64,6 @@ void VelodyneHwMonitorWrapper::initialize_velodyne_diagnostics()
6264
RCLCPP_INFO_STREAM(logger_, "Hardware ID: " << hardware_id);
6365

6466
if (show_advanced_diagnostics_) {
65-
diagnostics_updater_.add(
66-
"velodyne_snapshot-" + sensor_configuration_->frame_id, this,
67-
&VelodyneHwMonitorWrapper::velodyne_check_snapshot);
68-
6967
diagnostics_updater_.add(
7068
"velodyne_volt_temp_top_hv-" + sensor_configuration_->frame_id, this,
7169
&VelodyneHwMonitorWrapper::velodyne_check_top_hv);
@@ -164,55 +162,7 @@ void VelodyneHwMonitorWrapper::initialize_velodyne_diagnostics()
164162
diagnostics_updater_.add(
165163
"velodyne_voltage", this, &VelodyneHwMonitorWrapper::velodyne_check_voltage);
166164

167-
{
168-
std::lock_guard lock(mtx_snapshot_);
169-
current_snapshot_.reset(new std::string(""));
170-
current_snapshot_time_.reset(new rclcpp::Time(parent_node_->now()));
171-
}
172-
173-
current_diag_status_ = diagnostic_msgs::msg::DiagnosticStatus::STALE;
174-
175-
auto on_timer_snapshot = [this] { on_velodyne_snapshot_timer(); };
176-
diagnostics_snapshot_timer_ = parent_node_->create_wall_timer(
177-
std::chrono::milliseconds(diag_span_), std::move(on_timer_snapshot));
178-
179-
auto on_timer_update = [this] {
180-
auto now = parent_node_->now();
181-
double dif;
182-
{
183-
std::lock_guard lock(mtx_snapshot_);
184-
dif = (now - *current_snapshot_time_).seconds();
185-
}
186-
if (diag_span_ * 2.0 < dif * 1000) {
187-
current_diag_status_ = diagnostic_msgs::msg::DiagnosticStatus::STALE;
188-
RCLCPP_DEBUG_STREAM(logger_, "STALE");
189-
} else {
190-
current_diag_status_ = diagnostic_msgs::msg::DiagnosticStatus::OK;
191-
RCLCPP_DEBUG_STREAM(logger_, "OK");
192-
}
193-
diagnostics_updater_.force_update();
194-
};
195-
diagnostics_update_timer_ =
196-
parent_node_->create_wall_timer(std::chrono::milliseconds(1000), std::move(on_timer_update));
197-
}
198-
199-
void VelodyneHwMonitorWrapper::on_velodyne_snapshot_timer()
200-
{
201-
auto str = hw_interface_->get_snapshot();
202-
if (!str.has_value()) return;
203-
auto ptree = hw_interface_->parse_json(str.value());
204-
205-
{
206-
std::lock_guard lock(mtx_snapshot_);
207-
208-
current_snapshot_time_.reset(new rclcpp::Time(parent_node_->now()));
209-
current_snapshot_tree_ = std::make_shared<boost::property_tree::ptree>(ptree);
210-
current_diag_tree_ =
211-
std::make_shared<boost::property_tree::ptree>(current_snapshot_tree_->get_child("diag"));
212-
current_status_tree_ =
213-
std::make_shared<boost::property_tree::ptree>(current_snapshot_tree_->get_child("status"));
214-
current_snapshot_.reset(new std::string(str.value()));
215-
}
165+
diagnostics_updater_.setPeriod(1.0);
216166
}
217167

218168
void VelodyneHwMonitorWrapper::on_velodyne_diagnostics_timer()
@@ -1238,14 +1188,6 @@ void VelodyneHwMonitorWrapper::velodyne_check_laser_state(
12381188
}
12391189
}
12401190

1241-
void VelodyneHwMonitorWrapper::velodyne_check_snapshot(
1242-
diagnostic_updater::DiagnosticStatusWrapper & diagnostics)
1243-
{
1244-
uint8_t level = current_diag_status_;
1245-
diagnostics.add("sensor", sensor_configuration_->frame_id);
1246-
diagnostics.summary(level, *current_snapshot_);
1247-
}
1248-
12491191
void VelodyneHwMonitorWrapper::velodyne_check_status(
12501192
diagnostic_updater::DiagnosticStatusWrapper & diagnostics)
12511193
{

0 commit comments

Comments
 (0)