cam_imu_sync.cpp
Go to the documentation of this file.
1 
9 /*
10  * Copyright 2015 Mohammed Kabir.
11  *
12  * This file is part of the mavros package and subject to the license terms
13  * in the top-level LICENSE file of the mavros repository.
14  * https://github.com/mavlink/mavros/tree/master/LICENSE.md
15  */
16 
17 #include <mavros/mavros_plugin.h>
18 
19 #include <mavros_msgs/CamIMUStamp.h>
20 
21 namespace mavros {
22 namespace extra_plugins{
31 public:
33  cam_imu_sync_nh("~cam_imu_sync")
34  { }
35 
36  void initialize(UAS &uas_) override
37  {
39 
40  cam_imu_pub = cam_imu_sync_nh.advertise<mavros_msgs::CamIMUStamp>("cam_imu_stamp", 10);
41  }
42 
44  {
45  return {
47  };
48  }
49 
50 private:
52 
54 
55  void handle_cam_trig(const mavlink::mavlink_message_t *msg, mavlink::common::msg::CAMERA_TRIGGER &ctrig)
56  {
57  auto sync_msg = boost::make_shared<mavros_msgs::CamIMUStamp>();
58 
59  sync_msg->frame_stamp = m_uas->synchronise_stamp(ctrig.time_usec);
60  sync_msg->frame_seq_id = ctrig.seq;
61 
62  cam_imu_pub.publish(sync_msg);
63  }
64 };
65 } // namespace extra_plugins
66 } // namespace mavros
67 
Subscriptions get_subscriptions() override
void publish(const boost::shared_ptr< M > &message) const
HandlerInfo make_handler(const mavlink::msgid_t id, void(_C::*fn)(const mavlink::mavlink_message_t *msg, const mavconn::Framing framing))
void initialize(UAS &uas_) override
void handle_cam_trig(const mavlink::mavlink_message_t *msg, mavlink::common::msg::CAMERA_TRIGGER &ctrig)
ros::Time synchronise_stamp(uint32_t time_boot_ms)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
std::vector< HandlerInfo > Subscriptions
Camera IMU synchronisation plugin.
void initialize(UAS &uas_) override
#define PLUGINLIB_EXPORT_CLASS(class_type, base_class_type)


mavros_extras
Author(s): Vladimir Ermakov , Amilcar Lucas
autogenerated on Tue Jun 1 2021 02:36:36