Skip to content

Commit

Permalink
Fix comments in PR.
Browse files Browse the repository at this point in the history
  • Loading branch information
jackg0 committed Jun 2, 2022
1 parent 776e387 commit 9767d5a
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 18 deletions.
6 changes: 3 additions & 3 deletions multisense_ros/include/multisense_ros/camera.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class Camera {
void groundSurfaceCallback(const crl::multisense::image::Header& header);
void groundSurfaceSplineCallback(const crl::multisense::ground_surface::Header& header);

void borderClipChanged(const BorderClip& borderClipType, double borderClipValue);
void borderClipChanged(const BorderClip &borderClipType, double borderClipValue);

void maxPointCloudRangeChanged(double range);

Expand Down Expand Up @@ -357,11 +357,11 @@ class Camera {

//
// Timestamping and timesync settings
ros::Time convertImageTimestamp(uint32_t time_secs, uint32_t time_microsecs);
ros::Time imageTimestampToRosTime(uint32_t time_secs, uint32_t time_microsecs);

bool ptp_time_sync_ = false;
bool network_time_sync_ = false;
std::atomic_bool ptp_status_;
std::atomic_bool ptp_time_stamp_in_use_;
int32_t ptp_time_offset_secs_ = 0;
};

Expand Down
30 changes: 15 additions & 15 deletions multisense_ros/src/camera.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -303,7 +303,7 @@ Camera::Camera(Channel* driver, const std::string& tf_prefix) :
last_frame_id_(-1),
border_clip_type_(BorderClip::NONE),
border_clip_value_(0.0),
ptp_status_(false)
ptp_time_stamp_in_use_(false)
{
//
// Query device and version information from sensor
Expand Down Expand Up @@ -835,7 +835,7 @@ void Camera::histogramCallback(const image::Header& header)
Status status = driver_->getImageHistogram(header.frameId, mh);
if (Status_Ok == status) {
rh.frame_count = header.frameId;
rh.time_stamp = convertImageTimestamp(header.timeSeconds, header.timeMicroSeconds);
rh.time_stamp = imageTimestampToRosTime(header.timeSeconds, header.timeMicroSeconds);
rh.width = header.width;
rh.height = header.height;
switch(header.source) {
Expand All @@ -862,7 +862,7 @@ void Camera::jpegImageCallback(const image::Header& header)
return;
}

ros::Time t = convertImageTimestamp(header.timeSeconds, header.timeMicroSeconds);
ros::Time t = imageTimestampToRosTime(header.timeSeconds, header.timeMicroSeconds);

const uint32_t height = header.height;
const uint32_t width = header.width;
Expand Down Expand Up @@ -932,7 +932,7 @@ void Camera::disparityImageCallback(const image::Header& header)

const uint32_t imageSize = (header.width * header.height * header.bitsPerPixel) / 8;

ros::Time t = convertImageTimestamp(header.timeSeconds, header.timeMicroSeconds);
ros::Time t = imageTimestampToRosTime(header.timeSeconds, header.timeMicroSeconds);

switch(header.source) {
case Source_Disparity:
Expand Down Expand Up @@ -1101,7 +1101,7 @@ void Camera::monoCallback(const image::Header& header)
return;
}

ros::Time t = convertImageTimestamp(header.timeSeconds, header.timeMicroSeconds);
ros::Time t = imageTimestampToRosTime(header.timeSeconds, header.timeMicroSeconds);

switch(header.source) {
case Source_Luma_Left:
Expand Down Expand Up @@ -1209,7 +1209,7 @@ void Camera::rectCallback(const image::Header& header)
return;
}

ros::Time t = convertImageTimestamp(header.timeSeconds, header.timeMicroSeconds);
ros::Time t = imageTimestampToRosTime(header.timeSeconds, header.timeMicroSeconds);

switch(header.source) {
case Source_Luma_Rectified_Left:
Expand Down Expand Up @@ -1341,7 +1341,7 @@ void Camera::depthCallback(const image::Header& header)
return;
}

ros::Time t = convertImageTimestamp(header.timeSeconds, header.timeMicroSeconds);
ros::Time t = imageTimestampToRosTime(header.timeSeconds, header.timeMicroSeconds);

const float bad_point = std::numeric_limits<float>::quiet_NaN();
const uint32_t depthSize = header.height * header.width * sizeof(float);
Expand Down Expand Up @@ -1514,7 +1514,7 @@ void Camera::pointCloudCallback(const image::Header& header)
return;
}

ros::Time t = convertImageTimestamp(header.timeSeconds, header.timeMicroSeconds);
ros::Time t = imageTimestampToRosTime(header.timeSeconds, header.timeMicroSeconds);

//
// Resize our corresponding pointclouds if we plan on publishing them
Expand Down Expand Up @@ -1767,7 +1767,7 @@ void Camera::rawCamDataCallback(const image::Header& header)
raw_cam_data_.gain = left_luma_rect.gain;
raw_cam_data_.exposure_time = left_luma_rect.exposure;
raw_cam_data_.frame_count = left_luma_rect.frameId;
raw_cam_data_.time_stamp = convertImageTimestamp(header.timeSeconds, header.timeMicroSeconds);
raw_cam_data_.time_stamp = imageTimestampToRosTime(header.timeSeconds, header.timeMicroSeconds);
raw_cam_data_.width = left_luma_rect.width;
raw_cam_data_.height = left_luma_rect.height;

Expand Down Expand Up @@ -1796,7 +1796,7 @@ void Camera::colorImageCallback(const image::Header& header)
return;
}

ros::Time t = convertImageTimestamp(header.timeSeconds, header.timeMicroSeconds);
ros::Time t = imageTimestampToRosTime(header.timeSeconds, header.timeMicroSeconds);

switch (header.source)
{
Expand Down Expand Up @@ -2087,7 +2087,7 @@ void Camera::groundSurfaceSplineCallback(const ground_surface::Header& header)
ground_surface_spline_pub_.publish(ground_surface_utilities::eigenToPointcloud(eigen_pcl, frame_id_origin_));
}

ros::Time Camera::convertImageTimestamp(uint32_t time_secs, uint32_t time_microsecs)
ros::Time Camera::imageTimestampToRosTime(uint32_t time_secs, uint32_t time_microsecs)
{
// When camera has ptp enabled and there is no ptp lock,
// the image timestamp equals 0
Expand All @@ -2100,7 +2100,7 @@ ros::Time Camera::convertImageTimestamp(uint32_t time_secs, uint32_t time_micros
if (ptp_time_sync_ && time_secs > std::abs(ptp_time_offset_secs_))
{
time_stamp += ros::Duration(ptp_time_offset_secs_);
ptp_status_ = true;
ptp_time_stamp_in_use_ = true;
}

return time_stamp;
Expand Down Expand Up @@ -2293,20 +2293,20 @@ void Camera::deviceStatusDiagnostic(diagnostic_updater::DiagnosticStatusWrapper&
void Camera::ptpStatusDiagnostic(diagnostic_updater::DiagnosticStatusWrapper& stat)
{
stat.add("ptp enabled", ptp_time_sync_);
stat.add("ptp status", ptp_status_);
stat.add("ptp status", ptp_time_stamp_in_use_);
if (!ptp_time_sync_)
{
stat.summary(diagnostic_msgs::DiagnosticStatus::OK, "PTP status: Disabled.");
return;
}

if (ptp_status_)
if (ptp_time_stamp_in_use_)
{
stat.summary(diagnostic_msgs::DiagnosticStatus::OK, "PTP status: OK");
} else {
stat.summary(diagnostic_msgs::DiagnosticStatus::ERROR, "PTP status: Uncalibrated");
}
ptp_status_ = false;
ptp_time_stamp_in_use_ = false;
}

void Camera::diagnosticTimerCallback(const ros::TimerEvent&)
Expand Down

0 comments on commit 9767d5a

Please sign in to comment.