This program is for an autonomous robot for the competition at the Hochschule Luzern. http://cruisingcrepe.wordpress.com/ We are one of the 32 teams. http://cruisingcrepe.wordpress.com/ The postition control is based on this Documentation: Control of Wheeled Mobile Robots: An Experimental Overview from Alessandro De Luca, Giuseppe Oriolo, Marilena Vendittelli. For more information see here: http://www.dis.uniroma1.it/~labrob/pub/papers/Ramsete01.pdf

Dependencies:   mbed

Fork of autonomous Robot Android by Christian Burri

Committer:
chrigelburri
Date:
Thu Feb 07 17:43:19 2013 +0000
Revision:
0:31f7be68e52d
Child:
1:6cd533a712c6
first steps

Who changed what in which revision?

UserRevisionLine numberNew contents of line
chrigelburri 0:31f7be68e52d 1 #ifndef _MAXON_ESCON_H_
chrigelburri 0:31f7be68e52d 2 #define _MAXON_ESCON_H_
chrigelburri 0:31f7be68e52d 3
chrigelburri 0:31f7be68e52d 4 #include "mbed.h"
chrigelburri 0:31f7be68e52d 5 #include "Hallsensor.h"
chrigelburri 0:31f7be68e52d 6 #include "defines.h"
chrigelburri 0:31f7be68e52d 7
chrigelburri 0:31f7be68e52d 8 /**
chrigelburri 0:31f7be68e52d 9 * @author Christian Burri
chrigelburri 0:31f7be68e52d 10 *
chrigelburri 0:31f7be68e52d 11 * @section LICENSE
chrigelburri 0:31f7be68e52d 12 *
chrigelburri 0:31f7be68e52d 13 * Copyright (c) 2013 HSLU Pren Team #1 Cruising Crêpe
chrigelburri 0:31f7be68e52d 14 * All rights reserved.
chrigelburri 0:31f7be68e52d 15 *
chrigelburri 0:31f7be68e52d 16 * @section DESCRIPTION
chrigelburri 0:31f7be68e52d 17 *
chrigelburri 0:31f7be68e52d 18 * This class implements the driver for the Maxon ESCON servo driver.....
chrigelburri 0:31f7be68e52d 19 *
chrigelburri 0:31f7be68e52d 20 * Datasheet:
chrigelburri 0:31f7be68e52d 21 *
chrigelburri 0:31f7be68e52d 22 * http://escon.maxonmotor.com
chrigelburri 0:31f7be68e52d 23 */
chrigelburri 0:31f7be68e52d 24 class MaxonESCON
chrigelburri 0:31f7be68e52d 25 {
chrigelburri 0:31f7be68e52d 26
chrigelburri 0:31f7be68e52d 27 protected:
chrigelburri 0:31f7be68e52d 28
chrigelburri 0:31f7be68e52d 29 /** Duty Cycle to set the speed */
chrigelburri 0:31f7be68e52d 30 PwmOut _pwm;
chrigelburri 0:31f7be68e52d 31 /** To Enable the amplifier */
chrigelburri 0:31f7be68e52d 32 DigitalOut _enb;
chrigelburri 0:31f7be68e52d 33 /** Hallsensor Class */
chrigelburri 0:31f7be68e52d 34 Hallsensor* _hall;
chrigelburri 0:31f7be68e52d 35 /** Ready output from ESCON */
chrigelburri 0:31f7be68e52d 36 DigitalIn _isenb;
chrigelburri 0:31f7be68e52d 37 /** Actual speed from ESCON analog Output 1 */
chrigelburri 0:31f7be68e52d 38 AnalogIn _actualSpeed;
chrigelburri 0:31f7be68e52d 39
chrigelburri 0:31f7be68e52d 40 private:
chrigelburri 0:31f7be68e52d 41
chrigelburri 0:31f7be68e52d 42 /** increment the Hallpattern */
chrigelburri 0:31f7be68e52d 43 int _pulses;
chrigelburri 0:31f7be68e52d 44
chrigelburri 0:31f7be68e52d 45 public:
chrigelburri 0:31f7be68e52d 46
chrigelburri 0:31f7be68e52d 47 /** Create a motor control object
chrigelburri 0:31f7be68e52d 48 *
chrigelburri 0:31f7be68e52d 49 * @param enb DigitalOut, set high for enable
chrigelburri 0:31f7be68e52d 50 * @param isenb DigitalIn, high for enable
chrigelburri 0:31f7be68e52d 51 * @param pwm PwmOut pin, set the Velocity
chrigelburri 0:31f7be68e52d 52 * @param hall1 HALL Object
chrigelburri 0:31f7be68e52d 53 * @param Actual Speed AnalogIn Filtered Signal for ActualSpeed from Motor
chrigelburri 0:31f7be68e52d 54 */
chrigelburri 0:31f7be68e52d 55 MaxonESCON(PinName enb,
chrigelburri 0:31f7be68e52d 56 PinName isenb,
chrigelburri 0:31f7be68e52d 57 PinName pwm,
chrigelburri 0:31f7be68e52d 58 PinName actualSpeed,
chrigelburri 0:31f7be68e52d 59 Hallsensor *hall);
chrigelburri 0:31f7be68e52d 60
chrigelburri 0:31f7be68e52d 61 /** Set the speed of the motor with a pwm for 10%..90%
chrigelburri 0:31f7be68e52d 62 * 50% PWM is 0rpm
chrigelburri 0:31f7be68e52d 63 * Caclulate from 1/s in 1/min plus the Facotr of the ESCON
chrigelburri 0:31f7be68e52d 64 * @param speed The speed of the motor as a normalised value in [1/s]
chrigelburri 0:31f7be68e52d 65 */
chrigelburri 0:31f7be68e52d 66 void setVelocity(float speed);
chrigelburri 0:31f7be68e52d 67
chrigelburri 0:31f7be68e52d 68 /**Return the speed from ESCON
chrigelburri 0:31f7be68e52d 69 *
chrigelburri 0:31f7be68e52d 70 * Analog input 1.65V = 0 rpm
chrigelburri 0:31f7be68e52d 71 *
chrigelburri 0:31f7be68e52d 72 * @return speed of the motor [1/s]
chrigelburri 0:31f7be68e52d 73 */
chrigelburri 0:31f7be68e52d 74 float getActualSpeed(void);
chrigelburri 0:31f7be68e52d 75
chrigelburri 0:31f7be68e52d 76 /** Set the period of the pwm duty cycle.
chrigelburri 0:31f7be68e52d 77 *
chrigelburri 0:31f7be68e52d 78 * Wrapper for PwmOut::period()
chrigelburri 0:31f7be68e52d 79 *
chrigelburri 0:31f7be68e52d 80 * @param seconds - Pwm duty cycle in seconds.
chrigelburri 0:31f7be68e52d 81 */
chrigelburri 0:31f7be68e52d 82 void period(float period);
chrigelburri 0:31f7be68e52d 83
chrigelburri 0:31f7be68e52d 84 /** Set the Motor to a enable sate
chrigelburri 0:31f7be68e52d 85 *
chrigelburri 0:31f7be68e52d 86 * @param enable - 0 for disable 1 for enable.
chrigelburri 0:31f7be68e52d 87 */
chrigelburri 0:31f7be68e52d 88 void enable (bool enb);
chrigelburri 0:31f7be68e52d 89
chrigelburri 0:31f7be68e52d 90 /**Tests if the servo drive is enabled.
chrigelburri 0:31f7be68e52d 91 *
chrigelburri 0:31f7be68e52d 92 * @return <code>true</code> if the drive is enabled, <code>false</code> otherwise.
chrigelburri 0:31f7be68e52d 93 */
chrigelburri 0:31f7be68e52d 94 bool isEnabled(void);
chrigelburri 0:31f7be68e52d 95
chrigelburri 0:31f7be68e52d 96 /** Return the translativ Position
chrigelburri 0:31f7be68e52d 97 *
chrigelburri 0:31f7be68e52d 98 * @return position in meter
chrigelburri 0:31f7be68e52d 99 */
chrigelburri 0:31f7be68e52d 100 int getPulses(void);
chrigelburri 0:31f7be68e52d 101
chrigelburri 0:31f7be68e52d 102 /** Set the Pulses of the Motor
chrigelburri 0:31f7be68e52d 103 *
chrigelburri 0:31f7be68e52d 104 * @return number of turns
chrigelburri 0:31f7be68e52d 105 */
chrigelburri 0:31f7be68e52d 106 int setPulses(int setPos);
chrigelburri 0:31f7be68e52d 107 };
chrigelburri 0:31f7be68e52d 108
chrigelburri 0:31f7be68e52d 109 #endif