pattern-generator.cpp
Go to the documentation of this file.
00001 #include <iostream>
00002 #include <sstream>
00003 #include <gtest/gtest.h>
00004 
00005 #include "halfsteps_pattern_generator.hh"
00006 #include "halfsteps_pattern_generator/Footprint.h"
00007 #include "yaml.hh"
00008 #include "binary.hh"
00009 
00010 
00011 TEST(TestStampedPosition, empty)
00012 {
00013   HalfStepsPatternGenerator pg(0.95, 1.05, 0.005);
00014   HalfStepsPatternGenerator::footprints_t footprints;
00015 
00016   HalfStepsPatternGenerator::footprint_t footprint;
00017 
00018   using namespace boost::posix_time;
00019   using namespace boost::gregorian;
00020   walk::TimeDuration d (milliseconds (5));
00021   footprint.duration = d;
00022   footprint.beginTime = walk::Time (date(1970,1,1), seconds(1));
00023   footprints.push_back (footprint);
00024 
00025   pg.setFootprints(footprints, true);
00026 
00027   const HalfStepsPatternGenerator::Trajectory3d& lf = pg.leftFootTrajectory();
00028 
00029   walk::TimeDuration lengthLf = lf.computeLength();
00030 
00031   std::cout << "--- original pattern generator" << std::endl
00032             << pg << std::endl;
00033 
00034   walk::YamlWriter<HalfStepsPatternGenerator> writer (pg);
00035   writer.write("/tmp/test.yaml");
00036 
00037   walk::BinaryWriter<HalfStepsPatternGenerator> binaryWriter (pg);
00038   binaryWriter.write("/tmp/test.bin");
00039 
00040   walk::BinaryReader<HalfStepsPatternGenerator> binaryReader ("/tmp/test.bin",
00041                                                               0.95, 1.05, 0.005);
00042 
00043   std::cout << "--- pattern generator after binary reading" << std::endl
00044             << pg << std::endl;
00045 
00046   walk::BinaryWriter<HalfStepsPatternGenerator> binaryWriter2 (binaryReader);
00047   binaryWriter2.write("/tmp/test2.bin");
00048 
00049   // walk::YamlReader<HalfStepsPatternGenerator> reader ("/tmp/test.yaml",
00050   //                                                  0.95, 1.05, 0.005);
00051 
00052   // walk::YamlWriter<walk::YamlReader<HalfStepsPatternGenerator> > writer2 (reader);
00053   // writer2.write("/tmp/test2.yaml");
00054 
00055   // walk::YamlReader<HalfStepsPatternGenerator> reader2 ("/tmp/test.yaml",
00056   //                                                   0.95, 1.05, 0.005);
00057 }
00058 
00059 int main(int argc, char **argv)
00060 {
00061   testing::InitGoogleTest(&argc, argv);
00062   return RUN_ALL_TESTS();
00063 }


halfsteps_pattern_generator
Author(s): Nicolas Perrin, Thomas Moulard/thomas.moulard@gmail.com
autogenerated on Sat Dec 28 2013 17:05:31