test

Dependencies:   mbed ros_lib_kinetic nhk19mr2_can_info splitData SerialHalfDuplex_HM

Revision:
4:fffdb273836e
Parent:
3:bcae0bb64b81
Child:
5:556d5a5e9d24
--- a/main.cpp	Fri Feb 08 16:59:48 2019 +0000
+++ b/main.cpp	Sat Feb 09 14:18:15 2019 +0000
@@ -1,15 +1,33 @@
 //mbed間の同期を、master-slaveで行いたい。
+//masetrで4つの脚の動きをすべて決定,
+//その動きをslaveに送る。
 
 #include "mbed.h"
 #include "KondoServo.h"
 #define Mastar;
 //#define Slave;
-////////////////Legクラス。下にmain文がある。
+
 const float Pi = 3.141592;
 const float kRadToDegree = 180.0 / Pi;
 
+//定義 
 namespace Quadruped
 {
+    class Leg;
+    namespace Motion{}
+    namespace WalkingPattern{}
+}
+
+namespace CanConnector
+{
+    //class Mastar;
+    //class Slave;
+}
+
+//実装
+namespace Quadruped
+{
+    //脚の定義
     class Leg
     {
         float rad_[2];
@@ -27,7 +45,6 @@
         void SetRad(float rad, int servo_num);
         float GetRad(int servo_num);
     };
-
     Leg::Leg(PinName pin_serial_tx, PinName pin_serial_rx) : servo_(pin_serial_tx, pin_serial_rx)
     {
         rad_[0] = 0;
@@ -65,7 +82,33 @@
     float Leg::GetRad(int servo_num)
     {
         return rad_[servo_num];
-    }       
+    }
+
+    namespace Motion
+    {
+        void Slide(Leg leg,float stride_m);//引数に歩幅
+        void Rising(Leg leg,float width_m);//引数に上げる高さ
+    }
+    void Motion::Slide(Leg leg,float stride_m)
+    {
+        static float time_s = 0.0f;
+        
+    }
+    void Motion::Rising(Leg leg,float width_m)
+    {
+        static float time_s = 0.0f;
+
+    }
+
+    namespace WalkingPattern
+    {
+        using namespace Motion;
+        void Straight();
+        void TurnRight();
+        void TurnLeft();
+        void Climb();
+        void Overcoming();//段差、紐乗り越え動作
+    }
 }