Skip to content
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

ROS2 #63

Open
wants to merge 9 commits into
base: ros2
Choose a base branch
from
Open

ROS2 #63

Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix error with timestamps
pascalau committed Jan 25, 2023
commit 2c0ae35fc72bc182dcb2e434a94c82f7cdb280c8
5 changes: 3 additions & 2 deletions src/ros_vrpn_client.cpp
Original file line number Diff line number Diff line change
@@ -302,13 +302,13 @@ void inline getTimeStamp(
// timestamp
double time_correction_s = time_diff_h_round * kHoursToSec;
rclcpp::Time vicon_stamp_corrected(
vicon_stamp.seconds() - time_correction_s, vicon_stamp.nanoseconds(), RCL_ROS_TIME);
vicon_stamp.seconds() - time_correction_s, 0, RCL_ROS_TIME);
// Attaching the corrected timestamp
*timestamp = vicon_stamp_corrected;
// Outputting the time delay to the ROS console
if (nh->display_time_delay) {
rclcpp::Duration time_diff_corrected = ros_stamp - vicon_stamp_corrected;
static const int kMaxMessagePeriod = 2;
static const int kMaxMessagePeriod = 2000;
RCLCPP_WARN_STREAM_THROTTLE(
nh->get_logger(), *nh->get_clock(), kMaxMessagePeriod,
"Time delay: " << time_diff_corrected.seconds());
@@ -439,6 +439,7 @@ int main(int argc, char * argv[])
tool->publish_estimated_odometry(target_state);
fresh_data = false;
}
exec.spin_some();
loop_rate.sleep();
}