KRAI ITB GARUDAGO / Mbed 2 deprecated MR1_New

Dependencies:   mbed pid_dagoz

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers actuator.h Source File

actuator.h

00001 /*
00002  * Author    : Garudago KRAI ITB 2019
00003  * Developer : Calmantara Sumpono Putra 
00004  * Version   : 1.0.0 
00005  */
00006 
00007 #ifndef ACTUATOR_H
00008 #define ACTUATOR_H
00009 
00010 class Base{
00011     public:
00012         Base();
00013         //procedure to initiate all of constants
00014 
00015         float *update_state(float wheel_right_position,
00016                            float wheel_left_position,
00017                            float wheel_back_position);
00018         //procedure to get current position of robot
00019 
00020         float *compute_action(float x_robot,
00021                               float y_robot,
00022                               float theta, 
00023                               float x_target,
00024                               float y_target,
00025                               float theta_target);
00026         //function to get set point value for each motor
00027 
00028         float compute_velocity(float x_robot,
00029                                float y_robot,
00030                                float x_target,
00031                                float y_target);
00032         //function to compute linear velocity of robot
00033 
00034         float compute_rotation(float theta,
00035                                float theta_target);
00036         //function to compute rotation of robot
00037 
00038         float *manual_movement(float theta,
00039                               float theta_target,
00040                               float linear,
00041                               float alpha);
00042         //procedure for manual movement robot
00043         
00044         float _compute_alpha(float x_robot,
00045                              float y_robot,
00046                              float theta,
00047                              float x_target,
00048                              float y_target);
00049         //function to compute robot movement orientation
00050 
00051         float *_base_position_from_wheels(float wheel_right,
00052                                           float wheel_left,
00053                                           float wheel_back);
00054         //funstion to transform robot position from three wheels
00055 
00056         float *_base_velocity_from_wheels(float wheel_right_top,
00057                                           float wheel_left_top,
00058                                           float wheel_right_back,
00059                                           float wheel_left_back);
00060         //function to transform robot velocity from four wheels
00061 
00062         float *_wheels_from_base(float linear,
00063                                  float rotation,
00064                                  float alpha);   
00065         //funtion to compute set point for each motor   
00066   
00067     private:
00068         //motor and encoder distance from center
00069         float _motor_distance_from_center;
00070         float _encoder_distance_from_center;
00071         //limitation and tolerance
00072         float _position_tolerance;
00073         float _orientation_tolerance;
00074         float _max_velocity_magnitude;
00075         float _max_rotation_magnitude;
00076         float _cutoff_velocity_magnitude;
00077         float _cutoff_rotation_magnitude;
00078         //limitation 
00079         float _max_linear_acceleration_magnitude;
00080         float _max_linear_deceleration_magnitude;
00081         float _max_angular_acceleration_magnitude;
00082         float _max_angular_deceleration_magnitude;
00083         //feedforward constant
00084         float _linear_acceleration_feedforward_factor;
00085         float _angular_acceleration_feedforward_factor;
00086         float _linear_deceleration_feedforward_factor;
00087         float _angular_deceleration_feedforward_factor;
00088         
00089         float x_actual, y_actual, theta_actual;
00090         float _last_position, _last_orientation;
00091         //compute rotation variable
00092         float _feedforward_rotation_command;
00093         float _prev_feedforward_rotation_command;
00094         float _rotation_from_s1;    //for acceleration command
00095         float _rotation_from_s2;    //for deceleration command
00096         float _target_rotation_command;
00097         float _prev_target_rotation_command;
00098         //compute velocity variable
00099         float _feedforward_linear_command;
00100         float _prev_feedforward_linear_command;
00101         float _linear_from_s1;    //for acceleration command
00102         float _linear_from_s2;    //for deceleration command
00103         float _target_linear_command;
00104         float _prev_target_linear_command;
00105 };
00106 
00107 
00108 #endif