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.
prototype01.h
- Committer:
- piroro4560
- Date:
- 2019-08-22
- Revision:
- 2:95ef998b5a62
- Parent:
- 1:ad711893a3a7
File content as of revision 2:95ef998b5a62:
#ifndef PROTO01_H
#define PROTO01_H
#define PI 3.141592653589793238462643383219502884
#include "mbed.h"
/**
* S字制御クラス
*/
class Sample {
public:
/**
* コンストラクタ
* @param accdis_ 加速距離
* @param decdis_ 減速距離(誤差あり。大きめに調整すると良い)
* @param maxspeed_ 最大速度(?)
*/
Sample(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