Dependencies:   uw_28015 mbed move4wheel2 EC CruizCore_R6093U CruizCore_R1370P

main.cpp

Committer:
yuki0701
Date:
2019-11-16
Revision:
1:26fc1b2f1c42
Parent:
0:b87fd8dd4322
Child:
2:820dcd23c8e3

File content as of revision 1:26fc1b2f1c42:

#include "EC.h"
#include "R1370P.h"
#include "move4wheel.h"
#include "mbed.h"
#include "math.h"
#include "PathFollowing.h"
#include "movement.h"
#include "manual.h"
#include "can.h"

#define PI 3.141592

//#define PROGRAM_INFO //プログラム使用時に使用プログラムの情報を最初に表示する際に定義

int go_waitmode = 0;

/*------------運動時の各速度の設定----------*/
double st_speed = 500; // 移動開始時の速度
double max_speed = 2500; // 直線移動時の最大速度
double mid_speed = 2000; // 直線移動時の中間速度
double turn_speed = 1000; // 旋回時の速度
double end_speed = 200; // 停止直前の速度
double fruit_speed = 200; // 果物を取る時の速度
/*--------------------------------------*/

//-----mbed led------------------//点灯条件-----------------------//参照場所------------------------------//
//DigitalOut cansend_led(LED1);  //cansend -> on                //can.cpp
//DigitalOut canread_led(LED2);  //canread -> on                //can.cpp
//DigitalOut debug_led(LED3);    //maxon debug programme -> on  //maxonsetting.cpp

//////////////////////////////////////////////////////////////以下main文/////////////////////////////////////////////////////////////////

int main()
{
    
       //UserLoopSetting_maxon();
       UserLoopSetting_sensor();
       UserLoopSetting_can();
/*
    #ifdef PROGRAM_INFO //プログラム使用時に使用プログラムの情報を最初に表示

       printf("ソースファイル名 : %s¥n", __FILE__);
       printf("作成日付 : %s¥n", __DATE__);
       printf("作成時刻 : %s¥n", __TIME__);

    #endif
    */
        int move_flag = 0;
       while(1) {
            
            id1_value[0] = 1;
           switch(id1_value[0]) {
    //-----auto mode----------------------------------------------------------------------------------------------------------------------//
               case 1:
                    
                 //   gogo_straight(1,1,0,0,200,0,50,500,5,0.1,10,0.1,50,0);
//                    gogo_straight(1,1,200,0,800,0,500,500,5,0.1,10,0.1,50,0);
//                    gogo_straight(1,1,800,0,1000,0,500,200,5,0.1,10,0.1,50,0);
//                    mt_stop();
//                    pos_correction(1000,0,0,1,1);
//                    mt_stop();
//                    wait(1.5);
//                    gogo_straight(1,1,1000,0,800,0,200,500,5,0.1,10,0.1,50,0);
//                    gogo_straight(1,1,800,0,200,0,500,500,5,0.1,10,0.1,50,0);
//                    gogo_straight(1,1,200,0,0,0,500,200,5,0.1,10,0.1,50,0);
//                    mt_stop();
//                    pos_correction(0,0,0,1,1);
                    pos_correction(50,0,0,1,1);
                    mt_stop();
                    move_flag = 1;
                    break;

    //-----wait mode----------------------------------------------------------------------------------------------------------------------//
               case 0:

                   calc_xy(0,1,1);
                   ashi_led();
                   //MaxonControl(0,0,0,0);
                   go_waitmode = 0;

                   break;
    //-----manual mode--------------------------------------------------------------------------------------------------------------------//
               case 2:

                   ManualOut(250,100,500,200);
                   go_waitmode = 0;

                   break;
           }
    //------------------------------------------------------------------------------------------------------------------------------------//
        if(move_flag == 1)break;
       }
       
}