8 int main(
int argc,
char* argv[])
18 std::string transport_str;
19 bool init_valid =
true;
20 std::shared_ptr<HandleInfo> info = std::make_shared<HandleInfo>();
21 init_valid &= dev_nh.
getParam(
"transport", transport_str);
24 init_valid &= dev_nh.
getParam(
"scanner_ip", info->hostname);
25 dev_nh.
param<std::string>(
"port", info->port,
"0");
29 ROS_ERROR(
"Please provide the IP address and the port");
33 std::shared_ptr<ScanConfig>
config = std::make_shared<ScanConfig>();
35 int max_num_points_scan = 0;
36 int watchdogtimeout = 0;
39 bool apply_correction;
41 dev_nh.
getParam(
"max_num_points_scan", max_num_points_scan);
43 dev_nh.
getParam(
"watchdogtimeout", watchdogtimeout);
44 dev_nh.
getParam(
"watchdog", watchdog);
45 dev_nh.
getParam(
"num_layers", num_layers);
46 dev_nh.
param<
bool>(
"apply_correction", apply_correction,
false);
48 config->max_num_points_scan = max_num_points_scan;
49 config->watchdogtimeout = watchdogtimeout;
50 config->watchdog = watchdog;
52 std::string topic, frame_id;
53 dev_nh.
getParam(
"scan_topic", topic);
54 dev_nh.
getParam(
"frame_id", frame_id);
57 std::shared_ptr<ScanParameters> params = std::make_shared<ScanParameters>();
58 params->apply_correction = apply_correction;
65 std::shared_ptr<std::mutex> net_mtx_ = std::make_shared<std::mutex>();
66 std::shared_ptr<std::condition_variable> net_cv_ = std::make_shared<std::condition_variable>();
67 bool net_fail =
false;
69 bool retrying =
false;
74 if (!pf_interface.
init(info,
config, params, topic, frame_id, num_layers))
79 std::this_thread::sleep_for(std::chrono::milliseconds(2000));
92 std::unique_lock<std::mutex> net_lock(*net_mtx_);
94 !net_cv_->wait_for(net_lock, std::chrono::milliseconds(1000), [&net_fail] { return net_fail; }))