Commit d72af769 authored by Stefan Steinmüller's avatar Stefan Steinmüller
Browse files

Merge branch 'master' of gitlab.cs.fau.de:diygrp2/diy-project

parents 43f05766 596b23bc
#ifndef DIY_GPARSER_H_INCLUDED
#define DIY_GPARSER_H_INCLUDED
typedef struct {
uint8_t code;
uint16_t feed_speed;
uint16_t x_pos;
}g_code_t;
uint8_t diy_parse_g_code(char* command_string, g_code_t* g_code);
#endif // DIY_GPARSER_H_INCLUDED
#include "diy_parser.h"
uint8_t diy_parse_g_code(char* command_string, g_code_t* g_code){
}
......@@ -68,9 +68,13 @@ float pi_control(float e)
*/
float pid_control(float e)
{
const float K = 0.8f;
const float T_i = 0.5f;//0.18
float K = 0.8f;
const float T_i = 0.1f;//0.18
const float T_d = 0.05;
if(e > 2 || e < -2){
K = 5.0;
}
static float e_old = 0;
......
......@@ -181,7 +181,8 @@ void control_thread(cyg_addrword_t arg)
while(1){
error = null_offset_pos - phi_cor;
motor_signal = control_func_ptr(error);
null_of/\\\////zs_printf("%f,%f,%f\n",null_offset_pos,phi_cor,motor_signal);
null_offset_pos = offset_control(motor_signal);
ezs_printf("%f,%f,%f,%f\n",null_offset_pos,phi_cor,error,motor_signal);
motor_pwm(motor_signal);
#ifdef WCET
uint32_t current_run = ezs_watch_stop(&time_sample);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment