-
Notifications
You must be signed in to change notification settings - Fork 986
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Camera IMU synchronisation support added #312
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# Type for controlling onboard camera trigerring system | ||
|
||
bool trigger_enable # Trigger on/off control | ||
float32 integration_time # Shutter integration time. Zero to use current onboard value. | ||
--- | ||
bool success | ||
uint8 result |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# IMU-Camera synchronisation data | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe also provide IMU data? It stored in UAS, so it might be relatively easy. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. No need here. This message will be parsed by whatever camera driver the user is using, sequence ID matched and the image timestamp set to timestamp from this message :) IMU data will be received independently by estimator. |
||
|
||
time frame_stamp # Timestamp when the camera was triggered | ||
int32 frame_seq_id # Sequence number of the image frame |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/** | ||
* @brief Camera IMU synchronisation plugin | ||
* @file cam_imu_sync.cpp | ||
* @author Mohammed Kabir < mhkabir98@gmail.com > | ||
* | ||
* @addtogroup plugin | ||
* @{ | ||
*/ | ||
/* | ||
* Copyright 2015 Mohammed Kabir. | ||
* | ||
* This file is part of the mavros package and subject to the license terms | ||
* in the top-level LICENSE file of the mavros repository. | ||
* https://github.com/mavlink/mavros/tree/master/LICENSE.md | ||
*/ | ||
|
||
#include <mavros/mavros_plugin.h> | ||
#include <pluginlib/class_list_macros.h> | ||
|
||
#include <mavros_extras/CamIMUStamp.h> | ||
|
||
namespace mavplugin { | ||
/** | ||
* @brief Camera IMU synchronisation plugin | ||
* | ||
* This plugin publishes a timestamp for when a external camera system was | ||
* triggered by the FCU. Sequence ID from the message and the image sequence from | ||
* camera can be corellated to get the exact shutter trigger time. | ||
*/ | ||
class CamIMUSyncPlugin : public MavRosPlugin { | ||
public: | ||
CamIMUSyncPlugin() : | ||
cam_imu_sync_nh("~cam_imu_sync"), | ||
uas(nullptr) | ||
{ }; | ||
|
||
void initialize(UAS &uas_) | ||
{ | ||
uas = &uas_; | ||
|
||
cam_imu_pub = cam_imu_sync_nh.advertise<mavros_extras::CamIMUStamp>("cam_imu_stamp", 10); | ||
} | ||
|
||
const message_map get_rx_handlers() { | ||
return { | ||
MESSAGE_HANDLER(MAVLINK_MSG_ID_CAMERA_TRIGGER, &CamIMUSyncPlugin::handle_cam_trig) | ||
}; | ||
} | ||
|
||
private: | ||
ros::NodeHandle cam_imu_sync_nh; | ||
UAS *uas; | ||
|
||
ros::Publisher cam_imu_pub; | ||
|
||
void handle_cam_trig(const mavlink_message_t *msg, uint8_t sysid, uint8_t compid) { | ||
mavlink_camera_trigger_t ctrig; | ||
mavlink_msg_camera_trigger_decode(msg, &ctrig); | ||
|
||
auto sync_msg = boost::make_shared<mavros_extras::CamIMUStamp>(); | ||
|
||
sync_msg->frame_stamp = uas->synchronise_stamp(ctrig.time_usec); | ||
sync_msg->frame_seq_id = ctrig.seq; | ||
|
||
cam_imu_pub.publish(sync_msg); | ||
} | ||
}; | ||
}; // namespace mavplugin | ||
|
||
PLUGINLIB_EXPORT_CLASS(mavplugin::CamIMUSyncPlugin, mavplugin::MavRosPlugin) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You passed
param1
toconfirmation
argument!There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@vooon Whoops. Fixed.