00001 00005 #include <TimeSource/TimeSource.h> 00006 00007 #include "VehPoseSource.h" 00008 00009 // default implementation: You can usually come up with a better one 00010 bool VehPoseSource::getCurPose(utils::Time& time, VehPose& pose, bool) 00011 { 00012 time = TimeSource::now(); 00013 return getPose(time, pose); 00014 } 00015 00016 void VehPoseSource::interpolate(const VehPose& prev_pose, 00017 const VehPose& next_pose, double t, 00018 VehPose& sensor_pose) 00019 { 00020 // use rotation's simple linear interpolation to get the proper rotation 00021 sensor_pose.ori = utils::Rotation::slerp(prev_pose.ori, next_pose.ori, t); 00022 00023 // and just use linear interpolation on the individual axes to the position 00024 utils::Vec3d delta = next_pose.pos - prev_pose.pos; 00025 sensor_pose.pos = prev_pose.pos + delta*t; 00026 }