test

Files at this revision

API Documentation at this revision

Comitter:
M_souta
Date:
Tue Jul 16 06:46:52 2019 +0000
Commit message:
test

Changed in this revision

TrapezoidControl.cpp Show annotated file Show diff for this revision Revisions of this file
TrapezoidControl.h Show annotated file Show diff for this revision Revisions of this file
diff -r 000000000000 -r 2e7bf7fce378 TrapezoidControl.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TrapezoidControl.cpp	Tue Jul 16 06:46:52 2019 +0000
@@ -0,0 +1,14 @@
+#include "TrapezoidControl.h"
+
+#include "mbed.h"
+#include <stdio.h>
+
+void TrapezoidControl::reset(void) {
+    sampling.reset();
+    time = 0;
+    
+}
+
+void TrapezoidControl::start(void) {
+    sampling.start();
+}
\ No newline at end of file
diff -r 000000000000 -r 2e7bf7fce378 TrapezoidControl.h
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TrapezoidControl.h	Tue Jul 16 06:46:52 2019 +0000
@@ -0,0 +1,42 @@
+#ifndef TRAPEZOIDCONTROL_H_
+#define TRAPEZOIDCONTROL_H_
+
+#include "mbed.h"
+#include <stdio.h>
+
+class TrapezoidControl {
+    public:
+        //いつもの1
+        TrapezoidControl();
+        //いつもの2
+        TrapezoidControl(float maxAcceleration, //最大加速度
+                         float maxVelocity);    //最大速度
+        //いつもの3    
+        TrapezoidControl(float maxAcceleration, //最大加速度
+                         float maxVelocity,     //最大速度
+                         float strVerocity,     //初期速度
+                         float endVerocity,     //終点速度
+                         float tarDistance);    //目標距離
+        //最大加速度と最大速度の設定・変更
+        void setParameter(float maxAcceleration, float maxVelocity);
+        //目標値の設定・変更
+        void setDis(float tarDistance, float endVerocity);
+        //目標値の初期化
+        void reset();
+        //台形制御の開始
+        void start();
+        //速度の取得
+        float getVel();
+        //距離(理論値)の取得
+        float getDis();
+    private:
+        float maxAcceleration_;
+        float maxVelocity_;
+        float strVerocity_;
+        float endVerocity_;
+        float tarDistance_;
+        float time;
+        Timer sampling;
+};
+
+#endif //TRAPEZOIDCONTROL_H_
\ No newline at end of file