54 double currentRosTimeBig = currentRosTime;
55 double currentSensorTimeBig = currentSensorTime;
64 double currentHypothesis_t0 = currentRosTime - currentSensorTime;
66 double meanEstimatedHypothesis_t0 = currentHypothesis_t0;
69 pmediator_->insert(meanEstimatedHypothesis_t0);
70 meanEstimatedHypothesis_t0 =
pmediator_->getMedian();
79 double p = 1-std::exp(0.5*(1-1/(1-progress)));
92 double currentOut = meanEstimatedHypothesis_t0 + currentSensorTime;
97 double currentError = currentOut - currentRosTime;
99 timesync::TimesyncDebug debugMessage;
100 debugMessage.seq = seqNumber_external;
101 debugMessage.sensor_time = currentSensorTimeBig;
102 debugMessage.ros_time = currentRosTimeBig;
103 debugMessage.corrected_timestamp = finalOut;
107 ROS_DEBUG(
"SENSOR_TIMESTAMP: %.10lf CUR_HYP: %.10lf", currentSensorTime, currentHypothesis_t0);
108 ROS_DEBUG(
"ROS_TIME: %.10lf STAMP: %.10lf ERR: %+.10lf RUN_HYP: %.10lf", currentRosTime, currentOut, currentError, meanEstimatedHypothesis_t0);
TimestampSynchronizer(const Options defaultOptions=Options())
double previousSensorTime_
double alfa_HoltWinters_early
void setTimeOffset(double timeOffset)
void publish(const boost::shared_ptr< M > &message) const
void setUseHoltWinters(bool useHoltWinters)
void setEarlyClamp(bool earlyClamp, int earlyClampWindow=0)
double initialB_HoltWinters
void setAlfa_HoltWinters(double alfa_HoltWinters)
double sync(double currentSensorTime, double currentRosTime, unsigned int seqNumber_external)
bool param(const std::string ¶m_name, T ¶m_val, const T &default_val) const
HoltWintersSmoothFilter holtWinters_
void setAlfa_HoltWinters_early(double alfa_HoltWinters_early)
void setBeta_HoltWinters(double beta_HoltWinters)
Publisher advertise(const std::string &topic, uint32_t queue_size, bool latch=false)
void setMedianFilter(bool useMedianFilter, int medianFilterWindow=0)
std::unique_ptr< Mediator< double > > pmediator_
ros::Publisher debugPublisher_
void setBeta_HoltWinters_early(double beta_HoltWinters_early)
double beta_HoltWinters_early