library for omnidirectional planar positioning system

Dependents:   measuring_wheel 2018NHK_gakugaku_robo 2018NHK_gaku_ver2

OmniPosition.h

Committer:
takeuchi
Date:
2018-08-24
Revision:
7:73e542a88106
Parent:
6:f8dbbe93bc7b
Child:
8:930369f241fb
Child:
9:222f7fcbd05a

File content as of revision 7:73e542a88106:

#ifndef OMNI_POSITION_H
#define OMNI_POSITION_H

#include "mbed.h"
#include <vector>

#define OP_SERIAL_BUFFER_SIZE 8
#define OP_HEADER_FIRST_BYTE 72
#define OP_HEADER_SECOND_BYTE 42
#define OP_RECEIVE_FREQ 0.05
#define OP_SEND_FREQ 0.1
#define OP_DEFAULT_BAUD 115200

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

        int16_t getX();
        int16_t getY();
        float getTheta();

        void reset();

    private :
        void receiveByte();
        void assembleLoop();
        void assemble();

        Thread thread;
        std::vector<unsigned char> buf;

        int16_t X;
        int16_t Y;
        int16_t theta;

        bool resetSend;
};

#endif