test

Dependencies:   mbed ros_lib_kinetic nhk19mr2_can_info splitData SerialHalfDuplex_HM

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers orbit.cpp Source File

orbit.cpp

00001 #include "orbit.h"
00002 
00003 Orbit::Orbit(OrbitPattern pattern)
00004 {
00005     pattern_ = pattern;
00006 }
00007 float Orbit::GetOneWalkTime()
00008 {
00009     float time_s;
00010     switch (pattern_)
00011     {
00012     case FREELINES:
00013         time_s = FreeLines::GetOneWalkTime();
00014         break;
00015     case FOURPOINT:
00016         time_s = FourPoint::GetOneWalkTime();
00017         break;
00018     default:
00019         time_s = Triangle::GetOneWalkTime();
00020         break;
00021     }
00022     return time_s;
00023 }
00024 int Orbit::GetOrbit(OneLeg &leg, float phasetime_s)
00025 {
00026     int ret;
00027     switch (pattern_)
00028     {
00029     case FREELINES:
00030         ret = FreeLines::GetOrbit(leg, phasetime_s);
00031         break;
00032     case FOURPOINT:
00033         ret = FourPoint::GetOrbit(leg, phasetime_s);
00034         break;
00035     default:
00036         ret = Triangle::GetOrbit(leg, phasetime_s);
00037         break;
00038     }
00039     return ret;
00040 }
00041 void Orbit::Copy(const Orbit &origin)
00042 {
00043     pattern_ = origin.pattern_;
00044     switch (pattern_)
00045     {
00046     case FREELINES:
00047         FreeLines::Copy((FreeLines)origin);
00048         break;
00049     case FOURPOINT:
00050         FourPoint::Copy((FourPoint)origin);
00051         break;
00052     default:
00053         Triangle::Copy((Triangle)origin);
00054         break;
00055     }
00056 }