19 return tracks.emplace(
id,
VariantTrack{
id}).first->second;
25 return tracks.emplace(
id,
VariantTrack{id, updateFunc}).first->second;
31 (*this)[id].addKeyframe(keyframe);
43 for (
auto& it : tracks)
45 it.second.update(time, ignoreEmptyTracks);
56 catch (
const std::out_of_range&)
69 catch (
const std::out_of_range&)
78 os <<
"Trajectory with " <<
trajectory.tracks.size() <<
" tracks: ";
79 for (
const auto& [name, track] :
trajectory.tracks)
81 os <<
"\n - " << track;
92 return [func](
VariantValue value) { func(std::get<float>(value)); };
99 return [func](
VariantValue value) { func(std::get<Eigen::MatrixXf>(value)); };
106 return [func](
VariantValue value) { func(std::get<Eigen::Quaternionf>(value)); };
std::function< void(VariantValue)> UpdateFunc
This class is used to update entities based on trajectory defined by keyframes.
void update(float time, bool ignoreEmptyTracks=false)
Update all tracks for the given time.
VariantTrack & operator[](const TrackID &id)
Get the track with the given ID.
VariantTrack & addTrack(const TrackID &id)
Add track with the given ID (and no update function).
void addKeyframe(const TrackID &id, const VariantKeyframe &keyframe)
Add a keyframe to the specified track.
void clear()
Clear the trajectory of all tracks.
Quaternion< float, 0 > Quaternionf
VariantTrack::UpdateFunc toUpdateFunc(std::function< void(float)> func)
Wrap the function in a Track::UpdateFunc.
std::variant< float, Eigen::MatrixXf, Eigen::Quaternionf > VariantValue
Variant for trajectory values.
std::ostream & operator<<(std::ostream &os, const Track< ValueT > &track)
Keyframe< VariantValue > VariantKeyframe
A keyframe with of type TValue.
Track< VariantValue > VariantTrack
A track with value type TValue.
std::string TrackID
ID of tracks.
This file offers overloads of toIce() and fromIce() functions for STL container types.