#ifndef motor_model_host_h #define motor_model_host_h /* motor_model.host.h - DC motor model. */ /* asserv - Position & speed motor control on AVR. {{{ * * Copyright (C) 2006 Nicolas Schodet * * APBTeam: * Web: http://apbteam.org/ * Email: team AT apbteam DOT org * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * * }}} */ /** Motor and load caracteristics and current data. */ struct motor_t { /* Motor caracteristics. */ double Ke; /* Speed constant ((rad/s)/V). */ double Kt; /* Torque constant (N.m/A). */ double Rf; /* Bearing friction (N.m/(rad/s)). */ double R; /* Terminal resistance (Ohm). */ double L; /* Terminal inductance (H). */ /* Gearbox caracteristics. */ double i_G; /* Gearbox ratio. */ double ro_G;/* Gearbox efficiency. */ /* Load caracteristics. */ double J; /* Load (kg.m^2). */ /* Wheel caracteristics. */ double w_r; /* Wheel radius (m). */ /* Simulation parameters. */ double h; /* Simulation time step (s). */ int d; /* Simulation time step division. */ /* Simulation current state. */ double t; /* Current time (not realy used) (s). */ double u; /* Current input voltage (V). */ double i; /* Current current (A). */ double o; /* Current angular speed (o for omega) (rad/s). */ double th; /* Current theta (th for theta) (rad). */ }; /** Make a simulation step. */ void motor_model_step (struct motor_t *m); #endif /* motor_model_host_h */