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 "utilities/error.h"
00044 #include "utilities/error_stack.h"
00045 #include "velocityprofile_rect.hpp"
00046 #include "velocityprofile_dirac.hpp"
00047 #include "velocityprofile_trap.hpp"
00048 #include "velocityprofile_traphalf.hpp"
00049 #include <string.h>
00050
00051 namespace KDL {
00052
00053 using namespace std;
00054
00055 VelocityProfile* VelocityProfile::Read(istream& is) {
00056 IOTrace("VelocityProfile::Read");
00057 char storage[25];
00058 EatWord(is,"[",storage,sizeof(storage));
00059 Eat(is,'[');
00060 if (strcmp(storage,"DIRACVEL")==0) {
00061 Eat(is,']');
00062 IOTracePop();
00063 return new VelocityProfile_Dirac();
00064 } else if (strcmp(storage,"CONSTVEL")==0) {
00065 double vel;
00066 is >> vel;
00067 Eat(is,']');
00068 IOTracePop();
00069 return new VelocityProfile_Rectangular(vel);
00070 } else if (strcmp(storage,"TRAPEZOIDAL")==0) {
00071 double maxvel;
00072 double maxacc;
00073 is >> maxvel;
00074 Eat(is,',');
00075 is >> maxacc;
00076 Eat(is,']');
00077 IOTracePop();
00078 return new VelocityProfile_Trap(maxvel,maxacc);
00079 } else if (strcmp(storage,"TRAPEZOIDALHALF")==0) {
00080 double maxvel;
00081 double maxacc;
00082 is >> maxvel;
00083 Eat(is,',');
00084 is >> maxacc;
00085 Eat(is,',');
00086 bool starting;
00087 is >> starting;
00088 Eat(is,']');
00089 IOTracePop();
00090 return new VelocityProfile_TrapHalf(maxvel,maxacc,starting);
00091 }
00092 else {
00093 throw Error_MotionIO_Unexpected_MotProf();
00094 }
00095 return 0;
00096 }
00097
00098
00099
00100 }