officinerobotiche / uNAV.X

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

Feature/direct motor #32

Closed rbonghi closed 9 years ago

rbonghi commented 9 years ago

New feature to select different type of controllers. The new function MotorTaskController (from old Velocity(void) ) select from a new variable (ex. motor_state) a connected law control and call function to generate reference and relative measure.

motor_state is a list of type of low level controller for motor:

@Myzhar @guiott @katodo

rbonghi commented 9 years ago

Now we have two type of state controller (evolution enable command). The first state controller is only to control a single motor and we have four states:

The second state_controller is only to control high level controller (an example: configuration control, navigation and others), now we have two states, but if we want we add more states:

@Myzhar @guiott

rbonghi commented 9 years ago
rbonghi commented 9 years ago

I modify the message to motor control and add an information: type https://github.com/officinerobotiche/orblibcpp/issues/5 Now we have:

/**
 * Message to control single motor
 * - dimension number motors
 */
#define MOTOR_TYPE_REQ 0
#define MOTOR_TYPE_SEND 1
typedef struct motor_control{
    int8_t num;
    int8_t type;
    int16_t motor;
}motor_control_t;
#define LNG_MOTOR_CONTROL sizeof(motor_control_t)

When we solve the bug #34 I remove type information.

rbonghi commented 9 years ago

I change again a message to improve velocity of communication, this version of code is not efficient with dynamic packet #34 .

Now we have:

typedef int16_t motor_control_t;
#define LNG_MOTOR_CONTROL sizeof(motor_control_t)

and six type of message to require:


#define VEL_MOTOR_L 13
#define VEL_MOTOR_R 14
#define VEL_MOTOR_MIS_L 15
#define VEL_MOTOR_MIS_R 16
#define ENABLE_MOTOR_L 17
#define ENABLE_MOTOR_R 18
rbonghi commented 9 years ago

Added a new motor control option with this commit: 81f23a066787e492034c4d121d8398797f3bf8d8

#define STATE_CONTROL_EMERGENCY -1
#define STATE_CONTROL_DISABLE 0
#define STATE_CONTROL_DIRECT 1
#define STATE_CONTROL_POSITION 2
#define STATE_CONTROL_VELOCITY 3
#define STATE_CONTROL_TORQUE 4