From df7d0d94ecc69fa9aadd2ab90db89b5ef1a74030 Mon Sep 17 00:00:00 2001 From: Nicolas Schodet Date: Thu, 29 Apr 2010 23:03:56 +0200 Subject: digital/mimot/src/dirty: add copy/pasted firmware for mimot, refs #123 This is a quick and dirty firmware copied from asserv. This will be improved once #124 is closed. --- digital/mimot/src/dirty/motor_model.host.h | 65 ++++++++++++++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 digital/mimot/src/dirty/motor_model.host.h (limited to 'digital/mimot/src/dirty/motor_model.host.h') diff --git a/digital/mimot/src/dirty/motor_model.host.h b/digital/mimot/src/dirty/motor_model.host.h new file mode 100644 index 00000000..3a04e15a --- /dev/null +++ b/digital/mimot/src/dirty/motor_model.host.h @@ -0,0 +1,65 @@ +#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 characteristics. */ +struct motor_def_t +{ + /* Motor characteristics. */ + 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). */ + double u_max;/* Maximum voltage (V). */ + /* Gearbox characteristics. */ + double i_G; /* Gearbox ratio. */ + double ro_G;/* Gearbox efficiency. */ + /* Load characteristics. */ + double J; /* Load at gearbox output (kg.m^2). */ +}; + +/** Motor and load characteristics and current data. Angular speed and theta + * are at motor output, not gearbox output. */ +struct motor_t +{ + /* Motor and load characteristics. */ + struct motor_def_t m; + /* Simulation parameters. */ + double h; /* Simulation time step (s). */ + int d; /* Simulation time step division. */ + /* Simulation current state. */ + double t; /* Current time (not really 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 */ -- cgit v1.2.3