Rleg  2
 All Data Structures Files Functions Variables Typedefs Macros Groups Pages
Functions
control.c File Reference
#include "control.h"
Include dependency graph for control.c:

Go to the source code of this file.

Functions

void control_test (double time_global, IMU_DATA_STRUCT *imu_data, MRA_DATA_STRUCT *mra_data, ENC_DATA_STRUCT *enc_data)
 Function: control_main Summary: Calculate the control signal. More...
 

Function Documentation

void control_test ( double  time_global,
IMU_DATA_STRUCT imu_data,
MRA_DATA_STRUCT mra_data,
ENC_DATA_STRUCT enc_data 
)

Function: control_main Summary: Calculate the control signal.

Parameters
t_task_1_globalcontaining the ...
imu_datacontaining data from accelerometer, gyrometer and magnetometer
eff_datacontaining data from load cell
mra_datastruct containing the control signal
Returns
nothing

void control_main (double time_global, IMU_DATA_STRUCT *imu_data, MRA_DATA_STRUCT *mra_data , ENC_DATA_STRUCT *enc_data){ int t_gait = 0; int gait_cycle = 2000000;//Gait cycle takes 2 seconds int heelstrike_threshold = 3;

In case of heel strike the gait cycle starts Heel strike detection: module of acceleration vector (which has components in x and z axis) higher than threshold. if ((((imu_data->acc.x)^2 + (imu_data->acc.z)^2)^0.5) > heelstrike_threshold){ t_gait = 0; Between 10% and 60% of the gait cycle, actuation voltage is 0V } else if (t_gait>(0.1*gait_cycle) && t_gait<=(0.6*gait_cycle)){ control voltage 0V mra_data.v_ctl=0; More than 60% of the gait cycle, set actuation voltage to 4V. } else if (t_gait>(0.6*gait_cycle) && t_gait<(0.8*gait_cycle)){ mra_data.v_ctl=4000; }

}

/* Calculate the control signal

void control_byKneeAngle(&ang_data,&mra_data){ if((ang_data->velocity)>0){ mra_data.v_ctl = 4000; }

if((ang_data->ang -ANG_MAX)< 0.1) mra_data.v_ctl = 6000; } [brief description]

[long description]

Parameters
time_global[description]
imu_data[description]
mra_data[description]
enc_data[description]

create a dimmer.

Definition at line 58 of file control.c.

References MRA_DATA_STRUCT::v_ctl, and V_CTRL_MAX.

58  {
59  mra_data->v_ctl = ((int)time_global)%V_CTRL_MAX;
60 }
#define V_CTRL_MAX
Definition: control.h:11
short int v_ctl
Voltage level for control output.