officinerobotiche / uNAV.X

Project MPLABX for drive uNAV on dsPIC33
http://rnext.it/project/unav/
MIT License
9 stars 2 forks source link

Feature/new motors functions #44

Closed rbonghi closed 9 years ago

rbonghi commented 9 years ago

Update about function name in motors_pid.c This branch clean old function name and change message parameter configuration:

This branch is a part from #39 without feature to increase precision with low velocity in low velocity.

rbonghi commented 9 years ago

To solve this pull request will be update messge parameter_motor with:

typedef struct parameter_motor {
    float cpr;
    float ratio;
    float volt_bridge;
    int8_t encoder_pos;
    int8_t versus;
    uint8_t enable_set;
} parameter_motor_t;

when encoder_pos It is the position of encoder compare to motor axis

/**
 * Message to control single motor
 * - dimension number motors
 */
typedef int16_t motor_control_t;
#define LNG_MOTOR_CONTROL sizeof(motor_control_t)

typedef struct motor {
    motor_control_t state;                 //Motor state of control
    motor_control_t volt;                   //Voltage applied (old control_vel)
    motor_control_t torque;              //Torque (old current)
    motor_control_t velocity;            //Velocity
    motor_control_t position;           //Position
} motor_t;
#define LNG_MOTOR sizeof(motor_t)

The old packet constraint_t will be removed and will be used the same packet motor_t when for all type of variable you will be set the maximum value possible.

rbonghi commented 9 years ago

With commit df3eb7c I've changed the functionality about interrupt. Timer1 interrupt control Motor Task and High Level Control Task In Motor Task you can decide the frequency about pid control task, same idea is in High Level Control Task

The Motor Task and High Level Control Task are called from other interrupts.