library for omnidirectional planar positioning system

Dependents:   measuring_wheel 2018NHK_gakugaku_robo 2018NHK_gaku_ver2

OmniPosition.h

Committer:
takeuchi
Date:
2018-08-21
Revision:
4:fc4c88fffef8
Parent:
3:47676abdf529
Child:
5:f8c3aeb4e65f

File content as of revision 4:fc4c88fffef8:

#ifndef OMNI_POSITION_H
#define OMNI_POSITION_H

#include "mbed.h"
#include "CycleInt.h"

#define SERIAL_BUFFER_SIZE 9
#define HEADER_FIRST_BYTE 72
#define HEADER_SECOND_BYTE 42
#define RECEIVE_FREQ 0.05
#define SEND_FREQ 0.1
#define DEFAULT_BAUD 115200

class OmniPosition : public RawSerial {
    public :
        OmniPosition(PinName serialTX, PinName serialRX);

        int getX();
        int getY();
        double getTheta();

        void reset();

    private :
        void readData();
        void assemble();
        void send();

        CycleInt readCounter;
        CycleInt takeCounter;
        Ticker assembleTicker;
        Ticker sendTicker;

        int X, bfrX;
        int Y, bfrY;
        int thetaint;
        double theta, bfrTheta;

        char *buffer;
        char *data;

        bool headerCheck;
        int headerPoint;
        bool resetSend;

        uint8_t checksum;
};

#endif