trajectory_segment.cpp
Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043 #include "trajectory_segment.hpp"
00044
00045
00046 namespace KDL {
00047
00048
00049 Trajectory_Segment::Trajectory_Segment(Path* _geom, VelocityProfile* _motprof, bool _aggregate):
00050 motprof(_motprof),geom(_geom), aggregate(_aggregate)
00051 {
00052
00053 }
00054
00055 Trajectory_Segment::Trajectory_Segment(Path* _geom, VelocityProfile* _motprof, double _duration, bool _aggregate):
00056 motprof(_motprof),geom(_geom), aggregate(_aggregate)
00057 {
00058
00059 motprof->SetProfileDuration(0, geom->PathLength(), _duration);
00060 }
00061
00062 Path* Trajectory_Segment::GetPath()
00063 {
00064 return geom;
00065 }
00066
00067 VelocityProfile* Trajectory_Segment::GetProfile()
00068 {
00069 return motprof;
00070 }
00071
00072 double Trajectory_Segment::Duration() const
00073 {
00074 return motprof->Duration();
00075 }
00076
00077 Frame Trajectory_Segment::Pos(double time) const
00078 {
00079 return geom->Pos(motprof->Pos(time));
00080 }
00081
00082 Twist Trajectory_Segment::Vel(double time) const
00083 {
00084 return geom->Vel(motprof->Pos(time),motprof->Vel(time));
00085 }
00086
00087 Twist Trajectory_Segment::Acc(double time) const
00088 {
00089 return geom->Acc(motprof->Pos(time),motprof->Vel(time),motprof->Acc(time));
00090 }
00091
00092
00093 void Trajectory_Segment::Write(std::ostream& os) const
00094 {
00095 os << "SEGMENT[ " << std::endl;
00096 os << " ";geom->Write(os);os << std::endl;
00097 os << " ";motprof->Write(os);os << std::endl;
00098 os << "]";
00099 }
00100
00101 Trajectory_Segment::~Trajectory_Segment()
00102 {
00103 if (aggregate)
00104 {
00105 delete motprof;
00106 delete geom;
00107 }
00108 }
00109
00110 }