robot

Dependencies:   FastPWM3 mbed

DQMapper/DQMapper.h

Committer:
bwang
Date:
2017-01-08
Revision:
44:3fd6a43b91f0
Parent:
42:030e0ec4eac5
Child:
45:cf8ad81fb0f0

File content as of revision 44:3fd6a43b91f0:

#ifndef __DQ_MAPPER_H
#define __DQ_MAPPER_H

class DQMapper {
public:
    virtual void map(float torque_percent, float w, float *d, float *q) = 0;
};

class QOnlyMapper : public DQMapper {
public:
    QOnlyMapper(float kt, float tmax) {_kt = kt; _tmax = tmax;}
    virtual void map(float torque_percent, float w, float *d, float *q) {*d = 0; *q = torque_percent * _tmax / _kt;}
private:
    float _kt;
    float _tmax;
};

class LinearNoFWMapper : public DQMapper {
public:
    LinearNoFWMapper(float kt, float tmax, float lambda) {_kt = kt; _tmax = tmax; _lambda = lambda;}
    virtual void map(float torque_percent, float w, float *d, float *q);
private:
    float _kt;
    float _tmax;
    float _lamdba;
};

class LutMapper : public DQMapper {
public:
    virtual void map(float torque_percent, float w, float *d, float *q);
};

#endif