For coursework of group 3 in SOFT564Z

Dependencies:   Motordriver ros_lib_kinetic

main.cpp

Committer:
Jonathan738
Date:
2019-11-28
Revision:
3:7da9888ac8dc
Parent:
1:6a10e58b3d43
Child:
4:8afc50a3e4ac

File content as of revision 3:7da9888ac8dc:

/*------------------------------------------------------------------------------
    Created by: Sami Sequeira & Jonathan Wheadon
    @ The University of Plymouth
    November 2019
    For the SOFT564Z module on distributed systems
------------------------------------------------------------------------------*/

#include "General.hpp"
#include "Battery_Monitor.hpp"

// Threads
Thread ROS_Thread(osPriorityRealtime);   // Create sample_THREAD with highest priority
Thread Movement_Thread(osPriorityNormal);

// Thread ID for the Main function (CMSIS API)
osThreadId tidMain;

//int main starts all threads then becomes TerminalThread
int main(void)
{
    // Main thread ID
    tidMain = Thread::gettid();

    // Start each thread
    ROS_Thread.start(ROS_Handler);
    //Thread2.start(main3);
    
    initBattCheck();
    
    /**************************************************************************/
    initialize(); //initialize(); only needs to be called once, at the start of the program.
    //the encoder interrupts should be able to handle themselves from there, and do not require
    //resetting.
    /**************************************************************************/
    while(1) {
        /**********************************************************************/
        //careful, putting this in a while loop will mean the bot moves in an infinite square!
        /**********************************************************************/
        tempMove(40);
        tempRotate(-90);
        tempMove(40);
        tempRotate(-90);
        tempMove(40);
        tempRotate(-90);
        tempMove(40);
        tempRotate(-90);
    }
}