00001 /* 00002 * esc_bounded.cpp 00003 * 00004 * Created on: Jan 30, 2015 00005 * Author: Filip Mandic 00006 */ 00007 00008 #include <labust/control/esc/EscBounded.hpp> 00009 00010 #include <ros/ros.h> 00011 00012 namespace labust{ 00013 namespace control{ 00014 namespace esc{ 00015 00016 typedef EscBounded Base; 00017 00018 Base::EscBounded(int ctrlNum, numericprecission Ts):EscBoundedBase<double>(ctrlNum, Ts), 00019 state_(vector::Zero(controlNum)){ 00020 00021 state_initialized_ = true; 00022 } 00023 00024 Base::~EscBounded(){ 00025 00026 } 00027 00028 void Base::initController(double K, double omega, double alpha, double Ts){ 00029 00030 K_ = K; 00031 omega_ = omega; 00032 alpha_ = alpha; 00033 Ts_ = Ts; 00034 cycle_count_ = 0; 00035 00036 state_initialized_ = false; 00037 old_vals_initialized_ = false; 00038 initialized_ = true; 00039 } 00040 00041 Base::vector Base::generateControl(numericprecission argument){ 00042 00043 vector control = vector::Zero(2); 00044 double speed = std::sqrt(alpha_*omega_); 00045 control(0) = speed*std::cos(argument); 00046 control(1) = speed*std::sin(argument); 00047 return control; 00048 } 00049 } 00050 } 00051 } 00052 00053 00054