Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: proto01.h
- Revision:
- 3:c46f084010aa
- Parent:
- 2:95ef998b5a62
- Child:
- 4:40c5ac00bb5b
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/proto01.h Thu Aug 22 14:07:24 2019 +0000
@@ -0,0 +1,79 @@
+#ifndef PROTO01_H
+#define PROTO01_H
+#define PI 3.141592653589793238462643383219502884
+
+#include "mbed.h"
+
+/**
+ * S字制御クラス
+ */
+class Proto1 {
+ public:
+
+ /**
+ * コンストラクタ
+ * @param accdis_ 加速距離
+ * @param decdis_ 減速距離(誤差あり。大きめに調整すると良い)
+ * @param maxspeed_ 最大速度(?)
+ */
+ Proto1(double accdis_, double decdis_, double maxspeed_, double s_vector_);
+
+ /**
+ * 目標点の設定
+ * @param targetx_ 目標点のx座標
+ * @param targety_ 目標点のy座標
+ * @param startx_ 開始地点のx座標
+ * @param starty_ 開始地点のy座標
+ */
+ void target_xy(int targetx_, int targety_, int startx_, int starty_);
+
+ /**
+ * S字に変化する速度を計算
+ * @param now_x 現在地点のx座標
+ * @param now_y 現在地点のy座標
+ */
+ void calculate(int now_x, int now_y);
+
+ double getvalue_x();
+
+ double getvalue_y();
+
+/***
+ * accDis : 加速中に進む距離
+ * decDis : 減速中に進む距離
+ * maxspeed : 最大速度
+ **/
+ double accdis;
+ double decdis;
+ double accdis2;
+ double decdis2;
+ double maxspeed;
+
+ double accsec;
+ double decsec;
+
+ double s_vector;
+// s_vector : start speed
+ double vector;
+
+ double targetx;
+ double targety;
+ double startx;
+ double starty;
+ double nowx;
+ double nowy;
+
+/***
+ * tergetDis : 開始地点から目標点までの距離
+ * tergetRad : 現在地と目標点がなす角度
+ * nowDis : 進んだ距離
+ **/
+ double targetDis;
+ double targetRad;
+ double nowDis;
+ double middledis;
+ double counter;
+
+};
+
+#endif
\ No newline at end of file