Anti-Sway Capstone 1.0
|
Tracking Mode Control Law. More...
#include <stdbool.h>
#include <pthread.h>
#include <stdint.h>
#include <stdlib.h>
#include "setup.h"
#include "io.h"
#include "thread-lib.h"
#include "discrete-lib.h"
#include "record.h"
#include "tracking.h"
Data Structures | |
struct | TrackingControlScheme |
Tracking Mode Feedback Control Block. More... | |
Macros | |
#define | NOMINAL_REFERENCE_ANGLE 0.0 |
Reference Angle (rad) | |
#define | T_s 0.1 |
The settling time (0.1 s) | |
#define | os 0.05 |
The overshoot fraction (5%) | |
#define | DATA_LEN 12 |
The number of entries. | |
Functions | |
static void | SetupScheme (TrackingControlScheme *scheme, Proportional K_o, Proportional K_i, Proportional B) |
static void * | TrackingModeThread (void *resource) |
static int | TrackingControlLaw (Angle angle_ref, Angle angle_input, Velocity pos_vel, TrackingControlScheme *scheme, int(*SetVoltage)(Voltage voltage)) |
int | TrackingFork () |
int | TrackingJoin () |
Variables | |
pthread_t | tracking_thread |
Thread ID. | |
ThreadResource | resource |
Thread Resources (Shared Resources) | |
static TrackingControlScheme | x_control |
The Control Scheme for the X Motor. | |
static TrackingControlScheme | y_control |
The Control Scheme for the Y Motor. | |
static int | error |
Local Error Flag. | |
static FileID_t | file = -1 |
The file ID. | |
static char * | data_file_name = "tracking.mat" |
The file Name. | |
static char * | data_names [DATA_LEN] |
The data names. | |
static double | data [DATA_LEN] |
Buffer for data. | |
static double * | data_buff = data |
Pointer to next data point to insert into buffer. | |
static int | id = 1 |
ID variable. | |
Tracking Mode Control Law.
|
inlinestatic |
Sets up a TrackingControl Scheme
scheme | The scheme to setup |
K_o | The outer loop gain |
K_i | The inner loop gain |
B | The artificial damping to impose |
|
inlinestatic |
Executes 1 timestep for the Tracking Mode Control Law for its input to the plant
angle_ref | The reference angle for Tracking Mode |
angle_input | The measured rope angle for Tracking Mode |
pos_vel | The measured velocity of the motor |
scheme | A pointer to the TrackingControlScheme structure used to execute the control law |
SetVoltage | The function that sets the voltage of the appropriate motor |
int TrackingFork | ( | ) |
Executes Tracking Mode (concurrently)
int TrackingJoin | ( | ) |
Stops Tracking Mode (concurrent process)
|
static |
The Thread Function for Tracking Mode
resource | A pointer to a Resource sturcture for Tracking Mode |
|
static |
The data names.