File tree Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Expand file tree Collapse file tree 1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change 5
5
#include < sensor_msgs/msg/nav_sat_status.hpp>
6
6
#include < libgpsmm.h>
7
7
8
+ #include < chrono>
8
9
#include < cmath>
9
10
11
+ using namespace std ::chrono_literals;
12
+
10
13
namespace gpsd_client
11
14
{
12
15
class GPSDClientComponent : public rclcpp ::Node
@@ -18,7 +21,11 @@ namespace gpsd_client
18
21
use_gps_time_(true ),
19
22
check_fix_by_variance_(true ),
20
23
frame_id_(" gps" )
21
- {}
24
+ {
25
+ timer_ = create_wall_timer (1s, std::bind (&GPSDClientComponent::step, this ));
26
+ start ();
27
+ RCLCPP_INFO (this ->get_logger (), " Instantiated." );
28
+ }
22
29
23
30
bool start ()
24
31
{
@@ -207,6 +214,7 @@ namespace gpsd_client
207
214
208
215
fix.status = status;
209
216
217
+ RCLCPP_DEBUG (this ->get_logger (), " Publishing gps fix..." );
210
218
gps_fix_pub_->publish (fix);
211
219
}
212
220
@@ -271,6 +279,7 @@ namespace gpsd_client
271
279
272
280
fix->position_covariance_type = sensor_msgs::msg::NavSatFix::COVARIANCE_TYPE_DIAGONAL_KNOWN;
273
281
282
+ RCLCPP_DEBUG (this ->get_logger (), " Publishing navsatfix..." );
274
283
navsatfix_pub_->publish (std::move (fix));
275
284
}
276
285
@@ -282,6 +291,7 @@ namespace gpsd_client
282
291
bool use_gps_time_;
283
292
bool check_fix_by_variance_;
284
293
std::string frame_id_;
294
+ rclcpp::TimerBase::SharedPtr timer_;
285
295
};
286
296
}
287
297
You can’t perform that action at this time.
0 commit comments